trivago/cucable-plugin

Ref: Execution

Closed this issue · 9 comments

Here s the Setup in POM File:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skipTests>false</skipTests>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.trivago.rta</groupId>
                <artifactId>cucable-plugin</artifactId>
                <version>1.5.1</version>
                <executions>
                    <execution>
                        <id>generate-test-resources</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>parallel</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourceRunnerTemplateFile>src/test/resources/features/cucable.template
                    </sourceRunnerTemplateFile>
                    <sourceFeatures>src/test/resources/features/</sourceFeatures>
                    <generatedFeatureDirectory>${generated.feature.directory}</generatedFeatureDirectory>
                    <generatedRunnerDirectory>${generated.runner.directory}</generatedRunnerDirectory>
                 <parallelizationMode>features</parallelizationMode>
                    <logLevel>default</logLevel>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>${maven.build.helper.plugin.version}</version>
                <executions>
                    <execution>
                        <id>add-test-source</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${generated.runner.directory}</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${maven.failsafe.plugin.version}</version>
                <executions>
                    <execution>
                        <id>Run parallel tests</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                    <forkCount>2</forkCount>
                    <reuseForks>false</reuseForks>
                    <argLine>-Dfile.encoding=UTF-8</argLine>
                    <disableXmlReport>true</disableXmlReport><summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary.xml</summaryFile>
                    <testSourceDirectory>${generated.runner.directory}</testSourceDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.trivago.rta</groupId>
                <artifactId>cluecumber-report-plugin</artifactId>
                <version>${cluecumber.report.version}</version>
                <executions>
                    <execution>
                        <id>report</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>reporting</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <customPageTitle>My Report Parallel</customPageTitle>
                    <customStatusColorPassed>#00ff00</customStatusColorPassed>
                    <customStatusColorFailed>#ff0000</customStatusColorFailed>
                    <customStatusColorSkipped>#00ffff</customStatusColorSkipped>
                    <failScenariosOnPendingOrUndefinedSteps>true</failScenariosOnPendingOrUndefinedSteps>
                    <customParameters>
                        <Custom_Parameter>ParallelTestReport</Custom_Parameter>
                        <Custom_URL>https://cde-carrierportal.werner.com/carrierportal/</Custom_URL>
                        <_Text>AUTOMATION TEST</_Text>
                        <expandBeforeAfterHooks>true</expandBeforeAfterHooks>
                    </customParameters>
                    <sourceJsonReportDirectory>${project.build.directory}/cucumber-report</sourceJsonReportDirectory>
                    <generatedHtmlReportDirectory>${project.build.directory}/test-report</generatedHtmlReportDirectory>
                </configuration>
            </plugin>
        </plugins>

The above setup is helpful in generating runners and features in target with the command line:
mvn clean integration-test
or MVN clean verify

But doesnt start the test; I mean the actual parallel testing. Please suggest or correct me; Your feedback is highly appreciated.

Also tried command: mvn clean install org.apache.maven.plugins:maven-failsafe-plugin:integration-tes
t

Hello there!
What error message do you get?
Does the example project work for you?
It is always a good idea to take this and build on top of this.

Does the test project run the tests when you invoke it with mvn clean verify? Because this is the way it should be run.

If you don't get this output from the test project then something is wrong with how you run it, I believe. This is what it should look like:

image

You can just download it from github with the download button:
image

The direct download link is: https://github.com/trivago/cucable-plugin/archive/master.zip

It is included in the source code under example-project

Thank you for the below eample; I was able get parallel runners and features generated in target; But Webdriver wont start the test using them as input; I would highly appreciate your help if yo u a design or framework where you were able to pass driver to create multiple instances

Hi, as Cucable runs before your test framework, this is outside the scope of this plugin. Unfortunatelly I cannot help you with a framework since we use a completely custom one that I can't share.
All I can say is that we are running the tests via Failsafe's multiple forks which is essentially spinning up multiple test frameworks in parallel. This way we don't have to worry about one framework instance juggling with multiple webdrivers.