Enable Parallelization for Data-Driven Tests
See original GitHub issueDescription
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:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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
Closing this thread and using this issue to track the feature request…