How to inject number of parallel threads into xunit for purpose of load balancing?
We are executing automated system tests for user interfaces for PLC controllers. These tests are written for the xUnit framework and use the Selenium API for .NET Core framework. They shall be executed through the console by a continuous integration server. Since the bottleneck in this scenario are the PLC controllers we would like to make use of xUnit's parallelization capabilities for the purpose of load balancing.
The number of PLCs is variable. Ideally we would like to assign one PLC to each test. The test framework would know how many PLCs are available and distribute them onto the available threads. This means that each xUnit test will have to execute the following steps:
- Setup phase: Allocate next free PLC (effectively this will be an IP address from a list of configured IP addresses)
- Setup phase: Open the Selenium driver, connect to PLC
- Setup phase: Download some configuration code onto the PLC
- Testing phase: Run the Selenium tests. These will test some UI functionality that talks to the PLC.
- Tear down phase: Close the connection to PLC and the selenium driver
- Tear down phase: Release the claimed IP address so the next test can use it
So effectively we need to be able to set the number of parallel executions based on the number of PLCs (IP addresses) used. We checked out the xunit docs on parallelization but the problem is that xUnit only allows setting a fixed number of threads:
[assembly: CollectionBehavior(MaxParallelThreads = 2)]
The other option is passing this value as argument to the console runner as described here but this apparently does not work in .NET Core:
packagesxunit.runner.console.2.2.0toolsxunit.console MyFirstUnitTestsbinDebugMyFirstUnitTests.dll -maxthreads 2
The third option we tried is to use the dotnet CLI but we haven't found a way to pass the parameter for parallel threads:
dotnet test ... ?
Currently we ended up having the parameter in xunit.runner.json
"maxParallelThreads": 2
But this is not flexible. So how can we make the number of parallel threads dynamic?
Or does anybody know if and how this would work in a different dotnet or testing framework?
selenium parallel-processing .net-core automated-tests xunit
add a comment |
We are executing automated system tests for user interfaces for PLC controllers. These tests are written for the xUnit framework and use the Selenium API for .NET Core framework. They shall be executed through the console by a continuous integration server. Since the bottleneck in this scenario are the PLC controllers we would like to make use of xUnit's parallelization capabilities for the purpose of load balancing.
The number of PLCs is variable. Ideally we would like to assign one PLC to each test. The test framework would know how many PLCs are available and distribute them onto the available threads. This means that each xUnit test will have to execute the following steps:
- Setup phase: Allocate next free PLC (effectively this will be an IP address from a list of configured IP addresses)
- Setup phase: Open the Selenium driver, connect to PLC
- Setup phase: Download some configuration code onto the PLC
- Testing phase: Run the Selenium tests. These will test some UI functionality that talks to the PLC.
- Tear down phase: Close the connection to PLC and the selenium driver
- Tear down phase: Release the claimed IP address so the next test can use it
So effectively we need to be able to set the number of parallel executions based on the number of PLCs (IP addresses) used. We checked out the xunit docs on parallelization but the problem is that xUnit only allows setting a fixed number of threads:
[assembly: CollectionBehavior(MaxParallelThreads = 2)]
The other option is passing this value as argument to the console runner as described here but this apparently does not work in .NET Core:
packagesxunit.runner.console.2.2.0toolsxunit.console MyFirstUnitTestsbinDebugMyFirstUnitTests.dll -maxthreads 2
The third option we tried is to use the dotnet CLI but we haven't found a way to pass the parameter for parallel threads:
dotnet test ... ?
Currently we ended up having the parameter in xunit.runner.json
"maxParallelThreads": 2
But this is not flexible. So how can we make the number of parallel threads dynamic?
Or does anybody know if and how this would work in a different dotnet or testing framework?
selenium parallel-processing .net-core automated-tests xunit
add a comment |
We are executing automated system tests for user interfaces for PLC controllers. These tests are written for the xUnit framework and use the Selenium API for .NET Core framework. They shall be executed through the console by a continuous integration server. Since the bottleneck in this scenario are the PLC controllers we would like to make use of xUnit's parallelization capabilities for the purpose of load balancing.
The number of PLCs is variable. Ideally we would like to assign one PLC to each test. The test framework would know how many PLCs are available and distribute them onto the available threads. This means that each xUnit test will have to execute the following steps:
- Setup phase: Allocate next free PLC (effectively this will be an IP address from a list of configured IP addresses)
- Setup phase: Open the Selenium driver, connect to PLC
- Setup phase: Download some configuration code onto the PLC
- Testing phase: Run the Selenium tests. These will test some UI functionality that talks to the PLC.
- Tear down phase: Close the connection to PLC and the selenium driver
- Tear down phase: Release the claimed IP address so the next test can use it
So effectively we need to be able to set the number of parallel executions based on the number of PLCs (IP addresses) used. We checked out the xunit docs on parallelization but the problem is that xUnit only allows setting a fixed number of threads:
[assembly: CollectionBehavior(MaxParallelThreads = 2)]
The other option is passing this value as argument to the console runner as described here but this apparently does not work in .NET Core:
packagesxunit.runner.console.2.2.0toolsxunit.console MyFirstUnitTestsbinDebugMyFirstUnitTests.dll -maxthreads 2
The third option we tried is to use the dotnet CLI but we haven't found a way to pass the parameter for parallel threads:
dotnet test ... ?
Currently we ended up having the parameter in xunit.runner.json
"maxParallelThreads": 2
But this is not flexible. So how can we make the number of parallel threads dynamic?
Or does anybody know if and how this would work in a different dotnet or testing framework?
selenium parallel-processing .net-core automated-tests xunit
We are executing automated system tests for user interfaces for PLC controllers. These tests are written for the xUnit framework and use the Selenium API for .NET Core framework. They shall be executed through the console by a continuous integration server. Since the bottleneck in this scenario are the PLC controllers we would like to make use of xUnit's parallelization capabilities for the purpose of load balancing.
The number of PLCs is variable. Ideally we would like to assign one PLC to each test. The test framework would know how many PLCs are available and distribute them onto the available threads. This means that each xUnit test will have to execute the following steps:
- Setup phase: Allocate next free PLC (effectively this will be an IP address from a list of configured IP addresses)
- Setup phase: Open the Selenium driver, connect to PLC
- Setup phase: Download some configuration code onto the PLC
- Testing phase: Run the Selenium tests. These will test some UI functionality that talks to the PLC.
- Tear down phase: Close the connection to PLC and the selenium driver
- Tear down phase: Release the claimed IP address so the next test can use it
So effectively we need to be able to set the number of parallel executions based on the number of PLCs (IP addresses) used. We checked out the xunit docs on parallelization but the problem is that xUnit only allows setting a fixed number of threads:
[assembly: CollectionBehavior(MaxParallelThreads = 2)]
The other option is passing this value as argument to the console runner as described here but this apparently does not work in .NET Core:
packagesxunit.runner.console.2.2.0toolsxunit.console MyFirstUnitTestsbinDebugMyFirstUnitTests.dll -maxthreads 2
The third option we tried is to use the dotnet CLI but we haven't found a way to pass the parameter for parallel threads:
dotnet test ... ?
Currently we ended up having the parameter in xunit.runner.json
"maxParallelThreads": 2
But this is not flexible. So how can we make the number of parallel threads dynamic?
Or does anybody know if and how this would work in a different dotnet or testing framework?
selenium parallel-processing .net-core automated-tests xunit
selenium parallel-processing .net-core automated-tests xunit
asked Nov 14 '18 at 10:36
FarwoodHillFarwoodHill
1429
1429
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53298180%2fhow-to-inject-number-of-parallel-threads-into-xunit-for-purpose-of-load-balancin%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53298180%2fhow-to-inject-number-of-parallel-threads-into-xunit-for-purpose-of-load-balancin%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown