- this is not actuall testing process, it's only to visualize the testing step
- as it not actuall test process so i donot use testing framework i built one called ("Ktest => Kareem test" like Gtest => Google test)
- Ktest has main functions common in testing (built on OOP)
- i donot test all function i test libs functions , and another functtions manually tested.
Ktest has the common functions for testing and some functions for mocking.
let's assume we want to test Trim() function
// test Trim function
// make void function has Trim with "_Test" as suffix.
void Trim_Test()
{
// create object from Ktest class .
// pass title of test as an argument to constructor.
Ktest Trim_Test("Trim() function Test");
// declare string variable to store output of Trim().
// pass your test case input.
string output=DataManip_helpers::Trim(" Kareem. ");
// use EXPECT_EQ() to check if output equal what you expected.
// pass output, expected_output as arguments.
Trim_Test.EXPECT_EQ(output,(string)"Kareem.");
// add another test cases here.
// like above .......
// no your object stored the result of all your test cases.
// display result by DISPLAY_DATA().
Trim_Test.DISPLAY_DATA();
}
// and of course, call Trim_Test().
//===================================================================================
Test Name : Trim() function Test
Tests Count : 1
Test Status : Passed!
=================================
Report will show you exactly where is the error;
=================================
Test Name : Trim() function Test
Tests Count : 1
Test Status : Failed!
Errors Count : 1
Report :
1- Error in Test [ 1 : EXPECT_EQ ] :: ( Should be : [Kareem.] ,But it : Kareem ) !
=================================