Skip to content

Commit fe62ced

Browse files
authored
Update README.md
1 parent bab4e53 commit fe62ced

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

system-stubs-testng/README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ public void afterTest() throws Exception {
3434
```
3535

3636
With this code, we'd expect tests to be able to modify the runtime environment by manipulating the
37-
`environmentVariables` object, and we'd expect the tests to have an environment variable `setinbefore` set
38-
to `yes`.
37+
`environmentVariables` object, and we'd expect the tests to see the environment variables set in the `beforeTest`
38+
function; in this example, `setinbefore` was set to `yes`.
3939

40-
Similarly, we can use `setup` and `teardown` inside a test case, or use the `SystemStubs` methods such as
40+
Similarly, we can use `setup` and `teardown` methods of a `TestResources` such as `EnvironmentVariables` inside a test case, or use the `SystemStubs` wrapper methods such as
4141
`withEnvironmentVariables`. See the [main documentation](../README.md) for more on the execute around pattern.
4242

43-
### Using of the Plugin
43+
### Using the Plugin
4444

4545
The plugin:
4646

@@ -54,6 +54,8 @@ Usage:
5454
@Listeners(SystemStubsListener.class)
5555
public class CaptureSystemOutTest {
5656

57+
// We can ininitialise this object with `new` here, or
58+
// leave it uninitialized for the plugin to do it for us
5759
@SystemStub
5860
private SystemOut out;
5961

@@ -74,13 +76,15 @@ public class CaptureSystemOutTest {
7476

7577
> Note: in this instance we've used the `SystemOut` stub. We've had to remember to call its `clear` method as it
7678
> will be shared between tests.
79+
> Note: we may prefer to initialize our stub objects to give them configuration or initial values without using
80+
> a `@BeforeTest` function.
7781
78-
We can use each of the stubs such as:
82+
We can use any of the core system stubs classes such as:
7983

8084
- `EnvironmentVariables` - for overriding the environment variables
8185
- `SystemProperties` - for temporarily overwriting system properties and then restoring them afterwards
8286
- `SystemOut` - for tapping the `System.out`
83-
- ... and the others
87+
- ... and so on
8488

8589
All we need to do is:
8690

0 commit comments

Comments
 (0)