Generic version of test_AGMS.py