To compile smartest, you need a Java Development Kit (JDK), Maven and clone the repository:
cd smartest
mvn clean package
cd target
java -jar smartest.jar
flag | Description |
---|---|
-h, --help | Show this help message and exit. |
-v, --version | Print version information and exit. |
--config-path= | Set path to config.smt file |
option | Description |
---|---|
list-tests | List the tests that cover the changes between commits. |
test | Run tests on the selected scope. |
commit | Run tests then record changes to the repository. |
Usage: smartest list-tests [-s=<scope>]
List the tests that cover the changes between commits.
flag | Description |
---|---|
-s, --scope |
Give the scope of the analysis (class, method, method and dependencies...), therefore only the test of this scope will be listed |
Usage: smartest test [-s=<scope>]
Run tests on the selected scope.
flag | Description |
---|---|
-s, --scope |
Give the scope of the analysis (class, method, method and dependencies...), therefore only the test of this scope will be executed |
Usage: smartest commit -m=<message> [-s=<scope>]
Run tests and then commit changes to the repository.
flag | Description |
---|---|
-m, --message=<message> |
Use the given <msg> as the commit message |
-s, --scope=<scope> |
Give the scope of the analysis (class, method, method and dependencies...), therefore only the test of this scope will be executed |
Smartest supports plugins for the language parsing (Java, Python), the production tool (Maven, Gradle), the test framework (Junit, Pytest) and the vcs (git, svn).
We provide an implement for Java as a language, Maven as a production tool, Junit5 as a test framework and git as a vcs.
If you want to create your own plugin, you have to implement one of the following interfaces and put the jar of your plugin in the plugins directory. The path to the plugins directory can be changed in the config.smt
of your project.
To create your own plugin, firstly, add the Maven dependency to the plugin project
<dependency>
<groupId>fr.smartest</groupId>
<artifactId>plugin</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
public interface Plugin {
boolean accept(String identifier);
}
The accept
method has to return true if the identifier given correspond to your plugin. For example, a Java plugin should return true
if the identifier is java
and false otherwise.
interface Language extends Plugin {
void setUp(List<Module> modules);
Set<Test> getTestsRelatedToChanges(String scope, Set<Diff> diff);
void save();
}
public interface ProductionTool extends Plugin{
void setUp(String path);
List<Module> getModules();
void compile() throws ProductionToolException;
}
public interface TestFramework extends Plugin {
void setUp(String path, List<Module> modules);
Set<TestReport> run(Set<Test> tests) throws TestFrameworkException;
}
public interface VCS extends Plugin {
void setUp(String VCSpath);
void commit(String message) throws VCSException;
Set<Diff> diff() throws VCSException;
void checkout(String version);
void update();
}
Compile and package your plugin to a jar and then put it in the plugin directory of your project.
Put the corresponding identifier of your plugin in the config.smt
of your project.
You are ready to go !