-
Notifications
You must be signed in to change notification settings - Fork 16
Convert test executions in bin/test.sh to ScalaTest using ModbatTestHarness #55
Comments
As a first step, please write a parser for the output of |
In the main loop of the parser, the logic would be as follows:
At the end, you have a program that processes one item at a time, and outputs all of them on the terminal. This allows us to visually inspect if most of the entries get parsed correctly. We can later redirect the output to a file and use that in Google sheets, or with |
Please commit the script under a new branch, and commit + push it.
For this, we need to
We will also have to write the output to .log/.err files, and use an adapted version of |
…are the most common
I am writing this in anticipation of the push/PR that will follow after the network connection problems are solved. As a next step, focus on those tests that use modbat.jar as the application string (about 189 tests). Convert them to the unit test framework as used by, e.g., Try to create the output such that all tests for the same class are collected in one class with a number of unit tests. You can use the class name plus a number as the test name. |
… and err files with easy name (Child1 for example). File Child modified: result3 should not be empty. InvalidMethod2 result3 should be empty, and same for Niosocket1
…der to replace test.sh
…ional argument which enables Test as ChooseTest, CounterModel, NioSocket, for example to copy their own dot file in another file with a different name (for example cov_10.dot)
…. Changes in ModbatTestHarness to implement way to compare eout and out files. It still doesn't work (two errors I don't know how to solve). But still work on it !
…d out of 2. Just the problem with value getLines is not a member of java.io.ByteArrayOutputStream is remaining
… skipped when the .out file doesn't exist
…the last commit are now solved. TODO : change the way to download the list of the .out. 170 tests failed after the compilation. Maybe the filtering doesn't work
… a way to replace regex in err and out files. I can't understand why the patterns are created each new test (whereas the function to create it is not inside a for loop). And We can't see if the pattern matchs or not... Strange because there are Console.println everywhere
… a way to replace regex in err and out files. And We can't see if the pattern matchs or not... Strange because there are Console.println everywhere
…code to have only 13 failed tests. However, the comparison is still false.
…g by [FINE] in out files, but it doesn't really work...
…comparison between former and new files works. I changed also the function replaceRegexInSentence using Maps. To conclue, for the err files, the grep -v removing the all sentence if regex matches has to be implement. At that time, we replace the sentence by an empty line... But does it impact the result of the comparison, I'm not sure...
…t files. Now, unfortunately, 75 succedeed tests..., comparison failed
…now be run inside a gradle unit test (#96) * Issue #55: Convert tests to scalatest (#59) * Refactoring in ConfigTest, migrated most tests from test.sh to unit tests. * Refactored test harness into separate file. * Minor adaptations to allow Modbat's main test harness to reuse the one from config. * Refactoring and extension of test harness to be compatible for Modbat's main tests. * Migrated some Modbat tests to new test harness that compares full output. * Refactored model instance into its own class ModelInstance. * Carried over instance refactoring to StatePair, StateSet, Transition. * Carried over instance-based refactoring of Model, updated logs showing now a different number of method calls in stack trace. * Ported instance-based refactoring to Action. * Adapted test to use delayed initialization of random seed, so it works with the instance-based refactoring. * Refactoring: pass config object to Dotify and use it instead of global Main.config. * Refactoring: transition rewards use reference to config, avoiding global ref. * Refactoring: TransitionCoverage now takes reference to Configuration. * Minor refactoring: MBT now takes reference to Configuration in c'tor. * Refactoring: Transition.ppTrans now takes autoLabels as extra param. to avoid using global config object. * Refactored Path Graph classes to take reference to Configuration object instead of using global data. * Refactored usage of MBT in TransitionCoverage so it is now passed as ref. to the two functions that need it. * Refactored ModelInstance to take a reference to an MBT instance instead of using companion object, as far as possible at this point. * PathVisualizer and subclasses now use MBT instead of Config reference so mbt.modelClass can be access; config is accessed indirectly * Refactored MBT to be a class rather than using a companion object everywhere. * ModelInstance now uses mbt.config instead of global Main.config. * Using mbt.config instead of global config in Modbat. * Made "firstInstance" and instance variable of MBT to simplify the code. * Removed dead code. * Using local (newly created) configuration object for each test. * Use newly created configuration object for each run of main. * Refactored Main to use a Modbat instance. * Moved shutdown, wrapRun, runTest from companion object to class instance. * Moved getRandomSeed to instance. * Removed ref. to MBT instance from companion object. * Modbat: Refactored call to "init" so it is now called from the constructor. * Made "restoreChannels" an instance method, but using companion obj. vars due to remaining problem. * Changed default out/err to System instead of Console, fixing strange test failurs. * Refactored Modbat code as to be instance-based. * Made output filter overridable by passing filter function; fixes output mismatch. * Moved class loader config to c'tor of MBT. * Better diagnostic info on exceptions. * Changed harness to catch any type of exception/throwable. * Made SourceInfo instance-based. * Check both log/err first, then use assert, to store both mismatching results if present. * Added an optional parameter to Main.run, such that the reference to the newly created Modbat instance can be passed back in case the shutdown handler has to be invoked manually after unit test failure. * Refactored pendingTransitions into an instance variable of Model. Co-authored-by: AlexandreFournel <39304175+AlexandreFournel@users.noreply.github.com>
This task can now be carried out for most unit tests; the only exceptions are tests producing multiple output files, for which the current test harness will have to be extended. Over 80 % of the existing tests can be ported now, thanks to PR #101. |
All the executions of the test cases can be converted from a list of command-line arguments to a list of strings and calls to
testMain
inModbatTestHarness
.We still want to keep
bin/test.sh
for reference, but we also want a version that (1) does not execute any tests (similar to option-n
) but (2) still checks all the outputs (which-n
does not do).First, we want to convert a couple of test cases that share similar settings, and then adapt a part of
bin/test.sh
as (for example)bin/diff.sh
, to check the log/err outputs. Once that works, we will convert all 250+ tests.The text was updated successfully, but these errors were encountered: