Try to execute the JMeter test script (the JMX file) in FitNesse.
1. Create a JMX file.
2. Create a Java class aim for FitNesse test. Extending ColumnFixture (http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.FitFramework.ColumnFixture) for its ease of use.
3. Since JMeter does not stored the Assertion Result,
create a SamplerListener class extending Visualizer (https://jmeter.apache.org/api/org/apache/jmeter/visualizers/Visualizer.html) and
add to all the ResultCollector (https://jmeter.apache.org/api/org/apache/jmeter/reporters/ResultCollector.html)
with #setListener method (https://jmeter.apache.org/api/org/apache/jmeter/reporters/AbstractListenerElement.html#setListener-org.apache.jmeter.visualizers.Visualizer-).
The SamplerListener#isAllAssertionPassed will return false when there is any sampler evaluated as false (either error or failure).
e.g.
SearchByClass samplerSearch = new SearchByClass(ResultCollection.class);
testPlanHashTree.traverse(samplerSearch);
Collection samplers = samplerSearch.getSearchResults();
for (ResultCollection sampler : samplers.toArray()[0]) {
sampler.setListener(samplerListener);
}
Notes:
for easier debug, can modify the sampler output file path to the FitNesse environment that the details sampler output can be downloaded from FitNesse directly.
4. Prepare a jmeter.properties to be used by JMeter runtime under FitNesse environment.
5. Add a Test in FitNesse, i.e.
| !Test.JMeterTest |
| propertyFilePath | jmxFilePath | isAllAssertionPassed? |
| /tmp/jmeter.properties | /tmp/jmeter-test.jmx | true |
Reference
1. Create a JMX file.
2. Create a Java class aim for FitNesse test. Extending ColumnFixture (http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.FitFramework.ColumnFixture) for its ease of use.
3. Since JMeter does not stored the Assertion Result,
create a SamplerListener class extending Visualizer (https://jmeter.apache.org/api/org/apache/jmeter/visualizers/Visualizer.html) and
add to all the ResultCollector (https://jmeter.apache.org/api/org/apache/jmeter/reporters/ResultCollector.html)
with #setListener method (https://jmeter.apache.org/api/org/apache/jmeter/reporters/AbstractListenerElement.html#setListener-org.apache.jmeter.visualizers.Visualizer-).
The SamplerListener#isAllAssertionPassed will return false when there is any sampler evaluated as false (either error or failure).
e.g.
SearchByClass samplerSearch = new SearchByClass(ResultCollection.class);
testPlanHashTree.traverse(samplerSearch);
Collection samplers = samplerSearch.getSearchResults();
for (ResultCollection sampler : samplers.toArray()[0]) {
sampler.setListener(samplerListener);
}
Notes:
for easier debug, can modify the sampler output file path to the FitNesse environment that the details sampler output can be downloaded from FitNesse directly.
4. Prepare a jmeter.properties to be used by JMeter runtime under FitNesse environment.
5. Add a Test in FitNesse, i.e.
| !Test.JMeterTest |
| propertyFilePath | jmxFilePath | isAllAssertionPassed? |
| /tmp/jmeter.properties | /tmp/jmeter-test.jmx | true |
Reference
- A Test Developer's blog: Jmeter, https://shantonusarker.blogspot.com/p/jmeter.html .
- Selenium with FitNesse – Acceptance testing Framework – Assert Selenium, 2012 Nov 10, http://www.assertselenium.com/atdd/selenium-fitnesse/ .
- How to Use JMeter Assertions in Three Easy Steps, BlazeMeter, 2016 Jun 10, https://www.blazemeter.com/blog/how-use-jmeter-assertions-3-easy-steps .
Comments