We use partest
for integration testing. partest
is the same tool used
to integration test the scala compiler, and its
sources
can be found in the scala/scala
repository.
- All tests go in the
test/files/<KIND>
directory, for some kind. - The kinds are:
pos
: the file(s) must compileneg
: the file(s) must not compilerun
: the file(s) must compile and run
- Individual tests can be either:
- a
.scala
file, which will be the only source compiled and/or run - a directory, in which case all files in the directory will be compiled and/or run together
- a
- For
neg
andrun
tests, a same-named.check
file specifies the output which the test must produce. - When adding a new test case, name it appropriately:
- If it is a regression test for an issue on GitHub, name it
t1234
, where1234
is the GitHub issue number - If it is a new feature, give it a descriptive but terse name
- If it is a regression test for an issue on GitHub, name it
Our sbt
has a partest
command that can be used to run partest. It
recognizes most of the common partest options:
partest
: run all test casespartest test/files/<KIND>/<test>
: run one test casepartest <KIND>
: run all test cases of kindKIND
partest --grep <SEARCH>
: run all test cases matchingSEARCH
partest --update-check ...
: rather than failing when the output does not match the.check
file, modify the.check
file to match the actual outputpartest --verbose
: print the output of the test cases to the terminal