jenkinsci / jenkinsci/google-compute-engine-plugin
Integration Tests - Use @Rule instead of @ClassRule for JenkinsRule unless required
- Dominant language
- Java
- Stars
- 58
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
General best practice around using `@Rule` vs `@ClassRule` for `JenkinsRule` is
* if the jenkins configuration is being modified between different tests; then it is preferred to use the `@Rule`
* if it was simply requiring jenkins without doing jenkins modification itself, then use `@ClassRule`.
In that sense, currently majority of the integration tests are all modifying the `JenkinsRule` (in the `init` method), as well as various small assertions being put in different test methods.
This is actually causing issues,
* for extending the tests
* and other configurations around tests such as using `@WithTimeout` (currently being compensated by putting `timeout` configs in pom.xml file)
It is better to simplify the integration tests such that it is easier to follow.
Also see https://github.com/jenkinsci/google-compute-engine-plugin/pull/495#discussion_r1895785032
Contributor guide
Assessment
This issue has not been assessed yet.