Pekko (and its modules) use the sbt build tool to not only build the tool but to also run tests. Its also strongly recommended to read the general sbt testing docs to familiarise yourself on how sbt testing works however this document also provides tips/cheat sheet on how to generally test Pekko and its various modules.
Use testQuick
sbt has a task called testQuick
which works the same as test
however running it multiple times will only run the tests that happened to fail last.
Firstly make sure to start sbt
in shell mode by just running sbt
<@incubator-pekko>-<⎇ main>-> sbt
[info] welcome to sbt 1.9.1 (Oracle Corporation Java 11.0.19)
[info] loading global plugins from /home/mdedetrich/.sbt/1.0/plugins
[info] loading settings for project incubator-pekko-build from plugins.sbt ...
[info] loading project definition from /home/mdedetrich/github/incubator-pekko/project
[info] compiling 1 Scala source to /home/mdedetrich/github/incubator-pekko/project/target/scala-2.12/sbt-1.0/classes ...
[info] loading settings for project pekko from build.sbt ...
[info] resolving key references (63609 settings) ...
[info]
[info] ________ ______ ______
[info] ___ __ \_______ /____ /_______
[info] __ /_/ / _ \_ //_/_ //_/ __ \
[info] _ ____// __/ ,< _ ,< / /_/ /
[info] /_/ \___//_/|_| /_/|_| \____/ 1.0.0-RC2+17-7fffb862-SNAPSHOT
[info]
[info] Useful sbt tasks:
[info] > compile - Compile the current project
[info] > test - Run all the tests
[info] > testQuick - Runs all the tests. When run multiple times will only run previously failing tests (shell mode only)
[info] > testOnly *.AnySpec - Only run a selected test
[info] > testQuick *.AnySpec - Only run a selected test. When run multiple times will only run previously failing tests (shell mode only)
[info] > publishLocal - Publish current snapshot version to local ~/.ivy2 repo
[info] > verifyCodeStyle - Verify code style
[info] > applyCodeStyle - Apply code style
[info] > sortImports - Sort the imports
[info] > mimaReportBinaryIssues - Check binary issues
[info] > validatePullRequest - Validate pull request
[info] > docs/paradox - Build documentation
[info] > docs/paradoxBrowse - Browse the generated documentation
[info] > tips: - prefix commands with `+` to run against cross Scala versions.
[info] > Contributing guide: - https://github.com/apache/incubator-pekko/blob/main/CONTRIBUTING.md
[info] sbt server started at local:///home/mdedetrich/.sbt/1.0/server/5b35f3900851d6427b80/sock
[info] started sbt server
pekko >
Then once in the shell just run testQuick
. You should see that the tests are now running and when doing so you may get a failing test, i.e.
[info] Run completed in 1 minute, 15 seconds.
[info] Total number of tests run: 628
[info] Suites: completed 181, aborted 0
[info] Tests: succeeded 628, failed 0, canceled 0, ignored 6, pending 2
[info] All tests passed.
[error] (remote / Test / testQuick) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 3475 s (57:55), completed Jul 6, 2023, 12:12:07 PM
Now if we run testQuick
again it will only run that failing test.