00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
#include "../GeneralInclude/CompilerSwitches.h"
00011
#include "TestSuite.h"
00012
#include "TestCase.h"
00013
#include "../Utilities/TestUtilities.h"
00014
#include <string.h>
00015
00016 TestSuite::TestSuite(FILE* outputFile) {
00017
00018 out = outputFile;
00019 testCaseCounter = 0;
00020 }
00021
00022 void TestSuite::runTestSuite(
void) {
00023
00024 printRegressionTestHeader(out);
00025
00026
for (
int i=0; i<testCaseCounter; i++)
00027 {
00028
if (!list[i]->
setUpTestCase()) {
00029 printErrorMsg(out,list[i]->getTestName(),
"Test set up failed ...");
00030
continue;
00031 }
else {
00032 list[i]->
runTestCase();
00033 }
00034
if (!list[i]->
shutDownTestCase()) {
00035 printErrorMsg(out,list[i]->getTestName(),
"Test shut down failed ...");
00036
continue;
00037 }
00038
00039
if (list[i]->
getTestOutcome())
00040 printTestSuccess(out,list[i]->getTestName(),list[i]->getTestMessage());
00041
else
00042 printTestFailed(out,list[i]->getTestName(),list[i]->getTestMessage());
00043 }
00044
00045 printRegressionTestTail(out);
00046 }
00047
00048 void TestSuite::loadTestCase(
TestCase* newTestCase) {
00049
00050
if (testCaseCounter<
MAX_TEST_CASES_IN_SUITE)
00051 { list[testCaseCounter] = newTestCase;
00052 testCaseCounter++;
00053 }
00054
else
00055 printf(
"TestSuite: Test case %s could not be loaded because the list of test cases is already full ...",
00056 newTestCase);
00057 }