tomaszeman / Xunit.Extensions.Ordering

Xunit extension with full support for ordered testing at collection, class and test case levels. Full-featured AssemblyFixture implementation.
Apache License 2.0
53 stars 9 forks source link

Run Specific Test Classes in Order #15

Open mufasalg0 opened 1 year ago

mufasalg0 commented 1 year ago

Is it possible to run test classes in order? Without disabling the parallel execution for the whole framework?

I have found this: https://github.com/tomaszeman/Xunit.Extensions.Ordering#test-cases-ordering

In order to run classes in order, I need to create AssemblyInfo.cs and add following lines in AssemblyInfo.cs

using Xunit; //Optional [assembly: CollectionBehavior(DisableTestParallelization = true)] //Optional [assembly: TestCaseOrderer("Xunit.Extensions.Ordering.TestCaseOrderer", "Xunit.Extensions.Ordering")] //Optional [assembly: TestCollectionOrderer("Xunit.Extensions.Ordering.CollectionOrderer", "Xunit.Extensions.Ordering")] This causes to run whole framework with only one thread.

I would like to accomplish to put classes in order in selected Collection For instance I have collection ("sequentialRun")

Collection[("sequentialRun"),Order(1)] Class A{

[Fact] void test1(){} [Fact] void test2(){}

}

Collection[("sequentialRun"),Order(2)] Class B{

[Fact] void test1(){} [Fact] void test2(){} }

Class C{

[Fact] void test1(){} [Fact] void test2(){} } When I trigger the whole test script in my framework I would like to achieve that A and C starts running together and when A is done then B can start. Is there anyway to accomplish this??

Thank you so much!!