简体   繁体   中英

Overriding test execution status for a custom exception when using Specflow

I'm using specflow with Nunit. When my tests are executed if a particular exception is thrown, I would like to set the status of my tests as Warning instead of Fail.

I have looked as updating the Nunit status, but Nunit test status seems readonly.

I am not 100% sure this would work, I remember doing something similar while ago, but don't have the code anymore. Check this property TestContext.CurrentContext.Result (nunit3)

You can check the value in aftereach, and if it is Failed, and whatever other conditions should be met, you can Assert.Warn("Whatever");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM