Lifecycle hooks
Before/after each/all
#include "cst.h"
// Category handling demonstration. Applies to every hook type
CST_BEFORE_ALL(NULL) {
// Code runs once before executing any test
}
CST_BEFORE_ALL("") {
// Code runs once before running tests that don't have a category
}
// Hook types demonstration
CST_BEFORE_ALL("Example") {
// Code runs before tests of the "Example" category
}
CST_BEFORE_EACH("Example") {
// Code runs before EACH test of the "Example" category
}
CST_AFTER_ALL("Example") {
// Code runs after all tests of the "Example" category
}
CST_AFTER_EACH("Example") {
// Code runs after EACH test of the "Example" category
}Last updated