How can I run a generated package of cucumber testNG runner classes on forked JVM processes?

21 views
Skip to first unread message

jackof...@gmail.com

unread,
Mar 17, 2018, 2:13:53 PM3/17/18
to testng-users
I have generated a number of testNG runner classes, approximately ~10.  I need to run those 10 runners on 5 forked JVM processes.  I have tried all sorts of combinations within surefire, my latest is like this:

              <forkCount>5</forkCount>
                <reuseForks>false</reuseForks>
                <testFailureIgnore>true</testFailureIgnore>
                <printSummary>false</printSummary>
                <suiteXmlFiles>
                    <suiteXmlFile>src/test/java/company/product/gui/testrunner/ExecuteRunners.xml</suiteXmlFile>
                </suiteXmlFiles>

My suite XML is like so:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

    <suite name="All Runners" verbose="1" parallel="true">
        <listeners>
            <listener class-name="product.company.gui.listeners.TestExecutionListener"/>
        </listeners>
        <test name="Generated">
            <packages>
                <package name="company.test.runners"/>
            </packages>
        </test>
    </suite>

All of my generated test runners, reside under the package:
```company.test.runners```

How do I make my mvn execution spin up 5 JVMs and run these tests in parallel? Everything I tried ends up with the following:

 - 1 JVM launched and every test run sequentially
 - 5 JVMs launched but only 1 actively running tests, 4 idle

I have toyed around with `<threadCount>`, `<parallel>` etc.  Can I achieve this?  I am generating my runners using a plugin and using a suite.xml file to run them so that I can use listeners prior to running cucumber tests.

Krishnan Mahadevan

unread,
Mar 17, 2018, 10:52:36 PM3/17/18
to testng...@googlegroups.com

You havent showed us how your generated TestNG classes look like.

To start with, try changing the value of “parallel” attribute in your suite file to “classes” or “methods” and see if that helps.

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/


Reply-To: <testng...@googlegroups.com>
Date: Saturday, March 17, 2018 at 11:43 PM
To: testng-users <testng...@googlegroups.com>
Subject: [testng-users] How can I run a generated package of cucumber testNG runner classes on forked JVM processes?

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
testng-users...@googlegroups.com.
To post to this group, send email to
testng...@googlegroups.com.
Visit this group at
https://groups.google.com/group/testng-users.
For more options, visit
https://groups.google.com/d/optout.

jackof...@gmail.com

unread,
Mar 18, 2018, 3:59:43 AM3/18/18
to testng-users
thank you for the response Krishnan, here is an example of one runner file that is generated (1 per each cucumber feature):

package cucumber.testng.generated;

import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;

@CucumberOptions(
        strict = true,
        features = {"C:/Users/Simon/Desktop/Automation-Framework-Java-CucumberJVM/src/test/resources/features/PuppyAdoption.feature"},
        plugin = {"json:C:/Users/Simon/Desktop/Automation-Framework-Java-CucumberJVM/target/cucumber-parallel/3.json"},
        monochrome = true,
        tags = {},
        glue = {"com.simonkay.javaframework.configurations.webdriver", "com.simonkay.javaframework.stepdefinitions"})
public class Puppyadoption03Test extends AbstractTestNGCucumberTests {
}

jackof...@gmail.com

unread,
Mar 18, 2018, 4:10:02 AM3/18/18
to testng-users
Also please ignore the inconsistencies shown within the pom / generated file, the generated file is masking some sensitive info, but you should get the idea.  I'm not sure how to achieve forked tests in parallel when the runners look like the above, each feature file in cucumber creates 1 runner class for itself.

Krishnan Mahadevan

unread,
Mar 18, 2018, 11:22:08 PM3/18/18
to testng...@googlegroups.com

Yes, I understand every TestNG class basically iterates through all scenarios in the scenario (I guess it internally resorts to a data driven fashion to iterate scenarios).

 

Please try with one of the below values for the “parallel” attribute in your “<suite>” tag or the “<test>” tag.

  • methods
  • classes

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/


Reply-To: <testng...@googlegroups.com>
Date: Sunday, March 18, 2018 at 1:40 PM
To: testng-users <testng...@googlegroups.com>
Subject: [testng-users] Re: How can I run a generated package of cucumber testNG runner classes on forked JVM processes?

--

You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to


To post to this group, send email to

jackof...@gmail.com

unread,
Mar 19, 2018, 4:32:59 AM3/19/18
to testng-users
Thanks, but using parallel methods/classes in the suite.xml just launches 5x browsers and 4 of them are idle, where the 5th runs every test from 1 feature

⇜Krishnan Mahadevan⇝

unread,
Mar 19, 2018, 4:36:01 AM3/19/18
to testng...@googlegroups.com
Can you please create a simple reproducible test that can be executed to reproduce the issue, post it on GitHub or gist.github.com and share the link ?

That would be of better help in suggesting an alternative. 

On Mon, Mar 19, 2018, 14:03 <jackof...@gmail.com> wrote:
Thanks, but using parallel methods/classes in the suite.xml just launches 5x browsers and 4 of them are idle, where the 5th runs every test from 1 feature

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
Reply all
Reply to author
Forward
0 new messages