format from class fcf::NTest::Options
Type:
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.1.1
Output format for the test results (e.g.,
The
Supported formats include:
"default" : A standard, human-friendly output designed for console viewing."junit" : An XML-based format following the JUnit schema, ideal for integration with automated testing tools and build servers.
Example: Specifying a custom output format via Options
Demonstrating how to manually configure the
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
// A simple test case to be included in the report
FCF_TEST_DECLARE ("FormatDemo", "Output", "JUnitTest") {
fcf::NTest::log () << "This test is part of a JUnit report." << std::endl;
FCF_TEST (true);
}
int main(int a_argc, char* a_argv[]) {
// 1. Create an instance of fcf::NTest::Options
fcf::NTest::Options options;
// 2. Set the desired output format to "junit"
options.format = "junit";
// 3. Run the tests with the configured options
bool error = false;
fcf::NTest::run (options, &error);
return error ? 1 : 0;
}
Output:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1" failure="0" skipped="0" time="0.000006051">
<testsuite name="FormatDemo/Output" tests="1" failure="0" skipped="0" time="0.000006051">
<testcase classname="FormatDemo/Output" name="JUnitTest" time="0.000006051"/>
</testsuite>
</testsuites>
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.