-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from spookyvale/master
New version with visual reports
- Loading branch information
Showing
49 changed files
with
1,863 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
buildPlugin(jenkinsVersions: [null, '2.60.1']) | ||
buildPlugin(jenkinsVersions: [null, '2.150.1']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,100 @@ | ||
# STAMP DSpot Jenkins plugin | ||
[![Build Status](https://travis-ci.org/STAMP-project/dspot-jenkins-plugin.svg?branch=master)](https://travis-ci.org/STAMP-project/dspot-jenkins-plugin) | ||
|
||
The plugin is meant to run DSpot as a build step within Jenkins. | ||
Both freestyle jobs and pipelines are supported. | ||
|
||
Developed in the context of [STAMP project](https://stamp.ow2.org/) | ||
|
||
## Latest release | ||
v.1.0.1-SNAPSHOT (DSpot 1.2.2-SNAPSHOT) | ||
|
||
## Install | ||
* Install the plugin in Jenkins (for details on how to install a plugin see [here](https://jenkins.io/doc/book/managing/plugins/)). | ||
|
||
* You can download the released hpi file or build from source with | ||
|
||
``` | ||
mvn package | ||
``` | ||
|
||
## Configure | ||
|
||
### Freestyle job | ||
* Create a freestyle job that complies your tests | ||
* Add a build action to run Dspot | ||
|
||
### Pipeline | ||
add the dspot step in the build stage: | ||
`dspot variable1: value1, ..., variable1: valueN` | ||
see the table below for the variable list. | ||
All variables are optional and default to the values in the table | ||
|
||
## Options | ||
|
||
| Option | pipeline variable | Usage | Default | | ||
| -------- | ------ | --------------------------------------------------- | ------- | | ||
| `Project Location` | `projectPath` | path to the target project root from the folder where dspot is executed. | Defaults to Workspace | | ||
| `Source location` | `srcCode` | path to the source code folder | `src/main/java/` | | ||
| `Tests location` | `testCode` | path to the test source folder | `src/test/java/` | | ||
| `Source binary location` | `srcClasses` | path to the compiled code folder. (.class files) | `target/classes/` | | ||
| `Tests binary location` | `testClasses` | path to the compiled tests folder. (.class files) | `target/test-classes/` | | ||
| `Filter` | `testFilter` | filter on the package name containing tests to be amplified | all tests | | ||
| `Output directory` | `outputDir` | path to the output folder | `dspot-out` | | ||
| `Run on changes` | `onlyChanges` | Runs only on new or changed tests since the last build | `false` | | ||
|
||
For detailed information on the options have a look at [DSpot documentation](https://github.com/STAMP-project/dspot). | ||
|
||
## Use | ||
Build your project. | ||
DSpot will be run on the selected tests and the reports / amplified tests will be stored in the specified folder in your workspace. | ||
|
||
_Initial development by Engineering_ | ||
# STAMP DSpot Jenkins plugin | ||
[![Build Status](https://travis-ci.org/STAMP-project/dspot-jenkins-plugin.svg?branch=master)](https://travis-ci.org/STAMP-project/dspot-jenkins-plugin) | ||
|
||
The plugin is meant to run DSpot as a build step within Jenkins and visualize reports in the Jenkins UI. | ||
Both freestyle jobs and pipelines are supported. | ||
|
||
Developed in the context of [STAMP project](https://stamp.ow2.org/) | ||
|
||
## Latest release | ||
v.1.0.1-SNAPSHOT (DSpot 1.2.2-SNAPSHOT) | ||
|
||
## Install | ||
* Install the plugin in Jenkins (for details on how to install a plugin see [here](https://jenkins.io/doc/book/managing/plugins/)). | ||
|
||
* You can download the released hpi file or build from source with | ||
|
||
``` | ||
mvn package | ||
``` | ||
|
||
## Configure | ||
|
||
### Freestyle job | ||
* Create a freestyle job that complies your tests | ||
* Add a build action to run Dspot | ||
|
||
### Pipeline | ||
add the `dspot` step in the build stage: | ||
`dspot variable1: value1, ..., variable1: valueN` | ||
see the table below for the variable list. | ||
All variables are optional and default to the values in the table | ||
|
||
|
||
### Reports Only | ||
You can use the plugin only to visualize reports of DSpot in the Jenkins UI if DSpot was used as a Maven Plugin or by any other mean. | ||
For this you can add the Post-build action `STAMP DSpot Reports` in freestyle jobs or the step with symbol `dspot-report`. | ||
Note that the step must be in the same node where DSpot run. | ||
|
||
|
||
## Options | ||
|
||
### Plugin Options | ||
| Option | pipeline variable | Usage | Default | | ||
| -------- | ------ | --------------------------------------------------- | ------- | | ||
| `Run on changes` | `onlyChanges` | Runs only on new or changed tests since the last build | `false` | | ||
| `Show reports` | `showReports` | shows the DSpot reports in a visual format in the Jenkins UI | `false` | | ||
|
||
### Base DSPot Options | ||
| Option | pipeline variable | Usage | Default | | ||
| -------- | ------ | --------------------------------------------------- | ------- | | ||
| `Project Location` | `projectPath` | path to the target project root from the folder where dspot is executed. | Defaults to Workspace | | ||
| `Source location` | `srcCode` | path to the source code folder | `src/main/java/` | | ||
| `Tests location` | `testCode` | path to the test source folder | `src/test/java/` | | ||
| `Source binary location` | `srcClasses` | path to the compiled code folder. (.class files) | `target/classes/` | | ||
| `Tests binary location` | `testClasses` | path to the compiled tests folder. (.class files) | `target/test-classes/` | | ||
| `Filter` | `testFilter` | filter on the package name containing tests to be amplified | all tests | | ||
| `Output directory` | `outputDir` | path to the output folder | `dspot-out` | | ||
|
||
|
||
### Advanced Options | ||
| Option | pipeline variable | Usage | Default | | ||
| -------- | ------ | --------------------------------------------------- | ------- | | ||
| `Amplifiers` | `lAmplifiers` | List of amplifiers to use | NONE | | ||
| `Selector` | `selector` | specify the test adequacy criterion to be maximized | `PitMutantScoreSelector` | | ||
| `Budgetizer` | `budgetizer` | specify a Bugdetizer | `NoBudgetizer` | | ||
| `Number of Iterations` | `numIterations` | the number of amplification iterations | 3 | | ||
| `Second Version path` | `secondFolder` | Path to the root of the second version of the project. Must be specified when using `ChangeDetectorSelector` | EMPTY | | ||
|
||
|
||
For detailed information on the options have a look at [DSpot documentation](https://github.com/STAMP-project/dspot). | ||
|
||
### Report Options | ||
|
||
| Option | pipeline variable | Usage | Default | | ||
| -------- | ------ | --------------------------------------------------- | ------- | | ||
| `Output directory` | `outputDir` | path to the output folder of Dspot results (relative to the workspace folder) | `dspot-out` | | ||
|
||
(these options will be ignored when the `showReports` option is enabled in the Dspot build step) | ||
|
||
## Use | ||
Build your project. | ||
DSpot will be run on the selected tests and the reports / amplified tests will be stored in the specified folder in your workspace. | ||
|
||
## Graphical Reports | ||
A build dashboard is created to display STAMP DSpot reports. | ||
From the dashboard the user can directly access the content of the output forlder of DSpot. | ||
|
||
### Build views | ||
|
||
For each build, a menu item is created to show the detailed Report of the DSpot run. | ||
|
||
![Build dashboard](docs/img/build.PNG?raw=true "DSpot dashboard") | ||
|
||
If test cases are successfully amplified, the user can navigate the details of the test class, getting more information on the amplified test cases. | ||
Reports adapt based on the Selector used. | ||
|
||
![PIT selector](docs/img/mutant.PNG?raw=true "PIT Mutant selector view") | ||
|
||
|
||
_Initial development by Engineering in the context of STAMP H2020 project_ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
src/main/java/eu/stamp_project/dspot/jenkins/DSpotReportCollector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package eu.stamp_project.dspot.jenkins; | ||
|
||
import java.io.IOException; | ||
import java.io.PrintStream; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import org.jenkinsci.Symbol; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
import org.kohsuke.stapler.DataBoundSetter; | ||
|
||
import eu.stamp_project.dspot.jenkins.report.DSpotResults; | ||
import hudson.Extension; | ||
import hudson.FilePath; | ||
import hudson.Launcher; | ||
import hudson.model.AbstractProject; | ||
import hudson.model.Run; | ||
import hudson.model.TaskListener; | ||
import hudson.tasks.BuildStepDescriptor; | ||
import hudson.tasks.BuildStepMonitor; | ||
import hudson.tasks.Notifier; | ||
import hudson.tasks.Publisher; | ||
import jenkins.tasks.SimpleBuildStep; | ||
|
||
/** | ||
* @author VDIGIACO | ||
* | ||
*/ | ||
@SuppressWarnings("rawtypes") | ||
public class DSpotReportCollector extends Notifier implements SimpleBuildStep { | ||
|
||
@Nonnull | ||
private String outputDir = STAMPDescriptor.defaultOutputDir; | ||
|
||
@DataBoundConstructor | ||
public DSpotReportCollector() { | ||
|
||
} | ||
|
||
public String getOutputDir() { | ||
return outputDir; | ||
} | ||
|
||
@DataBoundSetter | ||
public void setOutputDir(@Nonnull String outputDir) { | ||
this.outputDir = outputDir; | ||
} | ||
|
||
/* | ||
* (non-Javadoc) | ||
* | ||
* @see hudson.tasks.BuildStep#getRequiredMonitorService() | ||
*/ | ||
@Override | ||
public BuildStepMonitor getRequiredMonitorService() { | ||
return BuildStepMonitor.NONE; | ||
} | ||
|
||
@Override | ||
public void perform(Run<?, ?> run, FilePath wsp, Launcher arg2, TaskListener listener) | ||
throws InterruptedException, IOException { | ||
|
||
PrintStream logger = listener.getLogger(); | ||
if(run.getAction(DSpotResultsAction.class) == null){ | ||
logger.print("DSpot report already configured from Buld step. skipping post build step config."); | ||
return; | ||
} | ||
DSpotResults results = new DSpotResults(new FilePath(wsp, outputDir)); | ||
|
||
if (results.getProjectTime() == null) { | ||
logger.print("Build WARNING. STAMP Report file was not found or it is not well-formed."); | ||
return; | ||
} | ||
|
||
DSpotResultsAction action = new DSpotResultsAction(run, results); | ||
run.addAction(action); | ||
return; | ||
} | ||
|
||
@Override | ||
public boolean needsToRunAfterFinalized() { | ||
return true; | ||
} | ||
|
||
@Symbol("dspot-report") | ||
@Extension | ||
public static class STAMPDescriptor extends BuildStepDescriptor<Publisher> { | ||
|
||
public static final String defaultOutputDir = "dspot-out"; | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "STAMP DSpot Reports"; | ||
} | ||
|
||
@Override | ||
public boolean isApplicable(Class<? extends AbstractProject> jobType) { | ||
return true; | ||
} | ||
} | ||
} |
Oops, something went wrong.