-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
We need a way to avoid putting manually generated Checkstyle reports and configs while testing recipes. Ideally we should have InputXXX and OutputXXX java files only and a simple test class for a recipe. Thus, we need to setup a pipeline for integraiton test, which will include running Checkstyle, getting violations, passing config and violations to the recipe, running the recipe and verifying the output from the recipe matches expected OuputXXX.
The concept is as follows.
- Add Checkstyle dependency with a
tests
qualifier under the test scope - Take one recipe and create InputXXX for it following Checkstyle format, which means the InputXXX starts with the check's config
- Check how
AbstractXmlTestSupport
class works. We can createAbstractRecipeTestSupport
class that will extendAbstractXmlTestSupport
and have these methods:
abstract getSubpackage(); // subpackage for input files
verify(InputXXX) { // main method that executes pipeline
// create check based on inline config in InputXXX
// register XML logger
// run the check
// take config and xml report from the check's run and initialise main CheckstyleAutoFix recipe
// preprocess InputXXX by renaming it to OutputXXX
// run CheckstyleAutoFix
// postprocess OutputXXX by removing "// violation" comments
// verify that obtained OutputXXX matches expected OutputXXX
}
- Every recipe test should extend
AbstractRecipeTestSupport
and look like this:
class UpperEllTest extends AbstractRecipeTestSupport {
String getSubpackage() { return "upperell"; }
@Test test1() { verify("UpperEllWithXXX"); }
@Test test2() { verify("UpperEllWithYYY"); }
}
- Update all current tests and remove redundant report and config files.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
In Progress