Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
titleList Tests
borderStylesolid

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
titleRun a test
borderStylesolid

> 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
titleRun a test (quietly)
borderStylesolid

> junit -q org.cauldron.sigil.junit.example.Test1
Ran 2 tests. 1 failures 0 errors.
Code Block
titleRun all tests (quietly)
borderStylesolid

> junit -q *
Ran 20 tests. 10 failures 0 errors.
Code Block
titleRun all tests (quietly and write results to specified directory)
borderStylesolid

> junit -q -d /tmp *
Writing results to /tmp
Ran 20 tests. 10 failures 0 errors.