Java Tutorial - Java Script :
Adding Assertions
If the test ran successfully, then you are ready to start adding to it. First, add an assertion. The assertion should be added to the HTTP Request node. The assertion will be applied to the response generated for the request. Assertions accept Perl-style regular expressions. If you want to check that the response contains a particular string you can add the string or a pattern that will match the string. For your test you will look for the title of the page. The title of the Tomcat root page is as follows:
<title>Jakarta Project - Tomcat</title>
You need to escape the greater than and less than signs, so when you add it into the patterns list you need to enter it as:
\<title\>Jakarta Project - Tomcat\<\/title\>
After this has been entered, select the TomcatUsers node again, and add an Assertion Results listener. Next, clear all of the data from the previous run by choosing Run ➪ Clear All, and then rerun the test. The results of the assertions will be displayed in the Assertion Results listener panel.
