C# 测试自动化FX中的错误报告
我用创建自动化测试,我是初学者 我需要知道如何从测试脚本中测试失败 我正在使用C#脚本 假设我想识别某个窗口控件并对其执行操作:C# 测试自动化FX中的错误报告,c#,error-reporting,testautomationfx,C#,Error Reporting,Testautomationfx,我用创建自动化测试,我是初学者 我需要知道如何从测试脚本中测试失败 我正在使用C#脚本 假设我想识别某个窗口控件并对其执行操作: if(window["Exists"]) { //Perform action. } else { // move to the next test cases. } 我不知道如何处理else部分?要在窗口不存在时报告测试用例失败,您可以使用以下类的方法: 使用故障测试方法: if (window["Exist"]) {
if(window["Exists"])
{
//Perform action.
}
else
{
// move to the next test cases.
}
我不知道如何处理else部分?要在窗口不存在时报告测试用例失败,您可以使用以下类的方法:
故障测试方法:
if (window["Exist"])
{
// Perform actions
}
else
{
Verify.FailTest("Window does not exist"); // Report failure message that will be shown in test report
}
Verify.AreEqual(window["Exist"], true); // will fail test if window dows not exist
// Perform actions
使用AreEqual
方法:
if (window["Exist"])
{
// Perform actions
}
else
{
Verify.FailTest("Window does not exist"); // Report failure message that will be shown in test report
}
Verify.AreEqual(window["Exist"], true); // will fail test if window dows not exist
// Perform actions