How do I run specific tests or list available tests in EK9?

← Testing · Ref: Q807

EK9 provides the -tg flag to filter by group and -tL to list tests without running them.

RUN ALL TESTS

  ek9 -t myApp.ek9

Runs every @Test program in the project.

RUN A SPECIFIC GROUP

  ek9 -tg database myApp.ek9

Runs only tests marked @Test: "database". All other tests are skipped.

LIST TESTS WITHOUT RUNNING

  ek9 -tL myApp.ek9

Discovery mode. Lists all @Test programs with their group names but does not execute them. Useful for CI/CD pipelines that need to enumerate tests before running.

COMBINE FLAGS

Group filter + list:

  ek9 -tL -tg network myApp.ek9

Group filter + format:

  ek9 -t2 -tg api myApp.ek9

Group filter + profiling:

  ek9 -tp -tg perf myApp.ek9

OUTPUT FORMATS

All output format flags work with -tg:

  -t0  terse    -t1  human (default)
  -t2  JSON     -t3  JUnit XML
  -t4  coverage -t5  verbose coverage
  -t6  HTML     Append p for profiling

CI/CD WORKFLOW

A typical CI pipeline might:

  ek9 -tL myApp.ek9           # list tests
  ek9 -t2 myApp.ek9           # run all, JSON output
  ek9 -t3 myApp.ek9           # JUnit XML for CI dashboards
  ek9 -t6 myApp.ek9           # HTML report as artifact

See Q806 for test grouping. See Q207 for output formats. See Q206 for coverage.

Example

defines module qa.testdeep.running.specific

  defines function

    fetchUser() as pure
      -> userId as Integer
      <- rtn as String: `user-${userId}`

  defines program

    // === DIFFERENT TEST GROUPS ===

    @Test: "api"
    FetchUserTest()
      user <- fetchUser(42)
      assert user == "user-42"

    @Test: "api"
    FetchAnotherUserTest()
      user <- fetchUser(1)
      assert user == "user-1"

    @Test: "validation"
    ValidateInputTest()
      name <- "EK9"
      assert name?
      assert name.length() > 0

    // Run only api tests:     ek9 -tg api thisFile.ek9
    // Run only validation:    ek9 -tg validation thisFile.ek9
    // List all tests:         ek9 -tL thisFile.ek9
    // JSON output for CI:     ek9 -t2 thisFile.ek9
    // HTML report:            ek9 -t6 thisFile.ek9
Other ways to ask this
  • How do I filter which tests to run in EK9?
  • What does ek9 -tL do?
  • How do I run just one test group in EK9?

Coming from another language?

Java: JUnit -t tag filtering, Maven -Dtest=ClassName, Gradle --tests filter. Python: pytest -k expression, pytest -m marker. Rust: cargo test test_name, --test-threads=1. Go: go test -run TestRegex. EK9: -tg groupname for group filtering, -tL for test discovery.

Keywords: group, format, specific, filter, tg, list, ci, pipeline, tL, run