I have two classes TestClass1, TestClass2
I have set MaxParallel threads through assembly in AssemblyInfo.cs file in my test project:
[assembly: Xunit.CollectionBehaviorAttribute(MaxParallelThreads = 4)]
Reference Set maximum parallel threads
I have installed xunit-2.0.0-beta4-build2738(Prerelease). Also installed Xunit runner to find tests.
From my knowledge and research tells that Xunit does not run tests in the same collection in parallel. Reference Using test collections in xUnit.net v2 that is why for both the classes below I have used different collections.
Visual Studio 2013 finds my tests but when I run all the tests, it still runs tests serially. I want them to run in parallel.
If someone could help that would be great!
My code below:
Namespace1
namespace name1
{
public class MFixture
{
}
[CollectionDefinition("Test1")]
public class CollectionClass : ICollectionFixture<MFixture>
{
}
[Collection("Test1")]
public class TestClass1
{
// variables
public TestClass1()
{
//code
}
[Fact]
public void method1()
{
//code
}
[Fact]
public void method2()
{
//code
}
}
}
Namespace2
namespace name2
{
public class MFixture1
{
}
[CollectionDefinition("Test2")]
public class CollectionClass1 : ICollectionFixture<MFixture1>
{
}
[Collection("Test2")]
public class TestClass2
{
// variables
public TestClass2()
{
//code
}
[Fact]
public void method12()
{
//code
}
[Fact]
public void method22(){
{
//code
}
}
}
Other references
How to run Selenium tests in parallel with xUnit
XUnit.net attributes
XUnit.net issues