You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

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.

This page is intended to be a general guide for testing Pekko and its various modules (for more specific information regarding testing a specific Pekko module refer to the documentation of that module itself).

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.

testQuick only works when you start sbt in shell mode since it needs to remember the last state of tests that have failed

Firstly make sure to start sbt  in shell mode by just running sbt 

sbt shell mode
<@incubator-pekko>-<⎇ main>-<*>-> sbt
[info] welcome to sbt 1.9.1 (Homebrew Java 11.0.19)
[info] loading global plugins from /Users/mdedetrich/.sbt/1.0/plugins
[info] loading settings for project incubator-pekko-build-build-build from metals.sbt ...
[info] loading project definition from /Users/mdedetrich/github/incubator-pekko/project/project/project
[info] loading settings for project incubator-pekko-build-build from metals.sbt ...
[info] loading project definition from /Users/mdedetrich/github/incubator-pekko/project/project
[success] Generated .bloop/incubator-pekko-build-build.json
[success] Total time: 0 s, completed 6 Jul 2023, 11:10:25
[info] loading settings for project incubator-pekko-build from metals.sbt,plugins.sbt ...
[info] loading project definition from /Users/mdedetrich/github/incubator-pekko/project
[success] Generated .bloop/incubator-pekko-build.json
[info] compiling 38 Scala sources to /Users/mdedetrich/github/incubator-pekko/project/target/scala-2.12/sbt-1.0/classes ...
[warn] one feature warning; re-run with -feature for details
[warn] one warning found
[success] Total time: 8 s, completed 6 Jul 2023, 11:10:35
[info] loading settings for project pekko from build.sbt ...
[info] resolving key references (65133 settings) ...
[info]
[info] ________     ______ ______
[info] ___  __ \_______  /____  /_______
[info] __  /_/ /  _ \_  //_/_  //_/  __ \
[info] _  ____//  __/  ,<  _  ,<  / /_/ /
[info] /_/     \___//_/|_| /_/|_| \____/   1.0.0-RC3+12-88bf6329-SNAPSHOT
[info]
[info] Useful sbt tasks:
[info] >  compile - Compile the current project
[info] >  test - Run all the tests
[info] >  testOnly *.AnySpec - Only run a selected test
[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:///Users/mdedetrich/.sbt/1.0/server/62a7cea246d563e33631/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.

Failing test
[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. Its also possible to run testQuick  in a loop which will only terminate until all tests pass while only retrying failing tests. This can be done by prefixing the testQuick  command with a tilda i.e. ~testQuick.

testQuick loop
[error] (remote / Test / testQuick) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 57 s, completed Jul 6, 2023, 12:19:46 PM
[info] 1. Monitoring source files for pekko/testQuick...
[info]    Press <enter> to interrupt or '?' for more options.




  • No labels