Apache JMeter can be used to help you regression test your application by letting you create test scripts with assertions to validate that your application is returning the results you expect. These assertions allow you to assert facts about responses received from the server being tested. For instance, you can assert that the response to a query will contain some particular pattern that can be either be:
a “string” for “Equals” or “Substring” clauses
a “Perl5-style” Regular Expression for “Contains” or “Matches” clauses
One necessary step is using JS233 Assertions is setting variables for use in the assertions which is done separately in a JSON Path Extractor to extract values from JSON responses using JSONPath syntax.
var subtotal = vars.get("subtotal");
Two other useful Jmeter functions available to your script are part of the AssertionResult class :
AssertionResult.setFailureMessage(String); Set the failure message giving more details about a failure or error.
AssertionResult.setFailure(boolean); Set the flag indicating whether or not a failure occurred.
A Best Practice would be to include the description (and feature or bug name) in the comments to understand why the test is needed.
To installing JMeter with all the needed plugins on Mac OSX :
$brew install jmeter --with-plugins
and if you need to install java (so sad) on OSX Yosemite :
$brew tap caskroom/cask
$brew install brew-cask
$brew cask install java
after which you may need to uninstall (via brew) and re-install jmeter.
Soon, I hope and Api Garage will replace my need for Jmeter. Soon!