Problems or errors occurring during the execution of a test scenario will bias your results, making them partially or -at worst- completely unusable. It is therefore fundamental to make sure that errors occurring during a scenario be clearly identified and traced. NeoLoad automatically identifies and reports HTTP-related errors or severe errors due to networking or application failures. However, NeoLoad cannot identify errors due to application logic, but provides a powerful validating mechanism that will let you locate unexpected or erroneous behavior. An application logic error can trigger chain reactions that could, in the end, cause an HTTP error: catching application errors as soon as they appear will make it much easier to understand and analyze the problem. The sooner an erroneous behavior is identified and traced, the quicker the resolution will be. Because NeoLoad provides mechanisms to validate application behavior, this technique can, to some extent, be used to achieve functional testing.
Finally, from a purely load testing point of view, it is also important to identify pages that are time costly. This section describes how to check that an HTTP response does not exceed a certain amount of time. This is consistent with non-functional requirements that are often expressed by users or clients and that you must ensure.
NeoLoad validations are expressed either for each HTTP request or for each Container or Virtual User. For more information, see Global Validation. The validation mechanism allows you to set conditions that must be met by the HTTP response to a specific HTTP request . NeoLoad provides three types of criteria by which validations can be expressed: time, content size and, lastly, the response content itself. This tutorial describes how these three criteria can be added and configured. It also shows you how to test your validations and where to configure NeoLoad behavior in the event the validation fails.
The example relies on the very simple HTML source code that follows
<HTML>
<BODY>
<H1>Order references</H1>
<P> Thank you, your order has
been successfully submitted :
<B>#I45-020206-45RT347</B>
</P>
<BODY>
</HTML>
You may want your validation to apply to the contents of the HTTP response making sure that an order identifier has been correctly returned and also checking that the format of the order identifier is correct. The second validation will apply to a non-functional requirement: confirming and placing the order is a resource-greedy and time-consuming operation, you may want to make sure the response time does not exceed 2 seconds.
/loadtest/validation
request. An HTML page most of the time is composed of several HTTP requests (images, .css files, and so on). In the example, the page only has one request and you will be validating the response to that request.In the example the contents of the response is simple and short but a realistic response could be much longer. You can search for specific text by right-clicking in the contents panel and selecting the Search option or using the CTRL+F shortcut keys. This will open a search panel at the bottom of the dialog box in which you can enter the target text and search for occurrences of that text.
In the example, you may want to match the order id. This identifier is made up of three distinct parts:
A prefix, such as #I45, always starting with the character # and followed by a sequence of exactly three letters or digits. You use the #(.{3}) regular expression to match this part. The parentheses are used for grouping an expression. The dot character matches any character other than the new line character. The {3} expression indicates that there are exactly three characters other than the new line character.
A middle part, such as -020206, starting with a dash and followed by a sequence of exactly six digits. You use the -(\d{6}) regular expression to match this part. The \d matches any digit and the {6} says there are exactly 6 digits. You could have refined this expression to match a date and force the month and day parts to match only consistent values.
A suffix, such as -45RT347, starting with a dash and followed by a sequence of exactly seven letters or digits. You use the -(.{7}) regular expression to match this part. You could obviously improve this regular expression by being much more precise and forcing your expression to match a set of uppercase characters or digits. In this case you would use the following expression ([A-Z|0-9]{7}) , where the A-Z sub-expression matches any character from A to Z, 0-9 matches all the digits from 0 to 9 and the | between the two sub-expressions indicates that one of the sub-expressions must match. Finally, the square brackets define a character range. For this example you will keep to the simpler form.
NeoLoad has highlighted the content that matches the regular expression you have defined.
In the example the contents of the response is simple and short but a realistic response could be much longer. You can search for specific text by right-clicking in the contents panel and selecting the Search option or using the CTRL + F shortcut keys. This will open a search panel at the bottom of the dialog box in which you can enter the target text and search for occurrences of that text.
The validation is now configured. To quickly and easily spot requests that have associated validations, select your Virtual User, right-click on its node and select the Flag requests item. NeoLoad adds a check mark to all the nodes (records, HTML pages and HTTP requests) in the User Paths using validations.
NeoLoad displays all the pages and requests that have been played back during the test. In this case all has gone well and no assertions have failed. This does not completely guarantee that your validations have been correctly configured, but it does give you a good indication.
For example, you may have decided to abort Virtual User execution when both errors and assertion failures occur. Errors are HTTP errors, such as 404 Page Not Found
errors. They are automatically detected by NeoLoad.
For more information about creating Virtual Users, see Virtual Users.
For more information about regular expressions, see Regular expressions.