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
https://docs.gradle.org/current/userguide/maven_plugin.html#sec:maven_pom_generation

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 -->
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.4.0</version>
    <scope>test</scope>
</dependency>

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.