@@ -31,25 +31,37 @@ Example for a single test case:
31
31
32
32
` WireMockStatusReporterTest: GitHub proxying and user auth correctly configured for user login: <your login> `
33
33
34
- Whenever you run tests with ` -Dtest.github.useProxy ` , they will try to get data from local files but will fallback to proxying to github if not found.
35
-
34
+ Whenever you run tests with ` -Dtest.github.useProxy ` , they will try to get data from local files but will fallback to proxying to GitHub if not found.
36
35
37
36
### Writing a new test
38
37
39
38
Once you have credentials setup, you add new test classes and test methods as you would normally.
40
39
41
- Keep ` useProxy ` enabled and iterate on your tests as needed. Remember, while proxying your tests are interacting with GitHub - you will need
42
- to clean up your state between runs. The following additional system property to enable testing using your personal github account.
40
+ #### Running tests using GitHub test proxy
41
+
42
+ Keep ` useProxy ` enabled and iterate on your tests as needed. With ` useProxy ` enabled your tests will interact with
43
+ GitHub - you will need to clean up your server-state between runs. This can be done manually to start with.
44
+ Once your test code is somewhat stable, use ` getGitHubBeforeAfter() ` to get a ` GitHub ` instance for test setup and cleanup.
45
+ Interactions with that ` GitHub ` instance will not be recorded as part of the test, keeping the test data files to a minimum.
46
+
47
+ #### Running tests against your personal GitHub user account
48
+
49
+ By default, test helper methods such as ` getTempRepository() ` target the ` hub4j-test-org ` GitHub organization.
50
+ Please request access to this org to record your tests before submitting a PR. This helps keep the project stable and nimble.
51
+ Until you have access (or if you don't want access), you can set the following additional system property to target
52
+ your personal github account.
43
53
44
54
`mvn install -Dtest.github.org=false -Dtest=YourTestClassName`
45
55
56
+ #### Taking a snapshot
57
+
46
58
When you are ready to create a snapshot of your test data, run your test with ` test.github.takeSnapshot ` ("-Dtest.github.takeSnapshot" as
47
59
a Java VM option). For example:
48
60
49
61
`mvn install -Dtest.github.takeSnapshot -Dtest.github.org=false -Dtest=YourTestClassName`
50
62
51
- The above command would create snapshot WireMock data files under the path ` src/test/resources/org/kohsuhke/github/YourTestClassName/wiremock ` .
52
- Each method would get a separate director that would hold the data files for that test method.
63
+ The above command will create snapshot WireMock data files under the path ` src/test/resources/org/kohsuhke/github/YourTestClassName/wiremock ` .
64
+ Each method will get a separate directory that will hold the data files for that test method.
53
65
54
66
Add all files including the generated data to your commit and submit a PR.
55
67
0 commit comments