Targets

A target specifies the endpoint you want to test.

Each test case has to have at least one target. A target specifies the endpoint you want to test, including the host name, port and protocol (http or https). The targets must be publicly reachable via HTTP by our clusters.

A target has to be a valid hostname. If provided with an URL, we will extract the hostname from it and ignore the rest. The following examples are referring to the same target:

// Valid targets definitions
definition.addTarget("api.example.com");
definition.addTarget("http://api.example.com:8080");
definition.addTarget("https://api.example.com/path/to/resource");

Defining Targets

You can provide targets using definition.addTarget(), definition.setTarget() or definition.setTargets() as follows:

definition.addTarget("https://api.example.com");
definition.addTarget("https://api2.example.com:8081");
// or
definition.setTarget("https://api.example.com");
// or
definition.setTargets(["https://api.example.com", "https://api2.example.com:8081"]);

Please note that the last two variants overwrite any previously specified targets.

NOTE: If you define multiple targets, you need to specify the full URL as part of your request:

definition.session("index", function(session) {
  session.get("https://otherapi.example.com/index");
});

Defining HTTPS targets

Performance Testing assumes a HTTP target if no protocol is specified. If you want to test a HTTPS target, you have to specify the https:// protocol in the target or use full URLs for all request definitions.

Relative URLs

If you define only one target in your test case, you can drop the hostname in your URLs:

definition.setTarget("https://api.example.com");
definition.session("index", function(session) {
  session.get("/index");
});
Last modified November 16, 2022