This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Writing a Jmeter Test Case for API Manager
This page explains how to write a simple Jmeter test for API Manager.
package org.wso2.jmeter.tests; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testng.annotations.Test; import org.wso2.carbon.automation.engine.frameworkutils.FrameworkPathUtil; import org.wso2.carbon.automation.extensions.jmeter.JMeterTest; import org.wso2.carbon.automation.extensions.jmeter.JMeterTestManager; import java.io.File; public class JmeterDomainRestrictionTestCase { protected Log log = LogFactory.getLog(getClass()); @Test(groups = "wso2.am", description = "Login to api manager as user2") public void testListServices() throws Exception { JMeterTest script = new JMeterTest(new File(FrameworkPathUtil.getSystemResourceLocation() + File.separator + "artifacts" + File.separator + "AM" + File.separator + "scripts" + File.separator + "DomainRestrictionTest.jmx")); JMeterTestManager manager = new JMeterTestManager(); log.info("Running the Jmeter script ..."); manager.runTest(script); } }Â
Prerequisites:
You should place your jmeter script (DomainRestrictionTest.jmx) in the relevant resources directory.
Description:
Executing the above class will run the Jmeter script. You can find the report inside the .../tests/target/jmeter/reports
directory.