我想知道在断言失败之后是否有一种简单的方法来完成测试。我们曾经使用Galileo进行所有自动化测试,但是我们已经移走了Visual Studio Test框架。我们有一种方法可以使测试失败,但可以继续进行。
public static bool DoAssertAndContinue(Action assert)
{
try
{
assert();
return true;
}
catch (AssertionException ae)
{
ConfigContext.WriteLine(ae.Message);
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
这是我们之前使用过的...它将被这样称呼:
assertionResults.Add(Automation.Utils.CommonMethods.DoAssertAndContinue(() => Assert.IsTrue(detail.ValidateName(boo, urns))));
Run Code Online (Sandbox Code Playgroud)
我只是试图找出最好的方法来模拟我们以前所拥有的,而不必重构所有测试。