Run massively scalable performance tests on web, mobile, and APIs

Request a Demo
Nov. 28th, 2017

Load Testing WebDAV Servers

WebDAV is a set of extensions to the HTTP protocol, enabling more operations to resources. If you are using a WebDAV server, you should learn how to load test its unique abilities. This blog post will cover just that! We will explain how you can use Apache JMeter™ to load test COPY, MOVE, MKCOL and more. Let’s get started.

 

What is WebDAV?

 

WebDAV (“Web-based Distributed Authoring and Versioning") is a set of extensions to the HTTP protocol that allows clients to perform remote Web content authoring operations.

 

Since WebDAV is an extension to the HTTP protocol, let’s review a few things about the HTTP protocol first.

 

HTTP stands for Hypertext Transfer Protocol. It is the most widely used protocol for communication over the World Wide Web. The HTTP protocol defines the following methods: GET, PUT, POST, OPTIONS, HEAD, TRACE, CONNECT and DELETE.

 

WebDAV adds the following new functionalities to HTTP: create, change and move resources (documents) on a server, namespace management (collections), management of properties about an author, modification of the date or anything else and overwrite protection. WebDAV extends HTTP without changing the existing functionality. The WebDAV protocol supports all HTTP methods and adds the following methods: MKCOL, COPY, MOVE, LOCK, UNLOCK, PROPPATCH and PROPFIND.

 

The list below displays the most commonly used HTTP and WebDAV methods.

  • PUT - Upload new or update old resource
  • GET - Read resource data
  • DELETE - Delete resources or collections
  • MKCOL - Create a collection
  • COPY - Copy resources or collections
  • MOVE - Move resources or collections
  • LOCK - Lock a resource or collection to avoid overwrite conflicts
  • UNLOCK - Unlock an locked resource or collection to make it available for writing
  • PROPPATCH - Manage properties defined on a resource
  • PROPFIND - Get property values from a resource

 

WebDAV Methods on JMeter

 

JMeter supports all of these methods with the HTTP request sampler. So we don’t need any plugins or extensions to work with WebDAV servers.

 

However we do need a WebDAV server to see how it works. I used a public service https://www.webdavserver.com/, which provides a free personal WebDAV server for testing purposes.

 

While this service is free, they do ask that users keep their load testing to a reasonable size. Let’s take this into account when we do our performance testing.

 

Of course if you have your own WebDAV server you can test as thoroughly as you would like.

 

All WebDAV related methods can be divided into several groups: Resource management (PUT, GET), Namespace management (MKCOL, COPY, MOVE, DELETE), Lock management (LOCK, UNLOCK) and Properties management (PROPPATCH, PROPFIND). We will go over all of them. Let’s get started.

 

1. Resource Management

 

Standard HTTP methods allow you to read, write and delete resources on a WebDAV server. Let’s take a look at how to manage the documents below.

 

PUT method

 

Writing content to a WebDAV server can be done in severals ways by using a HTTP Request sample in JMeter.

 

The first way is to send to the body of the resource with the Body Data option of the HTTP Request.

 

Add a HTTP request sample and open the Body Data tab.

 

load testing webdav servers

 

Fill in the following values:

  • Protocol: https
  • Server Name or IP: www.webdavserver.com
  • Port Number: 443
  • Method: PUT
  • Path: your_path/blazefile.txt
  • Body data:

BlazeMeter WebDAV blog post
BlazeMeter WebDAV blog post
BlazeMeter WebDAV blog post
BlazeMeter WebDAV blog post

 

After running this request we can see the newly created blazefile.txt file in the web UI of the service. The text in the “Body Data” is what will appear in the file.

 

Another way to write to resources is to use the Files Upload option of an HTTP request sample.

 

Add a HTTP request sample and go to the Files Upload tab. Copy the web server values  from the previous request.

 

performance testing webdav servers

 

Fill in the following values:

  • Method: PUT
  • Path: your_path/blazefile.pdf
  • Files Upload:

  File path: /path_to_file/blazefile.pdf
  MIME Type: application/pdf

 

We are able to upload any file from a local machine to the WebDAV server. I used a 1MB pdf file.

 

GET method

 

Use the GET method to read resources from a WebDAV server.

 

Add a HTTP request sample.

 

jmeter, webdav servers

 

Fill in the following values:

  • Method: GET
  • Path: your_path/blazefile.txt

 

This request will show the content of the file in the response. You can verify this by using the View Results Tree listener.

 

2. Namespace Management

 

The MKCOL, COPY, MOVE and DELETE methods are designed to manage hierarchical namespaces (collections) that have resources located under those namespaces.

 

MKCOL method

 

Requests with the MKCOL method will create an empty collection.

 

Add a HTTP request sample and fill in the following fields.

 

jmeter, open source, web dav servers

 

Required values:

  • Method: MKCOL
  • Path: your_path/blazecollection

 

Execution of this request creates a blazecollection collection. You can check it by using the web UI.

 

COPY method

 

You can use the copy operation for a single resource and for collections. Copying a collection will also copy all its nested collections and resources.

 

NOTE: the destination location should be set in the HTTP header.

 

To copy a single resource:

 

Add a HTTP request sample.

 

jmeter, load testing, webdav servers

 

Fill in the following values:

  • Method: COPY
  • Path: your_path/blazefile.txt

 

Add a HTTP Header Manager to the HTTP request sample to set the destination file for this resource.

 

jmeter, performance testing, webdav servers

 

Add one row to this Config Element: Destination: https://www.webdavserver.com:443/your_path/blazefile_copy.txt

 

After execution, a copy of the file will be placed in the same location as the copied file. Verify it by using the web UI.

 

To copy a collection:

 

Add another HTTP request or update the previous request to copy a collection.

 

how do i load test webdav servers

 

Fill in the following values:

  • Method: COPY
  • Path: your_path/blazecollection

 

Type in the collection destination instead of the location of a particular resource.

 

Add a HTTP Header Manager and also set the destination location.

 

free performance testing tool which fully supports all WebDAV methods

 

Add one row: Destination: https://www.webdavserver.com:443/your_path/blazecollection_copy

 

This request will copy the whole collection, together with its nested elements, to a new place.

 

MOVE method

 

The move operation is also possible for single resources as well as collections. Moving a collection will move all of its nested collections and resources.

 

NOTE: the destination location should be sent to the server in the HTTP header.

 

To move a single resource:

 

Use a HTTP request sample just like our other requests.

 

Uploading File to WebDAV Server, jmeter

 

Fill in the following values:

  • Method: MOVE
  • Path: your_path/blazefile.txt

 

The document specified in the path field is a source document and will be deleted after successfully moving it to a new location.

 

Add a HTTP Header Manager to the HTTP request sample.

 

HttpWebdav (Apache JMeter API)

 

Add a row to this Config Element: Destination: https://www.webdavserver.com:443/your_path/blazefile_move.txt

 

The Blazefile.txt will be moved to blazefile_move.txt after execution of this request.

 

How to move a collection:

 

Add a HTTP request sample or update the previous one.

 

jmeter - Performance testing java application that includes webdav

 

Fill in the following values:

  • Method: MOVE
  • Path: your_path/blazecollection

 

Add a HTTP Header Manager to the HTTP request sample.

 

tool for WebDAV load testing

 

Set the destination in the HTTP Header Manager: Destination: https://www.webdavserver.com:443/your_path/blazecollection_move

 

This request will move the whole collection along with its nested elements to a new place.

 

DELETE method

 

A delete request will destroy a single resource or collection with all of its nested collections and resources.

 

To delete a single resource:

 

Add a HTTP request sample.

 

New open-source WebDAV load testing tool

 

Fill in the required values:

  • Method: DELETE
  • Path: your_path/blazefile.txt

 

This request will delete the blazefile.txt resource from the WebDAV server.

 

To delete a collection:

 

To delete a collection add a HTTP request sample.

 

WebDAV - QATestingTools

 

Fill in the following values:

  • Method: DELETE
  • Path: your_path/blazecollection

 

Execution of this sample will delete the entire collection including all nested elements.

 

3. Lock Management

 

Locking resources is necessary to avoid problems with overwriting conflicts between concurrently active users. It is common practice when an author makes an exclusive lock before writing an object and unlocking it after editing is done. WebDAV allows two kinds of locks: shared locks and exclusive locks.

 

Locking is available for single resources and for collections. Let’s see how to lock a single resource below.

 

LOCK method

 

Add a HTTP request sample as usual.

 

Load testing WebDAV

 

Required values:

  • Method: LOCK
  • Path: your_path/blazefile.txt
  • Body Data:

<?xml version="1.0" encoding="utf-8"?>
<lockinfo xmlns='DAV:'>
<lockscope><exclusive/></lockscope>
<locktype><write/></locktype><owner>BlazeMeter</owner>
</lockinfo>

 

This is an example of an exclusive lock. This type of lock is important because some servers support only exclusive locks.

 

Run this request and check the response.

 

webdav, web dav, WebDav

 

The response contains a lock token which is necessary to send as an HTTP header with an UNLOCK request to pass authorization.

 

Add an XPath Extractor to the HTTP Request to retrieve the token.

 

jmeter, webdav servers, load testing

 

Fill in the following values:

  • Reference Name: locktoken
  • XPath query: //*[name()='d:locktoken']/*[name() = 'd:href']
  • Default Value: ERROR

 

The lock token will be saved to the locktoken variable and we will be able to use it to unlock the request.

 

UNLOCK method

 

To unlock a request add a HTTP request sample.

 

guide to webdav load testing

 

Required values:

  • Method: UNLOCK
  • Path: your_path/blazefile.txt

 

Add a HTTP Header manager to send the lock token as a HTTP header.

 

how do i load test webdav

 

Add row: Lock-Token <${locktoken}>

 

The execution of this request should unlock the file for future changes by other authors.

 

4. Properties Management

 

WebDAV has two kinds of properties: live properties and dead properties. A live property is a property that is determined and managed by the server. Each resource has a fixed number of live properties. For example, the live “getlastmodified” property presents the last modification time. This value is automatically updated by the server each time a resource changes. A dead property, on the other hand, is a property that is determined and managed by the user. The server only records the value of this property. For example, the dead “version” property contains the version of the current document. The user is responsible for updating the value of these properties.

 

PROPPATCH method

 

Let’s see how to set dead properties via JMeter.

 

Add a HTTP Request sample.

 

webdav load testing a guide

 

Fill in the following values:

  • Method: PROPPATCH
  • Path: your_path/blazefile.txt
  • Body Data:

<?xml version="1.0" encoding="utf-8" ?>
<D:propertyupdate xmlns:D="DAV:">
<D:set><D:prop><prop0 xmlns="https://www.blazemeter.com/">blazevalue0</prop0></D:prop></D:set>
<D:set><D:prop><prop1 xmlns="https://www.blazemeter.com/">blazevalue1</prop1></D:prop></D:set>
<D:set><D:prop><prop2 xmlns="https://www.blazemeter.com/">blazevalue2</prop2></D:prop></D:set>
</D:propertyupdate>

 

Run this request to assign three dead properties (prop0, prop1, prop2) to the blazefile.txt file.

 

PROPFIND method

 

Reading dead or live properties can be accomplished by using the PROPFIND request.

 

To read dead properties:

 

Add a HTTP Request sample.

 

jmeter webdav load testing

 

Fill in the following values:

  • Method: PROPFIND
  • Path: your_path/blazefile.txt
  • Body Data:

<?xml version="1.0" encoding="utf-8"?>
<propfind xmlns="DAV:"><prop>
<prop0 xmlns="https://www.blazemeter.com/"/>
<prop1 xmlns="https://www.blazemeter.com/"/>
<prop2 xmlns="https://www.blazemeter.com/"/>
</prop></propfind>

 

Execute the sample and see the response.

 

open source web dav load testing

 

The response contains a list of asked properties with their values.

 

To read live properties:

 

Add a HTTP Request sample.

 

jmeter , webdav, open source, load testing, guide

 

Fill in the following values:

  • Method: PROPFIND
  • Path: your_path/blazefile.txt
  • Body Data:

<?xml version="1.0" encoding="utf-8"?>
<propfind xmlns="DAV:"><prop>
<creationdate xmlns="DAV:"/>
<getlastmodified xmlns="DAV:"/>
<resourcetype xmlns="DAV:"/>
<supportedlock xmlns="DAV:"/>
<lockdiscovery xmlns="DAV:"/>
<getcontentlength xmlns="DAV:"/>
<getetag xmlns="DAV:"/>
<getcontentlanguage xmlns="DAV:"/>
<getcontenttype xmlns="DAV:"/>
<supportedlock xmlns="DAV:"/>
</prop></propfind>

 

Check the response after running the request.

 

jmeter webdav testing

 

The response contains all of the requested properties with the actual values.

 

Script and Test Run

 

Now let’s create a simple script to run a performance test on the WebDAV server to see how it goes. Download the JMX file from here.

 

Here is a short description of the test script:

  1. MKCOL: Create a ‘blazecollection’ collection
  2. PUT: Put 1MB file (‘blazefile.pdf’) to this collection
  3. PROPPATCH: Set dead properties to file ‘blazefile.pdf’
  4. PROPFIND: Get dead properties from the ‘blazefile.pdf’ file
  5. PROPFIND: Get live properties from the ‘blazefile.pdf’ file
  6. COPY:  Copy ‘blazefile.pdf’ file to ‘blazefile_copy.pdf’ file
  7. MOVE: Move ‘blazefile_copy.pdf’ to ‘blazefile_move.pdf’
  8. LOCK: Lock ‘blazefile.pdf’ file
  9. UNLOCK: Unlock ‘blazefile.pdf’ file
  10. DELETE: Delete ‘blazecollection’ collection

 

This script can be compiled from the samples that we learned in this blog post above with some minor changes. Collections should have unique names to avoid conflicts with other virtual users. This can be accomplished by adding the Thread Number to the name of each collection. An example of a collection name: blazecollection${__threadNum}.

 

I have created a Thread Group with the following parameters: Number of Threads is 10; Ramp-up period is 10 seconds; Loop count is 10. Let’s keep in mind that WebDAV service holders asked that we keep the load to a reasonable size.

 

guide to webdav load testing

 

The results of the test run are presented in the Aggregate Report below.

 

webdav, jmeter, how to

 

As you can see, we can draw some conclusions. This WebDAV server can work with 10 active users simultaneously. Uploading a 1MB file will take about 4 seconds. Locking is slower than unlocking, etc.

 

That’s it! Now you can start writing your own awesome WebDAV server script.

 

To learn more JMeter, check out our free JMeter academy with advanced and basic courses.

 

Click here to subscribe to our newsletter.

 

To try out BlazeMeter, which enhances JMeter abilities, put your URL or JMX file in the box below, and your test will start in minutes. You can also request a demo.

Interested in writing for our Blog? Send us a pitch!