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

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

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

jackofspaces
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Krishnan Mahadevan

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: <[hidden email]>
Date: Saturday, March 17, 2018 at 11:43 PM
To: testng-users <[hidden email]>
Subject: [testng-users] How can I run a generated package of cucumber testNG runner classes on forked JVM processes?

 

 

              <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.

--
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
[hidden email].
To post to this group, send email to
[hidden email].
Visit this group at
https://groups.google.com/group/testng-users.
For more options, visit
https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

jackofspaces
In reply to this post by jackofspaces
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 {
}




On Saturday, March 17, 2018 at 6:13:53 PM UTC, [hidden email] wrote:
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 "<a href="http://testng.org/testng-1.0.dtd" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;">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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

jackofspaces
In reply to this post by jackofspaces
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Krishnan Mahadevan

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: <[hidden email]>
Date: Sunday, March 18, 2018 at 1:40 PM
To: testng-users <[hidden email]>
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
[hidden email].
To post to this group, send email to
[hidden email].
Visit this group at
https://groups.google.com/group/testng-users.
For more options, visit
https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

jackofspaces
In reply to this post by jackofspaces
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Krishnan Mahadevan
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 <[hidden email]> 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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--

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/

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.