Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain how to adjust the home directory #7759

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion content/doc/developer/testing/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,19 @@ report.copyFrom(getClass().getResourceAsStream("lint-results_r20.xml"));
----

==== Customizing the `JENKINS_HOME` Directory
TODO: Write this section.

If you want to adjust the `JENKINS_HOME` within a test, you can make use of the `JenkinsRule`-methods `withExistingHome()` or `withNewHome()`.
StefanSpieker marked this conversation as resolved.
Show resolved Hide resolved
Let's assume in the directory "src/test/resources/home" everything is prepared for a good test suite, and you want to use that.
StefanSpieker marked this conversation as resolved.
Show resolved Hide resolved
This can be achieved with the following example:

[source,java]
----

@Rule
public JenkinsRule j = new JenkinsRule().withExistingHome(new File("src/test/resources/home"));
----

If you need a fresh `JENKINS_HOME` you can use `withNewHome()` which creates a fresh home, what the default of the `JenkinsRule()` at the beginning is.
StefanSpieker marked this conversation as resolved.
Show resolved Hide resolved

==== Using `@LocalData`
Runs a test case with a data set local to test method or the test class. This recipe allows your test case to start with the preset `JENKINS_HOME` data loaded either from your test method or from the test class.
Expand Down
Loading