This functionality is in beta stage

Recording

Loadcoder can generate performance tests from recorded user interactions in a web browser. This means that you can browse your way through the scenario you want to simulate in the performance test, and then instruct Loadcoder to generate Java code containing network calls corresponding to the ones made from the browser. Pretty cool, right?

The recording is actually not done by Loadcoder, but rather the browser some other program that manages the network calls, like a proxy for instance. Many browsers and proxies has the ability to log the network interaction that is taking place, and then save this log to .har file. This har file is then read be Loadcoder that interprets the content and then generates a load test.

Recording

Follow the below description of each step in how to perform the recording and generation

Record the har file

This section describes how to record a user web browser scenario and save to a har file

Choose browser

Even though the har file format is specified, it is up to the browser vendors how they are implemented. This means that the har file will look different depending on what browser you use, ultimately affecting your generated Load test. The browsers below have been evaluated and recommended in descending order

Perform the recording

Generate the LoadTest

The generation of a Loadcoder test is done by creating and using an instance of the class LoadcoderGeneratorBuilder.

Follow the below example to create a generator. Consult the Javadoc for details around the arguments.

import static com.loadcoder.statics.Statics.SECOND;
import java.util.Arrays;
import com.loadcoder.cluster.clients.influxdb.InfluxDBClient;
import com.loadcoder.network.LoadcoderGeneratorBuilder;

public class LoadcoderGenerator {

  public static void main(String[] args) {

      new LoadcoderGeneratorBuilder(
          "/path/to/recording.har",
          Arrays.asList("https://www.website.com", "https://another-site-to-loadtest.com"),
          "javapackage.for.generated.code", 
          "src/test/java/javapackage/for/generated/code", 
          "src/test/resources/generated-resources" 
          )
          .load(120 * SECOND, 3, 5)
          .sendResultTo(InfluxDBClient.influxReporter("WebSiteTests", "ShortLoadTest"))
          .checkResponseBodiesContaining(Arrays.asList("shoppingcart"))
          .generate();
      
  }
}

Finishing touches

The generated test should not be taken as finished, ready to execute load test. The generated code will be running, but in order to have it exactly as you like, you will need to go through the generated code and make it complete

Below is a list of things to migth want to adjust. You find the Java classes in the directory you specified in the generator