NeoLoad provides out of the box support for testing Web Services, the following example is a simple banking service. The first steps are to create a User Path and insert a SOAP request into the Actions section. For more information, see SOAP requests.
In the SOAP Request Wizard, we specify the path to the WSDL file of our banking service. This file contains the definition of the service including the available methods and required parameters.
Once the file is parsed, the available methods are displayed.
For the purpose of this example, we will pick a subset of the available methods. Namely creating the account, depositing some funds and checking the subsequent balance. The requests (or method calls) can either be added individually or added in bulk and the ones not being called, removed.
Selecting the first method, "createAccount", we can edit the call parameters to provide details of the account holder.
As this test was created by inspecting the banking services WSDL file, no data exists and needs to be entered manually, we provide the account holders details. These can be hard coded or read in from an external source such as a CSV file or database. The ellipse button (circled below) accesses NeoLoad Variable Manager.
Once the account holders data is added, we can exit these screens, clicking OK as needed. The next stage is to execute the "createAccount" method call. We can do this for each individual call or execute the User Path as a whole. We perform a "CheckVU" on the User Path by selecting the tool bar button shown below.
The Check User Path dialog appears, our User Path is selected automatically as it was where we last worked. Clicking the Start Checking button will connect to the embedded Load Generator installed as part of NeoLoad and execute our test.
Once execution has completed, we can see below that "createAccount" executed correctly, we received a 200 response code from the server indicating the request was OK. The deposit method returned a 500, this is expected as we have not provided any parameters to that method yet. We can see by looking at the "createAccount" response below, an account number was generated. This needs to be captured and passed to the deposit method. To do this, we select the Advanced button shown below.
As the test was created based on the WSDL file, we do not have a recorded response in our test, we will use the response above and add it to our test by clicking the Update button on the Advanced dialog.
We confirm overwriting the empty response.
We can exit these screens, clicking OK as needed. Returning to the main NeoLoad screen, we select the "createAccount" method.
We select the Advanced button to look at the newly updated response.
The response can be seen on the rightmost tab. We select the Variable extractors tab and click the + button as we need to extract the generated account number and save it to a variable.
Entering the text before and after the account number allows NeoLoad to create a regular expression to extract the number itself (
createAccount>503944</). These values can be entered manually or selected using the magnifying glass buttons. We name the variable "theAccountNo".
We are now ready to complete the deposit call so we exit the variable extractor screens, clicking OK as needed and selecting the "deposit" method.
Edit the parameters like we did on the "createAccount" method call.
In this example, we use theAccountNo variable rather than a hard coded value. To do this, we select the ellipse button highlighted below.
In the Variable picker list, we see "theAccountNo" variable we extracted from the "createAccount" response. We select it and click OK.
We could have easily typed it in instead of using the
For the amount value, we choose "100". This could also have easily been a random number variable.
Exit the variable deposit method call, clicking OK as needed and select the "getBalance" request. Like the "deposit" request, we have to provide details of the account we need to access. We enter
Exit the request, clicking OK as needed. We can now execute our test once more. Check the User Path by selecting the tool bar button shown below.
Clicking Start checking will connect to the embedded Load Generator installed as part of NeoLoad and execute our test.
Once execution has completed, we can see below that all 3 method calls are executing correctly, the account number extracted from the "createAccount" response has been passed to the deposit and "getBalance" method calls.
Selecting each method in turn, we see the responses from the Web service.
The final part of the exercise is to update our User Path with latest responses for the "deposit" and "getBalance" calls. We select the Advanced button in the Check User Path dialog and select Update.