...
When a test is created the JUnitService introspects the test class and looks for a method public void setBundleContext(BundleContext ctx); if one is found then the BundleContext is injected into the test class before being returned to the caller.
CLI
For convenience we provide a simple newton command line interface to the JUnit plugin in the bundle org.cauldron.sigil.junit.cli. This allows the user to find and run tests currently installed in the container.
examples:
| Code Block |
|---|
| title | List Tests |
|---|
| borderStyle | solid |
|---|
|
junit
org.cauldron.sigil.junit.example.Test1
org.cauldron.sigil.junit.example.Test10
org.cauldron.sigil.junit.example.Test2
org.cauldron.sigil.junit.example.Test3
org.cauldron.sigil.junit.example.Test4
org.cauldron.sigil.junit.example.Test5
org.cauldron.sigil.junit.example.Test6
org.cauldron.sigil.junit.example.Test7
org.cauldron.sigil.junit.example.Test8
org.cauldron.sigil.junit.example.Test9
|
| Code Block |
|---|
| title | Run a test |
|---|
| borderStyle | solid |
|---|
|
> junit org.cauldron.sigil.junit.example.Test1
Start testSuccess(org.cauldron.sigil.junit.example.Test1)
End testSuccess(org.cauldron.sigil.junit.example.Test1)
Start testFail(org.cauldron.sigil.junit.example.Test1)
Failure testFail(org.cauldron.sigil.junit.example.Test1): Failed
End testFail(org.cauldron.sigil.junit.example.Test1)
Ran 2 tests. 1 failures 0 errors.
|
| Code Block |
|---|
| title | Run a test (quietly) |
|---|
| borderStyle | solid |
|---|
|
> junit -q org.cauldron.sigil.junit.example.Test1
Ran 2 tests. 1 failures 0 errors.
|
| Code Block |
|---|
| title | Run all tests (quietly) |
|---|
| borderStyle | solid |
|---|
|
> junit -q *
Ran 20 tests. 10 failures 0 errors.
|
| Code Block |
|---|
| title | Run all tests (quietly and write results to specified directory) |
|---|
| borderStyle | solid |
|---|
|
> junit -q -d /tmp *
Writing results to /tmp
Ran 20 tests. 10 failures 0 errors.
|