The ATS File

In this part the ATS file will be explained. The ATS consists of a few parts, of which the ATS itself is the most importent, since that is the actual test. The other parts are an setup and teardown function. An ATS file can consist of one or more ATS’s, setup and teardown functions. It is also possible to have a general setup and teardown function as well. Therefore, a test set can have a structure like below. Note that the ATS specific setup and teardown functions are optional.

  1. General setup function

    1. Setup 1

    2. ATS 1

    3. Teardown 1

    4. Setup n

    5. ATS n

    6. Teardown n

  2. General teardown function

ATS Function

In the ATS used as an example a caculator is tested, which has different functionalities, such as a login and printscreen function and off course the general functions a calculator should have. The calculator that is tested is a simple calculator. Therefore, it can only substract, add, multiply and divide whole numbers (integers). The ATS, of which parts are shown, has as goal to test the calculation functions only is shown below.

    logging.info("einde test")


def ATS_1(calc, vector, teardown):
    logging.info("start test 1")
    lastVal = 0
    for feed, expect in vector:
        som, num  = feed(0), feed(1)
        if som == "+":
            actual = calc.add(num)
        elif som == "-":
            actual = calc.sub(num)
        elif som == "/":
            actual = calc.div(num)
        elif som =="*":
            actual = calc.mul(num)
        else:
            print("foutje in het *.csv bestand")
            logging.error
        if actual != expect:
            logging.error #deze functie zou ook de som moeten printen die is uitgevoerd dus: (lastVal, som, num, '=', actual, '!=', expect
        else:
            logging.succes #geen idee of dit bestaat. Anders gewoon een print('test is OK!') of iets dergelijks. Zou wel mooi zijn als deze bestaat

In this function the external test data is used to perform calculations with the calculator. The result of this calculation is compared to the expected results in the test data.

Vector function

From the test data file, which is a comma seperated file, the test data is imported. The test data has the following structure +,2,,3.