硒:检查我的测试用例通过或失败 [英] Selenium: Check i the testcase pass or fail
问题描述
所有的家伙首先我对硒全新的。
我有一个自动化项目。在我的项目,我创建一个截图功能把我已经为我的测试用例创建了事件的截屏。现在,如果我的测试情况下通过,那么所有的截图应该移动到文件夹传递,否则失败的文件夹中。
Guys First of all I am totally new for Selenium. I am having a automation project. In my project, I am creating a screenshot function to take screenshots of my event which I have created for my testcases. Now if my test cases passes then all screenshot should move to Pass folder, else fail folder.
我想知道如何检测我的测试用例通过?
I would like to know how to detect that my test case pass?
我知道NUnit的检测,但我想它的程序,以便我CAM把我的截图以及日志文件,以通过或失败的文件夹。
I know Nunit detects but I wanted to program it so that I cam place my screenshot as well as log file to pass or fail folder.
计划在C#
硒
NUnit的我运行测试用例。
Program in C# Selenium Nunit to run my test case.
推荐答案
检查的状态属性的,并与TestStatus枚举在拆卸方法比较。
Check status property and compare it with TestStatus enum at teardown method.
NUnit2
TestContext.CurrentContext.Result.Status
TestContext.CurrentContext.Result.Status
NUnit3
TestContext.CurrentContext.Result.Outcome.Status
TestContext.CurrentContext.Result.Outcome.Status
这篇关于硒:检查我的测试用例通过或失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!