简体   繁体   中英

Ordering integration tests with NUnit for test automation

I'm writing a test automation framework using the below technologies:

Selenium Web Driver
NUnit
cSharp
Visual Studio

In Java I can use the testng.xml file to group tests together (test suites) and have them run in the order they are listed.

Now that I'm using cSharp with NUnit, creating test suites with tests that run in order have not been as straight forward.

Right now I'm using the order attribute at the test fixture level, and grouping tests using test categories. This was working fine until test # 5 needs to be run in a different order with another test suite.

Please note these tests are being run from Visual Studio as we're not using NUnit Console.

Has anyone had a similar experience and could offer any insight on this type of issue?

Thanks!

I am also using C#, selenium and NUnit. As I understand from my view, tests are run in alphabet order. For that reason, I am using names and numbers in a test name to have correct order in the run. If you are using NUnit and you want to run tests in groups from one project, then you can use "Category", something like:

[Test]
[Category("YourGroup")]
public void TestClass()
{
}

and cmd looks like:

nunit3-console.exe PATHtoYOURtestFile.exe/dll --where "cat == YourGroup" --result=PathForResult.xml;format=nunit3

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