-
Notifications
You must be signed in to change notification settings - Fork 16
Migrate the simplest system test to scalatest (as a unit test) #26
Comments
Note that this will only work for successful tests for now. Any test that results in System.exit(1) will terminate the VM and unit tests. A full migration therefore requires some refactoring of error handling. |
I have refactored parts of the code (see issue #27) so that |
I think we have to add a fixture for these tests, which sets the environment variables. We could have a simple helper function for this:
Probably testMain should be parametrized with another parameter, a function that sets the environment. This can be a function that returns "Unit" (void in Scala). Each test should specify this, as tests can be reordered (prioritized), and updating the classpath affects future tests; so they all should set the right setting. Probably the syntax for the second parameter is: |
Once this works, this also needs a comment in the harness (I will add that). |
I have reorganized the sources in branch unit-test in your repo. The build dependency could thus be resolved. There are two issues left:
The easiest way to resolve point 2 is to try changing Point 1 is needed for the system tests to pass again. This requires more work (modbat-examples.jar should have the sources as well, modbat-test.jar only needs the class files as it is not a release archive). |
…rr in Log, to simplify code and test harness. modified: src/main/scala/modbat/log/Log.scala, src/main/scala/modbat/mbt/Modbat.scala
The pull request above fixes part 2, but part 1 still needs to be fixed. |
This issue can be closed after a review and removal of redundant tests that are still run with |
Log files that are no longer needed should also be removed. |
modified: src/test/scala/modbat/mbt/InvokeTransitionTest.scala
Issue #26: removed remaining debug output.
For performance and ease of use, we would like to run upcoming tests under scalatest.
To make sure we have a working test harness and an example, I would like to migrate
Choose00
, the simplest test that currently exists.For this, we need to have a harness
ModbatTestHarness
, which is similar toConfigTest
, to runMain.main
:Another class should be used to test different features, e.g., ChooseTest. For now, we'll have only one test there, but we can migrate more tests in the future and add new tests:
In the output, there are three lines that are relevant. I'd like to check them against the actual content without the "preamble" [INFO], and without looking at the order of the output. So please add three checks, to verify that each substring occurs (e.g., "1 tests executed, 1 ok, 0 failed."):
The text was updated successfully, but these errors were encountered: