Parallel Execution with maven-failsafe-plugin query

339 views
Skip to first unread message

Vikram

unread,
Sep 28, 2015, 4:44:32 AM9/28/15
to Selenium Users
Hi All,

I'm trying to achieve parallel execution with help of maven-failsafe-plugin but I'm not understanding how to control number of browsers getting launched.  

With below setup the number of browser getting launched varies each time. I have 5 java classes each one having different number of JUnit test cases


<groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-failsafe-plugin</artifactId> <!-- http://maven.apache.org/surefire/maven-failsafe-plugin/ -->

                <version>2.18.1</version>

                <configuration>

                    <includes>

                        <include>**/*Test.java</include>

                    </includes>

                   <parallel>methods</parallel>

                  <threadCountMethods>1</threadCountMethods>


I tried googling but couldn't find answer yet.

Thanks in advance.

Regards,
Vikram


niharika varshney

unread,
Sep 28, 2015, 5:00:58 AM9/28/15
to seleniu...@googlegroups.com
https://maven.apache.org/surefire/maven-failsafe-plugin/examples/junit.html#Running_tests_in_parallel also mentions specifying thread-count.  If you do not want the number of parallel tests to exceed say 5 , then set thread-count to 5.

Regards,
Niharika

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/5e8198da-ba29-4c90-bc64-4b9547372bbe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Collin

unread,
Sep 28, 2015, 5:23:12 AM9/28/15
to Selenium Users
To do it in jUnit you will need to write a custom test runner.  Using the maven-failsafe-plugin on it's own will result in lots of browsers opening but they won't be reused properly.

It's generally easier to do it in TestNG, this may help if you decide to go down that route:

Vikram

unread,
Sep 28, 2015, 9:36:34 AM9/28/15
to Selenium Users
Hi Mark,

Thanks for reply , can you please give any example with Junit and custom test runner. ( because of framework related issue I can't switch to TestNG )


@ Niharika, thanks for reply as well. But I'm facing exactly same problem which Mark has mentioned.  I'm looking for solution involving JUnit itself.
     Please let me know if you have implemented it successfully.

Best Regards,
Vikram

Vikram

unread,
Oct 2, 2015, 5:19:42 AM10/2/15
to Selenium Users
Hi Mark , Niharika,

Just to update on this thread , I could able to get parallel execution with below change in pom.xml

maven-surefire-plugin

<parallel>classes</parallel>
<threadCount>1</threadCount>

With this setup for each java file one browser will be launched.

But problem with this approach is there are test cases failures which won't happen with single m/c + single browser approach.

For now I have kept aside parallel approach and look for Grid to speed up automation execution.

Thanks,
Vikram
Reply all
Reply to author
Forward
0 new messages