Skip to content

Run Tests

The EmbedOps CLI uses the eo test command to run your project's test suite, allowing you to validate your code functionality and maintain quality throughout development.

Prerequisites

Required

Optional - Have Requirements for --optimize flag seen below. Can set them up following the Add Requirements How-to

Steps

  1. Run all tests in your project

    Execute your complete test suite with eo test. This command will run all tests and display the results:

    eo test
    

    Example output:

    Running all tests...
       Compiling corelogic v0.1.0 (/workspaces/eo-test/corelogic)
        Finished `test` profile [unoptimized + debuginfo] target(s) in 0.79s
         Running unittests src/lib.rs (target/debug/deps/corelogic-683ceadf94cca0e0)
    
    running 2 tests
    test tests::test_core_hello_unit2 ... ok
    test tests::test_core_hello_unit3 ... ok
    
    test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
    

  2. Run optimized tests for faster execution

    For faster execution, only run tests affected by your uncommitted changes against the HEAD commit on your current branch:

    eo test --optimize
    

    Test Optimization

    The --optimize flag analyzes your codebase to determine which tests are affected by your uncommitted changes. This smart testing approach helps maintain fast feedback loops during development while ensuring comprehensive coverage when needed.

    This optimization only runs tests with implementations that have been marked with the @tests and @implements tags respectively and where the tests or implementations have uncommitted changes. See Add Requirements How-to for more information. Smart testing significantly reduces test execution time for large projects.

  3. OPTIONAL: Run optimized tests against a specific commit, branch or revspec

    Compare your current changes against a specific commit hash, branch, or revspec instead of your current branch at the HEAD commit:

    eo test --optimize --compare <hash/branch/revspec>
    

Next Steps

You can find out more about testing by looking at the eo test Reference page