JM Assertions

Checking Assertions and Pass/Fail the Build

I’ve added an important step here that takes us away from the happy path and towards real performance issues. As time progresses using this solution, more of these steps may be needed. The performance test analyst must keep an eye on this and adjust his models and solutions for each particular project.

Here, I have added a method to check for text in responses and report results back up to Jenkins. It is recommended that you check for text as far down the response as possible but that text must be unique to the response coming back correctly i.e. don’t just check for ‘</body>’ (!)

The assertion-check.sh script will then count the true and false assertions and report back to Jenkins based on a percentage pass limit that you can set.

To use this feature, add a response assertion and an assertion results listener:

assertions1

assertions2

Follow the JMeter rules for assertion placement and follow the guidelines for this solution. Namely:

    1. The filename must contain ‘results’ (as we use the results collation routine, see here)

    2. The filename must end in .csv

    3. DO NOT have different assertions with sub names based on others. e.g. you cannot have ‘results-assertion-tags’ AND ‘results-assertion-tags-scala’.

    4. Do not select the option ‘Save As XML’

Running a test from Jenkins now adds extra config lines for checking any assertions required. See the last two lines here:

assertions4

The assertion-check.sh script will then count the number of lines in the collated assertion results file that contain ‘true’ and ‘false’. (Because of this, do not include ‘true’ or ‘false’ in any of your jmeter step descriptions etc. (!)):

assertions3

The script will echo results back to the screen and it will build a bespoke jtl file that produces graphs in Jenkins. The only slight pain is that the Jenkins graphs are not highly configurable and they are titled ‘Responding time’ but that will just need explaining to your users - we are actually plotting percentage passes of the assertions:

assertions5

assertions6

[Home] [About (CV)] [Contact Us] [JMeter Cloud] [JM Highlights] [JM Overview] [JM Control] [JM Inject] [JM Threads] [JM Results] [JM Assertions] [JM TPS] [JM Metrics] [JM Runtime] [JM Collation] [JM Logs] [JM 95th] [JM 95th v2] [JM Jenkins] [JM Corporate] [JM Scripts] [JM Variables] [JM Embedded] [JM Hosts] [JM Running] [JM Example] [JM Versions] [webPageTest] [_64 images] [asset moniitor] [Linux Monitor] [Splunk ETL] [Splunk API] [AWS bash] [LR Rules OK] [LR Slave] [LR CI Graphs] [LoadRunner CI] [LR CI Variables] [LR Bamboo] [LR Methods] [LR CI BASH] [Bash methods] [Jenkins V2] [Streaming vid] [How fast] [Finding Issues] [Reporting] [Hand over] [VB Scripts] [JMeter tips] [JMeter RAW] [Dynatrace] [Documents] [FAQ] [Legal]

In the Cartesian Elements Ltd group of companies