TestProject Forum

Can we generate code with TestNG as framework and Maven as build

Thank you so much for the wonderful tool.

We are trying to integrate with our existing framework[code] that is developed using TestNG- JAVA and Maven. Here, while we generate code- export happens using JUnit and Grandle which invite challenges to integrate or combine with our existing code.

is there any other alternative?

Hello @vijayanand
At the moment Test generation is only for Gradle and Junit but you can easily transform build.gradle to pom.xml using the maven plugin for gradle

Also for Junit the change to TestNG is simple ,just add the TestNG dependency in your pom.xml

<!-- https://mvnrepository.com/artifact/org.testng/testng -->

And change the annotations from JUnit to TestNG, most of the annotations between them are the same except @BeforeAll and @AfterAll which becomes @BeforeClass and @AfterClass

It is easier to do if the plan is not to integrate with existing or framework already in usage. We have 500+ test cases that cannot be recorded again in the Test Project thereby analyzing the possibility to integrate with the existing framework.

From TestNG 7.0, Junit annotations cannot be executed from TestNG. Hence changing Junit annotation is the only option available.

yes if TP gives us the option to generate the code under maven then this will overcome


Converting a project from Gradle to Maven is very easy.
Here’s a tutorial: https://www.baeldung.com/gradle-build-to-maven-pom

Changing the structure and the unit testing framework is more complicated.
We will consider allowing exporting the code as Maven and/or TestNG in the future.