You can use WSO2 Test Automation Framework (TAF) to write automated test scripts for the API Manager. For an example, see Writing a Test Case for API Manager in TAF documentation.