How to generate single html test result in multi module gradle project? - java

I am working on a multi module java gradle project. I am trying to create a Test report with test results coming from all modules. I tried to use Test Report Aggregation Plugin but its not working. Can anyone suggest how to use it or any other way to aggregate test results across multiple subprojects.

Related

How to add #AllureId annotation to tests in source code using cli?

Our application is spring boot based project written with kotlin. There is great plugin for JetBrains IntelliJ IDEA for Allure support. The plugin provide a possibility to generate test reports, upload them to Allure TestOps and link tests from source code to test launch (tree of all tests) in Allure TestOps. Linking is achieved through adding #AllureId annotation to tests in source code.
My goal is automate this process inside build pipelines. Allure has allurectl tool which allows to upload test reports to Allure TestOps. But as far as I concerned it doesn't have a feature to assign #AllureId annotations.
Is there any option to assign #AllureId to tests from source code using command line?
You are generally right - allurectl does not have this feature. It is supported in the Allure IDEA plugin only.
The reason is that automated test-case linking feature in the plugin is implemented via the IntelliJ engine, so we'd have to write our own engine for the allurectl to make it work.
I've find out that adding a label's node with name "as_id" to generated json report works as a way to set allureId. Tested with upload to Allure TestOps, it works.
Some details are here and in related PR:https://github.com/Tinkoff/Allure.XUnit/issues/25

Is there a way to integrate Gradle / Cucumber / Selenium tests into Browserstack (Java)?

I have inherited a framework that uses Cucumber to use a series of browser-based tests with Selenium, in Java. The framework is currently built using Gradle and this works well.
I would very much like to integrate this whole thing with Browserstack, but the only Gradle plugin that I can find (here) is for Espresso, and so not applicable to my issue. I have also found another repository (here) which does exactly what I want, but does so through Maven.
Note I am unfamiliar with both Gradle and Maven and hence am inclined to stick with the solution that is currently running and wary of unnecessary change. Bearing this in mind, I have the following questions:
Is there a published way to integrate Cucumber (Java) with Browserstack using Gradle?
If not, is converting from Gradle to Maven really as trivial as this article makes me believe? Is there anything else I must be aware of?
Regarding your queries:
1- I am not aware of any published documentation to integrate Cucumber (Java) with Browserstack using Gradle
2- In the link that you have shared( https://dzone.com/articles/how-to-convert-maven-to-gradle-and-vice-versa), it says that you can convert maven to gradle in one step.
Run the command:
gradle init
In the directory containing the POM. This will convert the Maven build to a Gradle build, generating a settings.gradle file and one or more build.gradle files.
3-You have also shared the link: https://github.com/browserstack/cucumber-java-browserstack which uses maven.
You can follow the steps and easily convert maven to gradle

Pushlish TestNG results in TFS

We have created a Maven project and automated test scripts using Selenium, Java and TestNG framework.
The code is checked in tfs using TEE plugin and we are able to create maven build in tfs. Now we need to publish the results of the test scripts in TFS.
Please advise how could we publish the results in TFS and generate reports.
Generate a custom report from TestNG is pretty easy: just implements your own IReporter. See the related documentation: http://testng.org/doc/documentation-main.html#logging
Now, you have to find what is the best way for sending test reports to TFS.
It could be by generating a specific file or by using an API like https://www.visualstudio.com/en-us/docs/integrate/api/test/results#add-test-results-to-a-test-run

Java How can I use a maven sub project for my integration tests?

I would like to make a separate project for my integration tests.
My current structure is like this (Maven project):
my-project-parent
my-project-lib (jar)
my-project-web (war)
Inside the lib sub project is the logic of my project. Inside the web sub project is everything that is related to my Servlets. There is still a lot of logic in there that makes it possible to handle all the different requests.
The sub projects have unit tests. Now the unit tests and integration tests are scrambled in the project and it’s hard to see if it is a unit test or an integration test. By putting the integration tests in a separate project it also makes it possible to manage whether to run the integration tests.
Because of this I would like to create another sub project with all the integration test (my-project-it).
So far I have a separate project called “my-project-it”. I can do some test on the lib sub project. The problem I ran in to was that I needed a lot of classes from my-project-web. I’m unable/not willing to put the war as a dependency.
Can anyone help me with this?
There is an (old but) good wiki article about integration testing with maven.
I personally prefere a separate module that contains all the integration tests in src/it/java. This module can be activated with a maven build profile. The tests are run and the results verified with the failsafe plugin.
hth,
- martin
I would move all classes that are needed for my-project-it from my-project-web to my-project-jar and made it my-project-it's dependency.
Another option is instead of creating a separate my-project-it project create a separate package for integration tests under src/test/java and execute them with maven-failsafe-plugin http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html

Is it possible to use maven only for running selenium plugin?

Our pom.xml currently contains both the build settings, as well as execution of selenium using selenium-maven-plugin.
I would like to split it in to two pom files, one for the build and unit tests and the second one for executing selenium tests. (This way I could first build the project in Hudson, and after successful build execute Selenium tests using another project).
Is it possible to configure maven to only execute the selenium-maven-plugin?
The answer is yes. Put your functional (selenium) tests in a dedicated module with a dependency on the webapp.

Categories