JSONReporter considers verbosity when listing tests
* Quiet verbosity provides just the test names * Normal verbosity adds tags * High verbosity add the source location of the tests Listing tests with the quiet verbosity results in about 1/4 of the previous output, which leads to measurably faster execution of `catch_discover_tests` when it does not need tags for labels. (If it does need tags, the output is about 1/2 of previous).
This commit is contained in:
14 files changed
+77
-93
No files matched your search
@@ -208,6 +208,21 @@ set_tests_properties(List::Tests::XmlOutput PROPERTIES
|
||||
FAIL_REGULAR_EXPRESSION "[0-9]+ test cases"
|
||||
)
|
||||
|
||||
add_test(NAME List::Tests::Json::Normal COMMAND $<TARGET_FILE:SelfTest> --list-tests -r json)
|
||||
set_tests_properties(List::Tests::Json::Normal PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "\"tags\": \\["
|
||||
FAIL_REGULAR_EXPRESSION "\"source-location\": {"
|
||||
)
|
||||
add_test(NAME List::Tests::Json::Quiet COMMAND $<TARGET_FILE:SelfTest> --list-tests -r json::verbosity=quiet)
|
||||
set_tests_properties(List::Tests::Json::Quiet PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "\"name\": \""
|
||||
FAIL_REGULAR_EXPRESSION "\"tags\": \\["
|
||||
)
|
||||
add_test(NAME List::Tests::Json::High COMMAND $<TARGET_FILE:SelfTest> --list-tests -r json::verbosity=high)
|
||||
set_tests_properties(List::Tests::Json::High PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "\"source-location\": {"
|
||||
)
|
||||
|
||||
add_test(NAME List::Tags::Output COMMAND $<TARGET_FILE:SelfTest> --list-tags)
|
||||
set_tests_properties(List::Tags::Output PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "[0-9]+ tags"
|
||||
@@ -218,6 +233,11 @@ set_tests_properties(List::Tags::XmlOutput PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "<Count>18</Count>"
|
||||
FAIL_REGULAR_EXPRESSION "[0-9]+ tags"
|
||||
)
|
||||
add_test(NAME List::Tags::JsonOutput COMMAND $<TARGET_FILE:SelfTest> --list-tags -r json)
|
||||
set_tests_properties(List::Tags::JsonOutput PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "\"count\": 18"
|
||||
FAIL_REGULAR_EXPRESSION "[0-9]+ tags"
|
||||
)
|
||||
|
||||
add_test(NAME List::Reporters::Output COMMAND $<TARGET_FILE:SelfTest> --list-reporters)
|
||||
set_tests_properties(List::Reporters::Output PROPERTIES PASS_REGULAR_EXPRESSION "Available reporters:")
|
||||
@@ -227,6 +247,12 @@ set_tests_properties(List::Reporters::XmlOutput PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "<Name>compact</Name>"
|
||||
FAIL_REGULAR_EXPRESSION "Available reporters:"
|
||||
)
|
||||
add_test(NAME List::Reporters::JsonOutput COMMAND $<TARGET_FILE:SelfTest> --list-reporters -r json)
|
||||
set_tests_properties(List::Reporters::JsonOutput PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "\"name\": \"compact\""
|
||||
FAIL_REGULAR_EXPRESSION "Available reporters:"
|
||||
)
|
||||
|
||||
|
||||
add_test(NAME List::Listeners::Output
|
||||
COMMAND
|
||||
@@ -251,6 +277,18 @@ set_tests_properties(List::Listeners::XmlOutput
|
||||
PASS_REGULAR_EXPRESSION "<RegisteredListeners>"
|
||||
FAIL_REGULAR_EXPRESSION "Registered listeners:"
|
||||
)
|
||||
add_test(NAME List::Listeners::JsonOutput
|
||||
COMMAND
|
||||
$<TARGET_FILE:SelfTest>
|
||||
--list-listeners
|
||||
--reporter json
|
||||
)
|
||||
set_tests_properties(List::Listeners::JsonOutput
|
||||
PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "\"listeners\": \\["
|
||||
FAIL_REGULAR_EXPRESSION "Registered listeners:"
|
||||
)
|
||||
|
||||
|
||||
add_test(NAME NoAssertions COMMAND $<TARGET_FILE:SelfTest> -w NoAssertions "An empty test with no assertions")
|
||||
set_tests_properties(NoAssertions PROPERTIES PASS_REGULAR_EXPRESSION "No assertions in test case")
|
||||
|
||||
@@ -1740,11 +1740,7 @@ Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fa
|
||||
"name": "fake test name",
|
||||
"tags": [
|
||||
"fakeTestTag"
|
||||
],
|
||||
"source-location": {
|
||||
"filename": "fake-file.cpp",
|
||||
"line": 123456789
|
||||
}
|
||||
]
|
||||
}
|
||||
]" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: JSON'
|
||||
Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false
|
||||
|
||||
@@ -1738,11 +1738,7 @@ Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fa
|
||||
"name": "fake test name",
|
||||
"tags": [
|
||||
"fakeTestTag"
|
||||
],
|
||||
"source-location": {
|
||||
"filename": "fake-file.cpp",
|
||||
"line": 123456789
|
||||
}
|
||||
]
|
||||
}
|
||||
]" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: JSON'
|
||||
Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false
|
||||
|
||||
@@ -11323,11 +11323,7 @@ with expansion:
|
||||
"name": "fake test name",
|
||||
"tags": [
|
||||
"fakeTestTag"
|
||||
],
|
||||
"source-location": {
|
||||
"filename": "fake-file.cpp",
|
||||
"line": 123456789
|
||||
}
|
||||
]
|
||||
}
|
||||
]" ( contains: "fake test name" and contains: "fakeTestTag" )
|
||||
with message:
|
||||
|
||||
@@ -11321,11 +11321,7 @@ with expansion:
|
||||
"name": "fake test name",
|
||||
"tags": [
|
||||
"fakeTestTag"
|
||||
],
|
||||
"source-location": {
|
||||
"filename": "fake-file.cpp",
|
||||
"line": 123456789
|
||||
}
|
||||
]
|
||||
}
|
||||
]" ( contains: "fake test name" and contains: "fakeTestTag" )
|
||||
with message:
|
||||
|
||||
@@ -2775,7 +2775,7 @@ ok {test-number} - listingString, ContainsSubstring("fake reporter"s) for: "{
|
||||
# Reporter's write listings to provided stream
|
||||
ok {test-number} - !(factories.empty()) for: !false
|
||||
# Reporter's write listings to provided stream
|
||||
ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) for: "{ "version": 2, "metadata": { "name": "", "rng-seed": 1234, "catch2-version": "<version>" }, "listings": { "tests": [ { "name": "fake test name", "tags": [ "fakeTestTag" ], "source-location": { "filename": "fake-file.cpp", "line": 123456789 } } ]" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: JSON'
|
||||
ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) for: "{ "version": 2, "metadata": { "name": "", "rng-seed": 1234, "catch2-version": "<version>" }, "listings": { "tests": [ { "name": "fake test name", "tags": [ "fakeTestTag" ] } ]" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: JSON'
|
||||
# Reporter's write listings to provided stream
|
||||
ok {test-number} - !(factories.empty()) for: !false
|
||||
# Reporter's write listings to provided stream
|
||||
|
||||
@@ -2773,7 +2773,7 @@ ok {test-number} - listingString, ContainsSubstring("fake reporter"s) for: "{
|
||||
# Reporter's write listings to provided stream
|
||||
ok {test-number} - !(factories.empty()) for: !false
|
||||
# Reporter's write listings to provided stream
|
||||
ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) for: "{ "version": 2, "metadata": { "name": "", "rng-seed": 1234, "catch2-version": "<version>" }, "listings": { "tests": [ { "name": "fake test name", "tags": [ "fakeTestTag" ], "source-location": { "filename": "fake-file.cpp", "line": 123456789 } } ]" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: JSON'
|
||||
ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) for: "{ "version": 2, "metadata": { "name": "", "rng-seed": 1234, "catch2-version": "<version>" }, "listings": { "tests": [ { "name": "fake test name", "tags": [ "fakeTestTag" ] } ]" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: JSON'
|
||||
# Reporter's write listings to provided stream
|
||||
ok {test-number} - !(factories.empty()) for: !false
|
||||
# Reporter's write listings to provided stream
|
||||
|
||||
@@ -13503,11 +13503,7 @@ Approx( 0.98999999999999999 )
|
||||
"name": "fake test name",
|
||||
"tags": [
|
||||
"fakeTestTag"
|
||||
],
|
||||
"source-location": {
|
||||
"filename": "fake-file.cpp",
|
||||
"line": 123456789
|
||||
}
|
||||
]
|
||||
}
|
||||
]" ( contains: "fake test name" and contains: "fakeTestTag" )
|
||||
</Expanded>
|
||||
|
||||
@@ -13503,11 +13503,7 @@ Approx( 0.98999999999999999 )
|
||||
"name": "fake test name",
|
||||
"tags": [
|
||||
"fakeTestTag"
|
||||
],
|
||||
"source-location": {
|
||||
"filename": "fake-file.cpp",
|
||||
"line": 123456789
|
||||
}
|
||||
]
|
||||
}
|
||||
]" ( contains: "fake test name" and contains: "fakeTestTag" )
|
||||
</Expanded>
|
||||
|
||||
Reference in new issue
Block a user