konveyor / tackle-test-generator-cli

Apache License 2.0
58 stars 34 forks source link

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

Open rmarting opened 2 years ago

rmarting commented 2 years ago

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.

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:

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 commented 2 years ago

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

rachelt44 commented 2 years ago

@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.

rmarting commented 2 years ago

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?

rachelt44 commented 2 years ago

@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 :-)