Skip to content

Commit

Permalink
feat(examples): add example for soap (#2386)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardobridge authored Dec 22, 2023
1 parent 1091257 commit fc9b91a
Show file tree
Hide file tree
Showing 9 changed files with 1,497 additions and 0 deletions.
49 changes: 49 additions & 0 deletions examples/soap-with-custom-function/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# SOAP Load Testing Example

Artillery doesn't have an official SOAP engine, but it's still possible to test SOAP with it. While building [a dedicated engine](https://www.artillery.io/blog/extend-artillery-by-creating-your-own-engines) is one option, you can also use custom functions and leverage the existing HTTP engine. This example shows you how to do that.

## What the example does

This example calls the SOAP server by using a SOAP client (node-soap) in a custom function. That custom function gets called with each VU execution. We also emit [custom metrics](https://www.artillery.io/docs/reference/extension-apis#custom-metrics-api) from the function to track the number of requests and responses, as well as the time taken to make the SOAP request.

```
soap.addNumbers.requests: ...................................................... 8
soap.addNumbers.response_time:
min: ......................................................................... 2
max: ......................................................................... 9
mean: ........................................................................ 4.9
median: ...................................................................... 2
p95: ......................................................................... 7.9
p99: ......................................................................... 7.9
soap.addNumbers.responses: ..................................................... 8
```

Notes:
- The `callSoapOperation` function has been abstracted to allow calling other operations, should you wish to extend this example.
- The creation of the client is also cached to prevent creating it for every virtual user.

## Running the SOAP server

We provide a very simple SOAP server for this example, containing the `AddNumbersService` with a single `addNumbers` operation.

First, install the server dependencies:

```
cd server && npm install
```

After installing the dependencies, start the SOAP server:

```
node app.js
```

This command will start a Socket.IO server listening at http://localhost:8000/.

## Running Artillery test

Once the SOAP server is up and running, execute the test script:

```
npx artillery run soap.yml
```
321 changes: 321 additions & 0 deletions examples/soap-with-custom-function/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions examples/soap-with-custom-function/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "soap-with-custom-function",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "npx artillery run soap.yml"
},
"author": "",
"license": "ISC",
"dependencies": {
"soap": "^1.0.0"
}
}
Loading

0 comments on commit fc9b91a

Please sign in to comment.