JUnit Plan Runner
This article provides documentation for how to integrate JUnit tests into Step.
Step includes a JUnit runner that can be used to seamlessly integrate Step plans into JUnit tests.
Sample output
Below is an example of what the output of using this feature may look like.
The sections below refer to the structure and files shown in the screenshot above. Note that the code examples are intentionally concise as they are only meant to showcase the syntax and usage.
Maven dependency
<dependency>
<groupId>ch.exense.step</groupId>
<artifactId>step-junit</artifactId>
<version>3.14.0</version>
</dependency>
Inline plan definitions
Below is a simple example which uses the Step JUnit runner to run a plan defined directly inside the Test file:
package com.example.step.junit.ex1;
import org.junit.runner.RunWith;
import step.junit.runner.Step;
import step.junit.runners.annotations.Plan;
@RunWith(Step.class) // (1)
public class ExampleTest1 {
@Plan("Sequence\nEcho \"OK\"\nEnd") // (2)
public void inlinePlan() {
}
}
Notice how 1. We are using the @RunWith(Step.class) annotation on the class to define the JUnit runner used for executing the entire Test class and 2. How the actual plan to be executed is declared in the @Plan annotation of the test method.
Selective inclusion of plans and parameterization
Although inlining plan definitions are a quick and easy way to run plans as JUnit test cases, it is only suitable for very short definitions.
The Step JUnit runner features a mechanism to automatically create test cases when the following conditions are met:
- The plan is defined in the @Plans annotations
- The plan definitions are located in the resources subdirectory matching the package of the JUnit test
The test class below shows how to include specific (external) plans and how to define execution parameters:
package com.example.step.junit.ex2;
import org.junit.runner.RunWith;
import step.junit.runner.Step;
import step.junit.runners.annotations.ExecutionParameters;
import step.junit.runners.annotations.Plans;
@RunWith(Step.class)
@Plans({"keyword_and_params.plan"})
@ExecutionParameters({"INPUT_PARAMETER", "Example"})
public class ExampleTest2 {
}
Below is the content of the keyword_and_params.plan:
Sequence
Echo "${INPUT_PARAMETER} exists"
CustomKeyword
End
This plan will only execute correctly if
- The parameter INPUT_PARAMETER is defined using the @ExecutionParameters annotation
- The CustomKeyword keyword is found in the same package as the plan and Test class
Below is the trivial implementation of the keyword:
package com.example.step.junit.ex2;
import step.handlers.javahandler.AbstractKeyword;
import step.handlers.javahandler.Keyword;
public class Keywords extends AbstractKeyword {
@Keyword
public void CustomKeyword() {
System.out.println("CustomKeyword called.");
}
}
Summary: This article provides documentation for how to integrate JUnit tests into Step.
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 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.
In this short tutorial, we show how to quickly implement a simple browser-based load test based on Cypress scripts in Step.
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!