Helper-Functions for Test Case Generation with ATG

Implementing helper functions for ATG

In general, ATG will produce test cases with minimal input sequences reaching the coverage criterion. In order to test the calculator we are interested in test cases following a particular scheme: For example, we expect a test case to consist of the following sequence:

  1. set operand 1
  2. set operation
  3. set operand 2
  4. invoke computation
  5. show us the result

In order to achieve this goal, producing test cases that adhere to a particular scheme, we can implement helper functions and let ATG use them as drivers. Such helper functions explicitly model some of the additional knowledge and expectation of the tester. ATG leverages from such model items when generating test cases.

Hence, we implement for testing purposes a helper function in TestComponent TC_at_InEventsPt_of_TheTestCalc (you can find 6 possible variants of such helper functions in package TutorialPrereq - simply copy helper_func_infix_notation_1_2 to TestComponent TC_at_InEventsPt_of_TheTestCalc):

void helper_func_infix_notation_1_2(int op1,int op2,int oper)
{
OUT_PORT(InEventsPt)->GEN(evOperand(1,op1));
OUT_PORT(InEventsPt)->GEN(evOperation(oper));
OUT_PORT(InEventsPt)->GEN(evOperand(2,op2));
OUT_PORT(InEventsPt)->GEN(evCompute());
OUT_PORT(InEventsPt)->GEN(evShowResult());
}