.net - XUnit.net: run Theories in parallel -
xunit.net supports parallel test execution.
my tests parameterized (theories). every test run against different storage. here's example:
public class testcase1 { [theory] [inlinedata("mssql")] [inlinedata("oracle")] [inlinedata("pgsql")] [inlinedata("sqlite")] public void dotests(string storage) {} } public class testcase2 { [theory] [inlinedata("mssql")] [inlinedata("oracle")] [inlinedata("pgsql")] [inlinedata("sqlite")] public void dotests(string storage) {} }
by default tests executed in parallel. can grouped in collections (with of collection
attribute).
i can't run tests in parallel every test case has own db schema. put tests single collection assembly-level attribute:
[assembly: collectionbehavior(collectionbehavior.collectionperassembly)]
but means tests differnt storages run serially.
what want run tests different storages in parallel single storage in serial:
=> testcase1.dotest("mssql") => testcase2.dotest("mssql")
=> testcase1.dotest("oracle") => testcase2.dotest("oracle")
, on
is possible in xunit.net?
update: (put here doesn't support code in comments). @bradwilson suggested, it's possible split tests derived classes:
public class testcase1 { public void dotests(string storage) {} } public class testcase1_mssql { [fact] public void dotests(string storage) { dotests("mssql"); } } public class testcase1_oracle { [fact] public void dotests(string storage) { dotests("oracle"); } }
i wouldn't theories , inline data; instead, abstract base class , concrete test classes each storage method. gets grouping want.
Comments
Post a Comment