NIHVIVO-1129 First stab at a load-testing framework.
This commit is contained in:
parent
e8d37f9a88
commit
018f26a712
7 changed files with 599 additions and 0 deletions
128
utilities/load-testing/build.xml
Normal file
128
utilities/load-testing/build.xml
Normal file
|
@ -0,0 +1,128 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<!-- ======================================================================
|
||||
|
||||
vivoLoadTesting
|
||||
Run JMeter tests and summarize the results.
|
||||
|
||||
====================================================================== -->
|
||||
<project name="vivoLoadTesting" default="describe">
|
||||
<description>
|
||||
Run JMeter tests and summarize the results.
|
||||
</description>
|
||||
|
||||
<taskdef name="jmeter"
|
||||
classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask"
|
||||
classpath="lib/ant-jmeter-1.0.9.jar" />
|
||||
|
||||
<!-- =================================
|
||||
target: describe
|
||||
================================= -->
|
||||
<target name="describe" description="--> Describe the targets (this is the default).">
|
||||
<echo>
|
||||
all - Run the tests and summarize the output.
|
||||
clean - Remove any existing output and summaries.
|
||||
run - Just run the tests.
|
||||
report - Just summarize output from previously run tests.
|
||||
</echo>
|
||||
</target>
|
||||
|
||||
<!-- =================================
|
||||
target: all
|
||||
================================= -->
|
||||
<target name="all"
|
||||
depends="clean, run, report"
|
||||
description="--> Run the tests and summarize the output." />
|
||||
|
||||
<!-- =================================
|
||||
target: clean
|
||||
================================= -->
|
||||
<target name="clean"
|
||||
depends="properties"
|
||||
description="--> Remove any existing output and summaries.">
|
||||
<delete dir="${results.dir}" />
|
||||
</target>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - -
|
||||
target: properties
|
||||
- - - - - - - - - - - - - - - - - -->
|
||||
<target name="properties">
|
||||
<property name="test.name" value="firstTest" />
|
||||
<property name="tests.dir" value="tests" />
|
||||
<property name="results.dir" value=".results" />
|
||||
|
||||
<property name="properties.file" location="loadtesting.properties" />
|
||||
|
||||
<fail message="You must create a "${properties.file}" file.">
|
||||
<condition>
|
||||
<not>
|
||||
<available file="${properties.file}" />
|
||||
</not>
|
||||
</condition>
|
||||
</fail>
|
||||
|
||||
<property file="${properties.file}" />
|
||||
|
||||
<fail unless="jmeter.home.dir"
|
||||
message="${properties.file} must contain a value for jmeter.home.dir" />
|
||||
<fail unless="webapp.host"
|
||||
message="${properties.file} must contain a value for webapp.host" />
|
||||
<fail unless="webapp.port"
|
||||
message="${properties.file} must contain a value for webapp.port" />
|
||||
<fail unless="webapp.name"
|
||||
message="${properties.file} must contain a value for webapp.name" />
|
||||
|
||||
<property name="webapp.url" value="http://${webapp.host}:${webapp.port}/${webapp.name}" />
|
||||
</target>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - -
|
||||
target: prepare
|
||||
- - - - - - - - - - - - - - - - - -->
|
||||
<target name="prepare" depends="properties">
|
||||
<mkdir dir="${results.dir}" />
|
||||
</target>
|
||||
|
||||
<!-- =================================
|
||||
target: run
|
||||
================================= -->
|
||||
<target name="run" depends="prepare" description="--> Just run the tests.">
|
||||
<delete file="${results.dir}/${test.name}.jtl" />
|
||||
<delete file="${results.dir}/${test.name}.html" />
|
||||
|
||||
<condition property="webapp.is.available">
|
||||
<http url="${webapp.url}" />
|
||||
</condition>
|
||||
<fail unless="webapp.is.available" message="Webapp is not available at ${webapp.url}" />
|
||||
|
||||
<jmeter jmeterhome="${jmeter.home.dir}"
|
||||
testplan="${tests.dir}/${test.name}.jmx"
|
||||
resultlogdir="${results.dir}">
|
||||
<!-- Set parameters for the tests -->
|
||||
<property name="webapp.host" value="${webapp.host}" />
|
||||
<property name="webapp.port" value="${webapp.port}" />
|
||||
<property name="webapp.name" value="${webapp.name}" />
|
||||
|
||||
<!-- Set parameters for the output -->
|
||||
<property name="jmeter.save.saveservice.output_format" value="xml" />
|
||||
<property name="jmeter.save.saveservice.response_data.on_error" value="true" />
|
||||
<property name="jmeter.save.saveservice.url" value="true" />
|
||||
<property name="jmeter.save.saveservice.bytes" value="true" />
|
||||
|
||||
<!-- Show a summary line periodically, so we know its running. -->
|
||||
<property name="summariser.name" value="summary" />
|
||||
<property name="summariser.out" value="true" />
|
||||
<property name="summariser.log" value="true" />
|
||||
<property name="summariser.interval" value="5" />
|
||||
</jmeter>
|
||||
</target>
|
||||
|
||||
<!-- =================================
|
||||
target: report
|
||||
================================= -->
|
||||
<target name="report" depends="prepare" description="--> Just summarize the output.">
|
||||
<xslt in="${results.dir}/${test.name}.jtl"
|
||||
out="${results.dir}/${test.name}.html"
|
||||
style="jmeter-results-report.xsl" />
|
||||
</target>
|
||||
</project>
|
Loading…
Add table
Add a link
Reference in a new issue