Julia Language Testing a Package


To run the unit tests for a package, use the Pkg.test function. For a package named MyPackage, the command would be

julia> Pkg.test("MyPackage")

An expected output would be similar to

INFO: Computing test dependencies for MyPackage...
INFO: Installing BaseTestNext v0.2.2
INFO: Testing MyPackage
Test Summary: | Pass  Total
  Data        |   66     66
Test Summary: | Pass  Total
  Monetary    |  107    107
Test Summary: | Pass  Total
  Basket      |   47     47
Test Summary: | Pass  Total
  Mixed       |   13     13
Test Summary: | Pass  Total
  Data Access |   35     35
INFO: MyPackage tests passed
INFO: Removing BaseTestNext v0.2.2

though obviously, one cannot expect it to match the above exactly, since different packages use different frameworks.

This command runs the package's test/runtests.jl file in a clean environment.

One can test all installed packages at once with

julia> Pkg.test()

but this usually takes a very long time.