Lean, hassle-free testing utility, my way.
- Synchronous and process-isolated test support
- Timeout support for potentially hanging tests
- Lifecycle hooks with skip/exclude controls
- Pluggable reporting (e.g., gtest XML) and CLI configuration
- C++17 or later
#include "mytest.h" and use the provided macros:
#include "mytest.h"
TEST(TestSuite, Basic) { // default timeout: 60000ms
ASSERT_EQ(1, 1);
}
TEST(TestSuite, Timeout, 1000) { // timeout: 1000ms
TEST_EXPECT_FAILURE();
std::this_thread::sleep_for(std::chrono::seconds(2));
EXPECT_EQ(1, 0);
}
TEST_ISOLATE(TestSuite, SegfaultIsolated) {
int* p = nullptr;
*p = 1; // Intentional crash in a spawned process
}
int main(int argc, char* argv[]) {
return RUN_ALL_TESTS(argc, argv);
}For more usage examples, see example.cc and mytest.h.
# This utility provides googletest output style:
[==========] Running 3 test case(s).
[ RUN ] TestSuite
[ RUN ] TestSuite:Basic
[ OK ] TestSuite:Basic
[ RUN ] TestSuite:Timeout
Timed out : TestSuite:Timeout
Passed : Expected fail and failed.
[ OK ] TestSuite:Timeout
[ RUN ] TestSuite:SegfaultIsolated (PID: 16502)
Terminated by signal 11 (Segmentation fault)
[ FAILED ] TestSuite:SegfaultIsolated
[ FAILED ] TestSuite
[==========] 3 test case(s) ran.
[ PASSED ] 2 test(s)
[ FAILED ] 1 test(s)cmake -B out && make -C out
out/example.xThe following options are available:
out/example.x -h
Options:
-p "PATTERN" : Include tests matching PATTERN
-p "-PATTERN" : Exclude tests matching PATTERN
-t TIMEOUT : Set the timeout value in milliseconds (default: 60000)
-c : Disable color output
-f : Force mode, run all tests, including skipped ones
-j : Job mode, run all tests in separate processes
-s : Silent mode (suppress stdout and stderr output)
-r [FILE] : Write report via registered reporter (optional FILE)
-h, --help : Show this help messageThis project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.