diff --git "a/frameworks\\utest/source/harness.cpp" "b/frameworks\\utest/source/harness.cpp" index 094fba640b..fe6dd62c63 100644 --- "a/frameworks\\utest/source/harness.cpp" +++ "b/frameworks\\utest/source/harness.cpp" @@ -52,9 +52,18 @@ static void die() { } void Harness::run(const Specification specification) +{ + run(specification, 0); +} + +void Harness::run(const Specification specification, std::size_t start_case) { mbed::util::CriticalSectionLock lock; + // ignore any invalid start index + if (start_case >= specification.length) + return; + test_cases = specification.cases; test_length = specification.length; defaults = specification.defaults; @@ -68,7 +77,7 @@ void Harness::run(const Specification specification) case_passed = 0; case_failed = 0; case_failed_before = 0; - case_current = test_cases; + case_current = &test_cases[start_case]; if (handlers.test_setup && (handlers.test_setup(test_length) != STATUS_CONTINUE)) { if (handlers.test_teardown) handlers.test_teardown(0, 0, FAILURE_SETUP); diff --git "a/frameworks\\utest/utest/harness.h" "b/frameworks\\utest/utest/harness.h" index bb6769ba8e..f2c228b6ff 100644 --- "a/frameworks\\utest/utest/harness.h" +++ "b/frameworks\\utest/utest/harness.h" @@ -43,9 +43,13 @@ namespace v1 { class Harness { public: - /// Starts running a test specification + /// Runs a test specification static void run(const Specification specification); + /// Runs a test specification starting at the specified case index + /// @warning if the start index is out of bounds, the call has no effect! + static void run(const Specification specification, size_t start_case); + /// @returns `true` if a test specification is being executed, `false` otherwise static bool is_busy();