tackle-test-generator-cli icon indicating copy to clipboard operation
tackle-test-generator-cli copied to clipboard

Provide a Maven Plugin to integrate test generation into the application project

Open rmarting opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe.

Currently generating and executing the automated test is done by the tlktest CLI, that it is basically an "external" tool from the current development tool of the project (e.g: Maven, Gradle or Ant). So as developer I have to manage two different things to cover my development life cycle, including the tests of my application.

  • test stages provided by the project's development tool
  • test stages provided by tlktest CLI

So, AS developer I WANT to use my current development tool to cover all the stages of my development life cycle SO I will be focus in one only tool and its capabilities.

Describe the solution you'd like

To have a Maven Plugin to cover the generation and execution stages of Tackle Test Generator. This maven plugin could be used in the application life cycle to add these automatic test stages under the right circunstances, for example using Maven profiles to activate these goals when they are needed.

Describe alternatives you've considered

A sample of the Maven plugin definition in my project for generate the test code could be similar to:

<plugins>
    <plugin>
	<groupId>org.konveyor</groupId>
	<artifactId>tackle-test-generator-maven-plugin</artifactId>                        
        <executions>
            <execution>
                <phase>generate-sources</phase>
                <goals>
                    <goal>generate</goal>
                </goals>
                <configuration>
                  <!-- Add generate configuration  -->
                </configuration>
            </execution>
        </executions>
    </plugin>
</plugins>

A sample of the Maven plugin definition in my project for execute the test could be similar to:

<plugins>
    <plugin>
	<groupId>org.konveyor</groupId>
	<artifactId>tackle-test-generator-maven-plugin</artifactId>                        
        <executions>
            <execution>
                <phase>test</phase>
                <goals>
                    <goal>execute</goal>
                </goals>
                <configuration>
                  <!-- Add execute configuration  -->
                </configuration>
            </execution>
        </executions>
    </plugin>
</plugins>

Additional context

As Maven plugin should have the most tipical features and characteristics of this kind of extension of Maven. Some references:

  • https://maven.apache.org/guides/plugin/guide-java-plugin-development.html
  • https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

Also a sample definition integrated with Maven Profiles could be similar to:

<profiles>
	<profile>
		<id>test-generate</id>
		<build>
			<plugins>
				<plugin>
					<groupId>org.konveyor</groupId>
					<artifactId>tackle-test-generator-maven-plugin</artifactId>                        
					<executions>
					    <execution>
						<goals>
						    <goal>generate</goal>
						</goals>
					    </execution>
					</executions>
				</plugin>
			</plugins>
		</build>
	</profile>
	<profile>
		<id>test-execute</id>	
		<build>
			<plugins>
				<plugin>
					<groupId>org.konveyor</groupId>
					<artifactId>tackle-test-generator-maven-plugin</artifactId>                        
					<executions>
					    <execution>
						<goals>
						    <goal>execute</goal>
						</goals>
					    </execution>
					</executions>
				</plugin>
			</plugins>
		</build>
	</profile>	
</profiles>

rmarting avatar Nov 26 '21 15:11 rmarting

Also it could be good to have other issue similar for Gradle, but for now, with a plugin for Maven will cover most cases.

rmarting avatar Nov 26 '21 15:11 rmarting

@rmarting EvoSuite which is used as one of the base test generators in Tackle-Test already has a maven plugin, see: https://www.evosuite.org/documentation/maven-plugin/

I don't think we can utilize it though, because we invoke EvoSuite from command line from within our Java code.

rachelt44 avatar Dec 22 '21 11:12 rachelt44

Good stuff @rachelt44 ! This is the idea of this issue, to have something similar in the tool, integrating EvoSuite and Randoop under the same cli.

The idea could not be invoke the EvoSuite maven plugin, and it should be more aligned to provide a Tackle-Test Maven Plugin to be used in my project (using the current workflow of the tackle-test cli). Does it make sense?

rmarting avatar Dec 23 '21 06:12 rmarting

@rmarting totally makes sense. I just wanted to point out the EvoSuite maven plugin as an "inspiration" to the one we can develop for tackle-test :-)

rachelt44 avatar Dec 23 '21 07:12 rachelt44