Validations

As a web application developer or tester, you will design (or test) your application based on a 'valid' set of responses expected from the application. You can set these validations for each web page after you have recorded the test. This feature is highly useful for regression testing.

To add validation for any URL, select the URL node in the Editor tree and on right hand side select the Validations tab. You will find the DOM tree of the stored response at top. Right click on the DOM element node for which you need to add validation and select the required option from the popup menu. Following are the different kinds of validations which are supported :

Page Validation:

You can add Page Validation by selecting the root node in the DOM tree and clicking the Add Validation... option from the popup menu. This kind of validation is done by parsing the complete page. You can validate following :

Text Validation:

To find if a particular text or value is present on the page or not you can use this validation. Click the "Add Text Validation..." option from the popup menu on the DOM tree to access the Text Validation Setting dialog box. Here you can set the following:

Description: Provide the description of the text validation here. It should be as informative as possible explaining the purpose of the validation.

Fetch Text present between: Provide surrounding values for text you want to search in the page. for e.g. say you have multiple occurrences of word "Support" in the page but you need to check against only that value which exists between "AppPerfect" and "Team", then you can provide "AppPerfect" and "Team" as the two words between which the search for "Support" should be done. This validation will be successful only if you have "AppPerfect Support Team" present on the page.

Text Not Exists: This option should be selected to negate the search result. If this checkbox is selected application will report success only if text to search is not present in the page.

Case Sensitive: This option should be selected in case you need case-sensitive search for the text.

Regular Expression: We use jregex for pattern matching for search string. Please check the docs for same at http://jregex.sourceforge.net/doc-index.html having all the required details for the patterns you can use for string matching.

Check For: Here you can provide the text to search or validate. You can provide Exact Match value or multiple list of values which should be checked. If you want to parameterize text then specify the Test Parameter Name between @..@ and configure that Test Parameter in Parameters view.

Attribute Validation:

You can add Attribute Validation by selecting the element node in the DOM tree and clicking the Add Validation... option from the popup menu. This is useful in case you need to validate properties like innerText or value etc. of specific HTML element in page

Date Validation:

Here you can compare the date value present on page against today's date in different formats. Click the "Add Date Validation..." option from the popup menu on the DOM tree to access Date Validation Settings. In case of Date validation application looks for date string in the response and decides success or failure based on that, meaning say today's date is July 8, 2008 then application will look for string 08/07/2008 in case of format dd/MM/yyyy and 07/08/08 in case of MM/dd/yy. If exact matching string is not found that application will treat validation as failure.

Database Query Validation:

Here you can validate if the ResultSet returned as a result of query execution is empty or not. Click the "Add Database Query Validation..." option from the popup menu on the DOM tree to access Database Query Validation Settings. If this option is disabled, you need to configure a Database with AppPerfect Load Test. Select Tools -> Options -> Browsers, JDKs & DBs and configure Database setting there. Once you configure the database you will find the "Add Database Query Validation..." option enabled. Select "Add Database query validation..." option and you will get a dialog where you can enter an SQL query that you want to validate. If result set returned as a result of query execution is empty then application will treat validation as failure.

Custom Validation:

Apart from validations explained above, In case you need to perform any custom validation on Web Page you can do so using scripting. AppPerfect stores recorded test as JavaScript and one can add custom code to the test script to perform any custom URL or database validation. We support custom scripting apis, using which you can parse the response and fetch appropriate fields from the response page and validate it against the required value. You can also use scripting apis to fire any database query and perform the required validation by fetching the required data using the result set. Please refer to Customizing Test Script chapter for more details.