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/.

Testing with JMeter scripts

Apache Jmeter scripts are used for performance testing. In WSO2 Open Banking solution, JMeter scripts are used to test API flows. After following the steps for the pre conditions, we can test with JMeter scripts. Currently, WSO2 Open Banking solution supports JMeter script testing for the following.

Before you begin

Follow the preconditions that are required to test Accounts flow and Payments flow using the available JMeter scripts. The steps are mentioned below.

  1. Download following dependency jar files and put them into [JMETER_HOME]/lib/ext directory.

    1. tag-jmeter-extn-1.1.jar 
    2. nimbus-jose-jwt-5.8.jar

    3. bcprov-jdk14-140.jar
    4. jwt-builder-jmeter-ext-1.3.0.jar

    This step is mandatory for the JMeter scripts to load.

  2. Generate public and private keys using the following commands.

    keytool -genkey -alias <myalias> -keyalg RSA -keystore <keystore-name>.jks
    keytool -export -alias <myalias> -file <filename> -keystore <keystore-name>.jks
    
    keytool -importkeystore -srckeystore <keystore-name>.jks -destkeystore myapp.p12 -deststoretype PKCS12
    openssl pkcs12 -in myapp.p12 -nokeys -out myalias.pem
    openssl pkcs12 -in myapp.p12 -nodes -nocerts -out <private-key-name>.pem

    If you have obtained the OBIE certificate when configuring DCR, use the certificate and keys to generate the keystore with the following commands.

    Find the below descriptions for the parameters. Change them accordingly;

    tpp.com.crt : Private certificate obtained from OBIE

    tpp.com.key : Private keys

    openssl pkcs12 -export -name tim -in tpp.com.crt -inkey tpp.com.key -out tim.p12
    keytool -importkeystore -destkeystore keystore.jks -srckeystore tim.p12 -srcstoretype pkcs12 -alias tim
  3. Create a sample application, subscribe to an API and generate production/sandbox keys. Open and provide the content between BEGIN CERTIFICATE and END CERTIFICATE of the myalias.pem file as the application certificate.

  4. Create a directory named jwtExtResources in a preferred location and place the jks keystore file created in the above steps.

  5. Create a setup.properties file in [JMETER_HOME]/bin path and add the required properties. Example properties are as follows.

    ip_address=<Enter your ip address here. Ex: 127.0.0.1>
    port=<Enter the specific http port here. Ex: 8280>
    https_port=<Enter the specific https port here.Ex: 8243>
    client_id=<Enter your client_id here. Ex: C5jcraWOnrqzBdvm2x0g6h8hcJAa>
    domain=<Enter your domain address here. Ex: openbanking.staging.wso2.com>
    result=<Enter the path to save the results here. Ex: /home/user/jmeter/apache-jmeter-3.2/bin/writedisabled/results>
    jwtExtResources=<Enter the path to jwtExtResources directory here. Ex: /home/user/jmeter/apache-jmeter-3.2/bin/jwtExtResources>
    redirecturl=<where the authorization flow is redirected to when creating the application>
    algorithm=<Enter the algorith as a new property> PS256
  6. Update the global variable to read the setup.properties file by calling the variable in the format. e.g., ${__P(ip_address)}.

  7. Within the global variable, please set the values for the below properties based on published API's. This will ensure that each API call reads the API context, version and resource, path based on the configurations.

    1. api_context
    2. version
    3. api_resource
  8. Create a file named jwtbuilder.properties in [JMETER_HOME]/bin/jwtExtResources directory with below details.   

    keyStorePassword=<Enter your key store password here. Ex.wso2carbon>
    keyStoreDomainName=<Enter alias name of the keystore here. Ex.myalias>
    clientID=<Enter application client ID here. Ex. nwU59qy9AsDqftmwLcfmkvOhvuYa>
    keyStoreName=<Enter KeyStore file name here. Ex.TodayApp.jks>
    tokenAPIURL=<Enter token endpoint URL which you have to use as aud value Ex. http://localhost:8280/token>
    Algorithm=<Enter algorithm details which JWT token need to be generated Ex. PS256>