Adding and Configuring New Agents
In this short tutorial, we show how to quickly implement a simple browser-based load test based on Cypress scripts in Step.
Step’s architecture allows for the dynamic registration of agents. It is designed to handle hundreds of agents, enabling the execution of keywords at a high rate. Different types of agents have been released in order to support tight integration with different runtimes. For example, DLL-based keywords can run on the .NET agent, while a Node.js project can be executed on Step’s node agent.
Step’s default routing will guarantee a natural affinity between a keyword’s given type and the agent on which this keyword’s execution will occur. However, users can define arbitrary affinity patterns allowing for further customization. For example, one may decide to assign a specific set of agents to a group that will work in isolation from the other agents, depending on contextual information provided at runtime.
In this tutorial, we will cover the configuration of an agent and how to design groups based on affinity patterns. We will also look at the different options users have to design and implement complex keyword routing rules.
Configuration file
All of Step’s agents use the same type configuration file - AgentConf.json - which should look similar to this by default:
{
"gridHost":"http://localhost:8081",
"registrationPeriod":1000,
"workingDir":"../work",
"tokenGroups":[
{"capacity":10,
"tokenConf":{
"attributes":{ "myAffinityCriterion1" : "myAffinityValue1"},
"properties": {
"myProp1": "myValue1"
}}
}
],
"properties":{
"myProp1":"myDefaultValue",
"myProp2":"myValue2",
"plugins.jmeter.home":"../ext/lib/jmeter",
"plugins.selenium.libs.2.x":"../ext/lib/selenium/selenium-2.53.1",
"plugins.selenium.libs.3.x":"../ext/lib/selenium/selenium-java-3.0.1"}
}
You are probably already familiar with the gridHost parameter, which allows the agent to connect and register against a controller.
The tokenGroups parameter exposes a collection of pools that can be tagged with different key-values (via the properties sub-map).
- The sub-map, called attributes, can be used to tag a certain pool with key-values and allows for a distinction between this pool and other pools belonging to the same agent, or to other agents from the same technical type.
- The sub-map called properties allows users to set specific property values which will only be visible in the context of a token originating from this pool.
- This means that keywords may “see” different property values depending on which token they end up being executed on.
The capacity parameter determines how many “tokens” (i.e keyword execution slots) will be made available in the corresponding pool upon starting the agent.
Note Not to enable more tokens than the underlying host is capable of servicing based on its allocated infrastructure resources (CPU, Mem, I/O…).
Lastly, a separate properties map allows the declaration of global agent properties which are made accessible to keywords and will look the same to every keyword executing on the agent, assuming the property is not overridden within the property map of the pool.
Token Pool Attributes
In the sample file provided above, the attribute “myAffinityCriterion1” is set on the only pool which has been configured, and the value “myAffinityValue1” has been assigned to it. This means that keywords may or may not be routed to this token pool depending on selection criteria which will be evaluated at runtime.
These criteria can be decided either by setting the corresponding variable in the plan, in the Routing map of a CallKeyword instance or of a Session instance, or via the route_to_XYZ variable, which can itself be set as a parameter and be manipulated dynamically.
Token Pool properties
In the sample file provided above, the dummy property “myProp1” is set on the only pool which has been configured, and it takes the value “myValue1”. This means that keywords running in the context of tokens belonging to this pool will see this value when accessing the property:
properties.get("myProp1");
// myValue1
Routing examples
Assuming that in the following examples we have installed and started two agent pools (which may or may not be running on the same agent and/or host) using the attribute “myAffinityCriterion1” as a distinguishing criterion. Values “myAffinityValue1” and “myAffinityValue2” have been assigned respectively to token pools 1 & 2.
Explicit keyword routing
Both the CallKeyword (i.e the underlying object created when using a keyword in a plan) and Session artifacts showcase a section called “Keyword routing”. This section exposes a map of desired attributes which will be matched at runtime against the actual attributes of the tokens available for selection.
If we set our criterion “myAffinityCriterion1” to the value “myAffinityValue2”, then this keyword’s execution will only be able to take place on the corresponding pool and agent:
Upon execution, the details pane confirms this. If you look at the url of the agent taking care of the execution, you will see that it is the url of agent 2, as expected:
Implicit routing
The same result can be achieved using the reserved variable routeto. This variable can be set as a central parameter and overridden in a plan where necessary.
After removing the explicit routing key and value from our keyword call, we’ll apply a similar constraint with the routeto variable by appending the criterion to its name and setting the value as a parameter value.
Reminder, the execution will take place on agent 2
Let’s now override this value from within the plan by using a set artifact from within the plan, just before the keyword is effectively called.
This time, the execution took place on agent 1.
Summary: This article details the configuration of an agent, as well as how to design groups based on affinity patterns; it also lists the different options users have to design and implement complex keyword routing rules.
This article demonstrates how to connect Grafana to data generated by Step.
This article demonstrates how to set up distributed system monitoring using Keyword executions, and analyze the results as measurements.
This tutorial demonstrates how to automate interaction with Microsoft Office applications using the Office Interop Assembly.
This article provides documentation for how to integrate JUnit tests into Step.
This tutorial demonstrates how Step can be used to monitor services, availability and performance metrics.
This tutorial demonstrates how to utilize the AutoIt C# binding to automate interactions with Windows applications.
This article demonstrates the automation of mobile applications on Android using the Appium framework.
This article defines three Keywords which will be used in browser-based automation scenarios, using Step and Selenium, as general drivers.
This tutorial shows you how to efficiently set up a browser-based load test using existing Cypress tests in the Step automation platform.
This tutorial shows you how to set up a browser-based load test using existing Playwright tests in the Step UI.
This article explains Keywords in Step and demonstrates how to create simple ones.
This tutorial demonstrates the design, execution, and analysis of functional tests using the web interface of Step.
This tutorial will demonstrate how to use Step and Selenium to automate various browser tasks.
This tutorial demonstrates how to use Step and Cypress to automate various browser tasks.
This tutorial demonstrates how Selenium automation tests can be turned into full synthetic monitoring using Step.
In this tutorial, you'll learn how to reuse existing Cypress tests to quickly set up and run a browser-based load test using the automation as code approach.
In this tutorial, you'll learn how to reuse existing tests written with Serenity BDD and Cucumber for load testing.
This tutorial demonstrates how Cypress automation tests can be turned into full synthetic monitoring using the automation as code approach.
In this tutorial, you'll learn how to reuse existing Cypress tests to quickly set up and run a browser-based load test using the Step UI.
This tutorial demonstrates how to leverage existing Selenium tests to set up and execute browser-based load tests, following a full code-based approach.
This tutorial demonstrates how to set up a browser-based load test in the Step UI using existing Selenium tests.
This tutorial demonstrates how Playwright automation tests can be turned into full synthetic monitoring using Step.
This tutorial demonstrates how Cypress automation tests can be turned into full synthetic monitoring using the Step UI.
This tutorial will demonstrate how to use Step and Playwright to automate various browser tasks.
In this tutorial, you'll learn how to reuse existing Playwright tests written in Java to quickly set up and run a browser-based load test using the automation as code approach.
Quickly integrate K6 based load-tests in your DevOps workflow
This tutorial demonstrates how Playwright tests can be reused for synthetic monitoring of a productive environment in a DevOps workflow
This tutorial demonstrates how Playwright tests can be reused for synthetic monitoring of a productive environment in a DevOps workflow
In this tutorial you'll learn how to quickly set up a protocol-based load test with okhttp
Learn how to set up continuous end-to-end testing across several applications based on Playwright tests in your DevOps pipeline using Step
Learn how to quickly set up continuous browser-based load testing using Playwright tests in your DevOps pipeline
Want to hear our latest updates about automation?
Don't miss out on our regular blog posts - Subscribe now!