What problem are you trying to solve?
Some plugins have many functional test assertions using an overly verbose idiom for triggering a build of a test project, waiting for the build to complete, and then checking the result of the build. There are simpler idioms available in the JenkinsRule test utility, and we can also apply centralized improvements to make this workflow more reliable (removing nondeterministic aspects).
What precondition(s) should be checked before applying this recipe?
Any Jenkins plugins using JenkinsRule (a default test dependency), whether explicitly as a @Rule, or as a parameter passed into a method when the @Rule is actually something else (RestartableJenkinsRule, JenkinsSessionRule, RealJenkinsRule).
Describe the situation before applying the recipe
Some idiom variants:
rule.assertBuildStatusSuccess(project1.scheduleBuild2(0).get());
FreeStyleBuild build2 = project2.scheduleBuild2(0, new Cause.UserIdCause()).get();
rule.assertBuildStatus(Result.FAILURE, build2);
Describe the situation after applying the recipe
The corresponding simpler versions:
rule.buildAndAssertSuccess(project1);
FreeStyleBuild build2 = rule.buildAndAssertStatus(Result.FAILURE, project2);
Have you considered any alternatives or workarounds?
Regexp search and replace?!
Any additional context
N/A
TBD
What problem are you trying to solve?
Some plugins have many functional test assertions using an overly verbose idiom for triggering a build of a test project, waiting for the build to complete, and then checking the result of the build. There are simpler idioms available in the
JenkinsRuletest utility, and we can also apply centralized improvements to make this workflow more reliable (removing nondeterministic aspects).What precondition(s) should be checked before applying this recipe?
Any Jenkins plugins using
JenkinsRule(a default test dependency), whether explicitly as a@Rule, or as a parameter passed into a method when the@Ruleis actually something else (RestartableJenkinsRule,JenkinsSessionRule,RealJenkinsRule).Describe the situation before applying the recipe
Some idiom variants:
Describe the situation after applying the recipe
The corresponding simpler versions:
Have you considered any alternatives or workarounds?
Regexp search and replace?!
Any additional context
N/A
Are you interested in contributing this recipe to OpenRewrite?
TBD