Commit f8daaa0b authored by Torsten Zühlsdorff's avatar Torsten Zühlsdorff
Browse files

Add a check for executed assertions and return code 1 if none was executed....

Add a check for executed assertions and return code 1 if none was executed. This means, that after passing the check for test-cases, none of them contained any assertion. Thus nothing was tested at all. Since we only execute APHPUnit to test something, it must be an error if we do not perform any test at all. Especially in continious integration a misconfiguration like this would go undetected. The now returned code 1 will trigger an error in continous integration and thus prevent such errors
parent d16f3f8d
Pipeline #314 passed with stage
in 0 seconds
- Feature: exit with code 1, if no test-cases were found
- Feature: exit with code 1, if not a single assertion was performed
......@@ -162,10 +162,17 @@ $objFork->waitUntilForksFinished(100, $cloGetTestResultsFromQueue);
// close and destroy queue, its no longer needed
// if no test-results were found, no asserts were done
// since we assume we want to execute test-cases this
// is handled as error
// this also means there are test-cases defined,
// but none of them contained any assertion
exitWithCodeAndMessage(2, 'APHPUnit could not found a single assertion');
/* print the result */
$arrGlobalSummary = Testresults\display($arrTestResults, $strTestSource);
if(0 < $arrGlobalSummary['failed'])
namespace APHPUnit\Testcases;
* when giving APHPUnit this single file to test,
* it must fail, because nothing was tested
function testDetectionOfMissingAssertion() {
// Intentionally Left Blank ;)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment