Skip to content

Commit 79c890d

Browse files
committed
AppVeyor: nicely display test results
By producing JUnit output and submitting it to AppVeyor's job processing we now get some nice display of the tests and their results in the "Tests" tab.
1 parent 58b00c6 commit 79c890d

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ else()
219219
DYNAMIC_CPP_STEPS_EXE=${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/e2e-steps
220220
DYNAMIC_CPP_STEPS_OBJ=${CUKE_DYNAMIC_CPP_STEPS_OBJ}
221221
COMPILE_DYNAMIC_CPP_STEPS=${CUKE_COMPILE_DYNAMIC_CPP_STEPS}
222+
--format=junit "--out=${CMAKE_BINARY_DIR}/features"
222223
CUCUMBER_RUBY=${CUCUMBER_RUBY}
223224
${ARGN}
224225
${CUKE_FEATURES_DIR}

appveyor.yml

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ test_script:
5656
- cmd: cmake --build build --target test
5757
- cmd: cmake --build build --target features
5858

59+
after_test:
60+
- cmd: for /r %%v in (TEST-*.xml) do curl -s -F "file=@%%v;filename=%%~nxv" https://ci.appveyor.com/api/testresults/junit/%APPVEYOR_JOB_ID%
61+
5962
notifications:
6063
- provider: Email
6164
to:

tests/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ if(GMOCK_FOUND)
1313
add_executable(${TEST_NAME} ${TEST_FILE}.cpp)
1414
target_link_libraries(${TEST_NAME} cucumber-cpp-nomain ${CUKE_EXTRA_LIBRARIES} ${ARGN} ${CUKE_GMOCK_LIBRARIES})
1515
gtest_add_tests(${TEST_NAME} "" ${TEST_FILE}.cpp)
16-
# Run all tests in executable at once too. This ensures that the used fixtures get tested properly too.
17-
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
16+
# Run all tests in executable at once too. This ensures that the used fixtures get tested
17+
# properly too. Additionally gather the output in jUnit compatible output for CI.
18+
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME} "--gtest_output=xml:TEST-${TEST_NAME}.xml")
1819
endfunction()
1920

2021
# TODO Compile tests with the least possible code, not with the entire library

0 commit comments

Comments
 (0)