简体   繁体   中英

Execute Code when all Test Scripts are executed in C# Visual Studio

I need to execute some set of code once all the Test Scripts have been completed executed (Sequentially/ Parallelly)( It should be like 'After Suite' in JAVA). I came across annotation [SetupFixture] and [OneTimeTearDown]. Generally OneTimeTearDown in SetUpFixer should run once, after all the test scripts executions are done. But due to some unknown reason it is not happening.

Please help me if you have faced and resolved this issue earlier.

I am trying to build framework so [onetimeteardown][SetupFixture] and test class will not be in same project.

I would normally ask you for some sample code, which isn't working. However, your last line seems like the clue to answering your question.

NUnit analyzes one test assembly in order to find attributes. The SetUpFixture with a OneTimeTearDown to run after all the tests in the assembly must be in the same assembly.

If you have tests in multiple assemblies and want some code to run after all the assemblies have completed you will have to code that yourself. NUnit doesn't provide such a feature.

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