question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable Parallelization for Data-Driven Tests

See original GitHub issue

Description

following your documentation here: https://github.com/Microsoft/testfx-docs/blob/master/RFCs/004-In-Assembly-Parallel-Execution.md

did not execute my tests on parallel. furthermore, the Parallelize attribute cannot be found (you do not mention where this attribute is coming from)

Steps to reproduce

complete code:

using System;
using System.Collections.Generic;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTestProject1
{
    [TestClass]
    public class UnitTest1
    {
        [DataTestMethod]
        [DynamicData(nameof(GetData), DynamicDataSourceType.Method)]
        public void TestMethod1(int a, int b, int expected)
        {
            Thread.Sleep(10000);
            var actual = a + b;
            Assert.AreEqual(expected, actual);
        }

        [DataTestMethod]
        [DynamicData(nameof(GetData), DynamicDataSourceType.Method)]
        public void TestMethod2(int a, int b, int expected)
        {
            Thread.Sleep(10000);
            var actual = a + b;
            Assert.AreEqual(expected, actual);
        }

        public static IEnumerable<object[]> GetData()
        {
            yield return new object[] { 1, 1, 2 };
            yield return new object[] { 14, 1, 15 };
            yield return new object[] { 12, 30, 42 };
        }
    }
}

Run Settings

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <MSTest>
    <Parallelize>
      <Workers>8</Workers>
      <Scope>MethodLevel</Scope>
    </Parallelize>
  </MSTest>
</RunSettings>

Expected behavior

according to the tutorials, total execution of each test will be around 10 seconds (all iterations in parallel)

Actual behavior

nothing runs in parallel

Environment

windows 10. NuGet Packages: MSTest.TestAdapter (v.1.2.1), MSTest.TestFramework (v1.2.1) Latest vstest.console (latest vs2017)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
sroeicommented, May 23, 2018

Sorry for taking me a while. If this is not supported, please close the issue

This is the expected I was aiming for and the initial problem was that I could not run parallel on the iteration level. Running parallel on the test level is relatively easy and I use multiple test agents to achieve that (I have like 100 + Selenium Grid).

An example of the desired expected you can see on TestNG while set it to parallel data-source.

Use Case

  1. Data-Driven Test with 250 Iterations
  2. Each Iteration Runs for ~30sec

Problem: cannot be distributed around multiple agents nor run in parallel on a single machine.

I will try to open a feature request and hopefully this will be supported in the future - the current workaround (without splitting the data-source) is very ugly

0reactions
jayaranigargcommented, Jun 27, 2018

Closing this thread and using this issue to track the feature request…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enable Parallelization for Data-Driven Tests · Issue #405
Running parallel on the test level is relatively easy and I use multiple test agents to achieve that (I have like 100 +...
Read more >
Data driven test generation - Parallelizing large data sets.
Using the code above, I can create a unique test file for each item in my data set. This unlocks the ability to...
Read more >
How to parallelize a Data-Driven unit test in Visual Studio ...
In order to parallelize this unit test, you'll need doStuffA() and doStuffB() to be able to operate on a subset of the data...
Read more >
A complete guide to parallel testing
The blog walks us through the basics of parallel testing, its benefits, implementation, challenges, and the best-in-class parallel testing ...
Read more >
TestNG Parallel Execution - How to run Selenium tests in ...
Parallel testing or parallel execution, as the name suggests, is a process of running the test case parallelly rather than one after the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found