calc average in test script