updated tester to include validation of gradient