This addon provides standalone functionality, and exports services for use in other addons.
You can use it for setting up a test framework in a project.
Addon | Exported | Optional |
---|---|---|
dependencies |
yes |
no |
ui |
yes |
no |
projects |
yes |
no |
org.jboss.forge.furnace.container:simple |
no |
no |
To use this addon, you must add it as a dependency in the pom.xml of your forge-addon
classified artifact:
<dependency>
<groupId>org.jboss.forge.addon</groupId>
<artifactId>testing</artifactId>
<classifier>forge-addon</classifier>
<version>${version}</version>
</dependency>
All the features exported by the testing addon are in the TestingFacet
interface.
The addon provides implementation of this interface for the supported test frameworks.
At the moment these are JUnit and TestNG.
In order to obtain a reference to the respective framework facet, you need to install it using the FacetFactory
.
For example here is how you would do it for JUnit:
@Inject
private FacetFactory facetFactory;
...
facetFactory.install(project,JUnitTestingFacet.class);
- Installing testing framework
-
Allows for adding the necessary dependencies to your project descriptor
@Inject
private FacetFactory facetFactory;
public void installJUnit(String junitVersion) {
JUnitTestingFacet jUnitTestingFacet = facetFactory.create(project,JUnitTestingFacet.class)
jUnitTestingFacet.setFrameworkVersion(junitVersion);
facetFactory.install(project, jUnitTestingFacet);
}