Passing threadCount to surefire plugin from maven cmdline












0















I have in my pom the following settings for maven surefire plugin.
Occasionally I might want to run the tests with less threads. I was hoping for a way to set it from the mvn command line.



<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.22.0</version>
</dependency>
</dependencies>
<configuration>
<parallel>methods</parallel>
<threadCount>5</threadCount>
<includes>
<include>com.Online.runner.Regression.ONLINE_Chrome_RunnerTest</include>
</includes>
</configuration>
</plugin>


When I attempt to use the command below it doesn't appear to work.



mvn clean test -X -DthreadCount=1


Checking the values through the debugger shows that has set a system property. But it seems to get ignored.



[DEBUG] Setting system property [threadCount]=[1]
[DEBUG] parallel='methods', perCoreThreadCount=true, threadCount=5,


My tests still run in parallel. What am I doing wrong? there must be a way to override this value in the Pom?



EDIT: It seems as though it is completely ignoring the threadCount value altogether even the one set in the POM. Is this value not passed to the dependency Junit47?










share|improve this question

























  • First why have you defined a plugin dependency surefire-junit47 which is not needed...Apart from that I recommend to read the docs maven.apache.org/surefire/maven-surefire-plugin/examples/… and why do you need to change this configuration via command line?

    – khmarbaise
    Nov 23 '18 at 5:51











  • @khmarbaise Not sure why that plugin was included. But as this is a project I have inherited I didn't want to get rid of it just in case. Although if you think that might be an issue I will remove it. I am deploying the build from a cloud tool and might not always have the capacity for this number of threads. So instead of recoding the branch and pom each time, it would be easier to set it as a variable at runtime.

    – M.Waddelow
    Nov 24 '18 at 21:56











  • @khmarbaise It looks like that dependency was defined to force surefire plugin to launch with Junit instead of testng. Looks like at some point this project changed testing frameworks. Less than ideal

    – M.Waddelow
    Nov 25 '18 at 20:44
















0















I have in my pom the following settings for maven surefire plugin.
Occasionally I might want to run the tests with less threads. I was hoping for a way to set it from the mvn command line.



<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.22.0</version>
</dependency>
</dependencies>
<configuration>
<parallel>methods</parallel>
<threadCount>5</threadCount>
<includes>
<include>com.Online.runner.Regression.ONLINE_Chrome_RunnerTest</include>
</includes>
</configuration>
</plugin>


When I attempt to use the command below it doesn't appear to work.



mvn clean test -X -DthreadCount=1


Checking the values through the debugger shows that has set a system property. But it seems to get ignored.



[DEBUG] Setting system property [threadCount]=[1]
[DEBUG] parallel='methods', perCoreThreadCount=true, threadCount=5,


My tests still run in parallel. What am I doing wrong? there must be a way to override this value in the Pom?



EDIT: It seems as though it is completely ignoring the threadCount value altogether even the one set in the POM. Is this value not passed to the dependency Junit47?










share|improve this question

























  • First why have you defined a plugin dependency surefire-junit47 which is not needed...Apart from that I recommend to read the docs maven.apache.org/surefire/maven-surefire-plugin/examples/… and why do you need to change this configuration via command line?

    – khmarbaise
    Nov 23 '18 at 5:51











  • @khmarbaise Not sure why that plugin was included. But as this is a project I have inherited I didn't want to get rid of it just in case. Although if you think that might be an issue I will remove it. I am deploying the build from a cloud tool and might not always have the capacity for this number of threads. So instead of recoding the branch and pom each time, it would be easier to set it as a variable at runtime.

    – M.Waddelow
    Nov 24 '18 at 21:56











  • @khmarbaise It looks like that dependency was defined to force surefire plugin to launch with Junit instead of testng. Looks like at some point this project changed testing frameworks. Less than ideal

    – M.Waddelow
    Nov 25 '18 at 20:44














0












0








0








I have in my pom the following settings for maven surefire plugin.
Occasionally I might want to run the tests with less threads. I was hoping for a way to set it from the mvn command line.



<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.22.0</version>
</dependency>
</dependencies>
<configuration>
<parallel>methods</parallel>
<threadCount>5</threadCount>
<includes>
<include>com.Online.runner.Regression.ONLINE_Chrome_RunnerTest</include>
</includes>
</configuration>
</plugin>


When I attempt to use the command below it doesn't appear to work.



mvn clean test -X -DthreadCount=1


Checking the values through the debugger shows that has set a system property. But it seems to get ignored.



[DEBUG] Setting system property [threadCount]=[1]
[DEBUG] parallel='methods', perCoreThreadCount=true, threadCount=5,


My tests still run in parallel. What am I doing wrong? there must be a way to override this value in the Pom?



EDIT: It seems as though it is completely ignoring the threadCount value altogether even the one set in the POM. Is this value not passed to the dependency Junit47?










share|improve this question
















I have in my pom the following settings for maven surefire plugin.
Occasionally I might want to run the tests with less threads. I was hoping for a way to set it from the mvn command line.



<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.22.0</version>
</dependency>
</dependencies>
<configuration>
<parallel>methods</parallel>
<threadCount>5</threadCount>
<includes>
<include>com.Online.runner.Regression.ONLINE_Chrome_RunnerTest</include>
</includes>
</configuration>
</plugin>


When I attempt to use the command below it doesn't appear to work.



mvn clean test -X -DthreadCount=1


Checking the values through the debugger shows that has set a system property. But it seems to get ignored.



[DEBUG] Setting system property [threadCount]=[1]
[DEBUG] parallel='methods', perCoreThreadCount=true, threadCount=5,


My tests still run in parallel. What am I doing wrong? there must be a way to override this value in the Pom?



EDIT: It seems as though it is completely ignoring the threadCount value altogether even the one set in the POM. Is this value not passed to the dependency Junit47?







maven junit cucumber






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 21:15







M.Waddelow

















asked Nov 22 '18 at 21:58









M.WaddelowM.Waddelow

175




175













  • First why have you defined a plugin dependency surefire-junit47 which is not needed...Apart from that I recommend to read the docs maven.apache.org/surefire/maven-surefire-plugin/examples/… and why do you need to change this configuration via command line?

    – khmarbaise
    Nov 23 '18 at 5:51











  • @khmarbaise Not sure why that plugin was included. But as this is a project I have inherited I didn't want to get rid of it just in case. Although if you think that might be an issue I will remove it. I am deploying the build from a cloud tool and might not always have the capacity for this number of threads. So instead of recoding the branch and pom each time, it would be easier to set it as a variable at runtime.

    – M.Waddelow
    Nov 24 '18 at 21:56











  • @khmarbaise It looks like that dependency was defined to force surefire plugin to launch with Junit instead of testng. Looks like at some point this project changed testing frameworks. Less than ideal

    – M.Waddelow
    Nov 25 '18 at 20:44



















  • First why have you defined a plugin dependency surefire-junit47 which is not needed...Apart from that I recommend to read the docs maven.apache.org/surefire/maven-surefire-plugin/examples/… and why do you need to change this configuration via command line?

    – khmarbaise
    Nov 23 '18 at 5:51











  • @khmarbaise Not sure why that plugin was included. But as this is a project I have inherited I didn't want to get rid of it just in case. Although if you think that might be an issue I will remove it. I am deploying the build from a cloud tool and might not always have the capacity for this number of threads. So instead of recoding the branch and pom each time, it would be easier to set it as a variable at runtime.

    – M.Waddelow
    Nov 24 '18 at 21:56











  • @khmarbaise It looks like that dependency was defined to force surefire plugin to launch with Junit instead of testng. Looks like at some point this project changed testing frameworks. Less than ideal

    – M.Waddelow
    Nov 25 '18 at 20:44

















First why have you defined a plugin dependency surefire-junit47 which is not needed...Apart from that I recommend to read the docs maven.apache.org/surefire/maven-surefire-plugin/examples/… and why do you need to change this configuration via command line?

– khmarbaise
Nov 23 '18 at 5:51





First why have you defined a plugin dependency surefire-junit47 which is not needed...Apart from that I recommend to read the docs maven.apache.org/surefire/maven-surefire-plugin/examples/… and why do you need to change this configuration via command line?

– khmarbaise
Nov 23 '18 at 5:51













@khmarbaise Not sure why that plugin was included. But as this is a project I have inherited I didn't want to get rid of it just in case. Although if you think that might be an issue I will remove it. I am deploying the build from a cloud tool and might not always have the capacity for this number of threads. So instead of recoding the branch and pom each time, it would be easier to set it as a variable at runtime.

– M.Waddelow
Nov 24 '18 at 21:56





@khmarbaise Not sure why that plugin was included. But as this is a project I have inherited I didn't want to get rid of it just in case. Although if you think that might be an issue I will remove it. I am deploying the build from a cloud tool and might not always have the capacity for this number of threads. So instead of recoding the branch and pom each time, it would be easier to set it as a variable at runtime.

– M.Waddelow
Nov 24 '18 at 21:56













@khmarbaise It looks like that dependency was defined to force surefire plugin to launch with Junit instead of testng. Looks like at some point this project changed testing frameworks. Less than ideal

– M.Waddelow
Nov 25 '18 at 20:44





@khmarbaise It looks like that dependency was defined to force surefire plugin to launch with Junit instead of testng. Looks like at some point this project changed testing frameworks. Less than ideal

– M.Waddelow
Nov 25 '18 at 20:44












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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53438405%2fpassing-threadcount-to-surefire-plugin-from-maven-cmdline%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
















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53438405%2fpassing-threadcount-to-surefire-plugin-from-maven-cmdline%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python