Skip to content

Commit 306e7d6

Browse files
committed
tests/integration: one more JUnit XML sample produced by Google Test
1 parent 062b444 commit 306e7d6

File tree

5 files changed

+61
-0
lines changed

5 files changed

+61
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!reports/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<testsuites tests="2" failures="0" disabled="0" errors="0" time="0.001" timestamp="2025-05-01T16:42:49.950" name="AllTests">
3+
<testsuite name="TestCaseVc" tests="2" failures="0" disabled="0" skipped="0" errors="0" time="0.001" timestamp="2025-05-01T16:42:49.950">
4+
<testcase name="TestCase" file="/home/foobar/vc_test.cc" line="53" status="run" result="completed" time="0." timestamp="2025-05-01T16:42:49.950" classname="TestCaseVc" />
5+
<testcase name="Steering1" file="/home/foobar/vc_test.cc" line="61" status="run" result="completed" time="0.001" timestamp="2025-05-01T16:42:49.950" classname="TestCaseVc" />
6+
</testsuite>
7+
</testsuites>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[project]
2+
3+
features = [
4+
"REQUIREMENT_TO_SOURCE_TRACEABILITY",
5+
"SOURCE_FILE_LANGUAGE_PARSERS",
6+
]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This test mainly verifies that the test results are resolved for multiple test
2+
# cases and multiple files.
3+
4+
REQUIRES: PYTHON_39_OR_HIGHER
5+
6+
RUN: %strictdoc export %S --output-dir Output | filecheck %s --dump-input=fail
7+
8+
# Ensure that the test report document is generated.
9+
CHECK: Published: Test report
10+
RUN: %check_exists --file "%S/Output/html/%THIS_TEST_FOLDER/reports/tests_unit.gtest.junit.html"
11+
12+
# Ensure that the source and test files are generated.
13+
RUN: %check_exists --file "%S/Output/html/_source_files/tests/test1.cpp.html"
14+
15+
# Ensure that the test report document has the right content.
16+
RUN: %cat "%S/Output/html/%THIS_TEST_FOLDER/reports/tests_unit.gtest.junit.html" | filecheck %s --check-prefix CHECK-TEST-REPORT
17+
CHECK-TEST-REPORT:href="../../_source_files/tests/test1.cpp.html#TestCaseVc.TestCase#15#21">
18+
CHECK-TEST-REPORT: tests/test1.cpp, <i>lines: 15-21</i>, function TEST(TestCaseVc, TestCase)
19+
CHECK-TEST-REPORT:href="../../_source_files/tests/test1.cpp.html#TestCaseVc.Steering1#23#27">
20+
CHECK-TEST-REPORT: tests/test1.cpp, <i>lines: 23-27</i>, function TEST(TestCaseVc, Steering1)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <gtest/gtest.h>
2+
3+
//
4+
// Code that we want to test
5+
//
6+
7+
int Multiplication(int value1, int value2)
8+
{
9+
// Multiply like a boss
10+
return value1 * value2;
11+
}
12+
13+
//
14+
// GTest code below
15+
//
16+
17+
TEST(TestCaseVc, TestCase)
18+
{
19+
// Test it
20+
EXPECT_EQ(Multiplication(2, 2), 4);
21+
}
22+
23+
TEST(TestCaseVc, Steering1)
24+
{
25+
// Test it
26+
EXPECT_EQ(Multiplication(2, 2), 4);
27+
}

0 commit comments

Comments
 (0)