Skip to content

Commit 60ed975

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 60ed975

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ else()
220220
DYNAMIC_CPP_STEPS_OBJ=${CUKE_DYNAMIC_CPP_STEPS_OBJ}
221221
COMPILE_DYNAMIC_CPP_STEPS=${CUKE_COMPILE_DYNAMIC_CPP_STEPS}
222222
CUCUMBER_RUBY=${CUCUMBER_RUBY}
223+
--format=junit "--out=${CMAKE_BINARY_DIR}/features"
223224
${ARGN}
224225
${CUKE_FEATURES_DIR}
225226
DEPENDS cucumber-cpp

appveyor.yml

Lines changed: 3 additions & 0 deletions
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

Lines changed: 3 additions & 2 deletions
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)