views:

27

answers:

0

I know regular ms-test unit tests can be parallelized on a multi-core machine (with caveats of course) by specifying parallelTestCount attribute in the .testresults file in the test solution. Like this,

<Execution parallelTestCount="1">
    <TestTypeSpecific />
    <AgentRule name="Execution Agents">
    </AgentRule>
  </Execution>

More at: http://blogs.msdn.com/b/vstsqualitytools/archive/2009/12/01/executing-unit-tests-in-parallel-on-a-multi-cpu-core-machine.aspx

However, I have a data-driven test, something like this, this is just one test, but the input comes in from a csv and runs 1000s of records through the same test.

[DeploymentItem("InputDataRows.csv"), Timeout(37800000),
            DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\InputDataRow.csv", "InputDataRow#csv", DataAccessMethod.Sequential), 
        TestMethod]
        public void RunProcessing()
        {
            int userId = Convert.ToInt32(TestContext.DataRow[0].ToString());
            int connId = Convert.ToInt32(TestContext.DataRow[1].ToString());
            string xml = TestHelper.GetDataFromDb(userId, connId);
            a = doStuffA(xml); b = doStuffB(xml);
            Assert.IsTrue(a == b);
        }

Because this is a slow process, I am looking at parallelizing this unit test.

The Sequential enum on the attribute is just the way it accesses data, the other option is Random, which is still serial and not parallel.