jmeter.jmeter-java-dsl.1.29.1.source-code.TestClass.template Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmeter-java-dsl Show documentation
Show all versions of jmeter-java-dsl Show documentation
Simple API to run JMeter performance tests in an VCS and programmers friendly way.
///usr/bin/env jbang "$0" "$@" ; exit $?
/*
These commented lines make the class executable if you have jbang installed by making the file
executable (eg: chmod +x ./PerformanceTest.java) and just executing it with ./PerformanceTest.java
*/
{{dependencies}}
{{staticImports}}
{{imports}}
public class PerformanceTest {
{{methodDefinitions}}
@Test
public void test() throws IOException {
TestPlanStats stats = {{testPlan}}.run();
assertThat(stats.overall().errorsCount()).isEqualTo(0);
}
/*
This method is only included to make the test class self-executable. You can remove it when
executing tests with maven, gradle, or some other tool.
*/
public static void main(String[] args) {
SummaryGeneratingListener summaryListener = new SummaryGeneratingListener();
LauncherFactory.create()
.execute(LauncherDiscoveryRequestBuilder.request()
.selectors(DiscoverySelectors.selectClass(PerformanceTest.class))
.build(),
summaryListener);
TestExecutionSummary summary = summaryListener.getSummary();
summary.printFailuresTo(new PrintWriter(System.err));
System.exit(summary.getTotalFailureCount() > 0 ? 1 : 0);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy