Testing non-nominal behavior

When performing your functional tests, you will have to set up checks that correspond to the correct functioning of your application, by checking that the elements that must be displayed are correct. Generally it is quite simple when the software works in a nominal way because you only have to select the elements that you need.

In some cases, it is also necessary to check that non-nominal operation cases do not occur. And it can be difficult to replicate this type of failure case when the software is running in a nominal way.

How to test non-nominal behavior

We will see a tip that is not usable in all cases, but that can help you in certain situations.

In our example, the page we are going to test must display a pdf file. In nominal mode this file is displayed using the internal viewer of your web browser. The code used is similar to this one:

<object data="agilitest.pdf" type="application/pdf">

In nominal mode you get the following result:

Viewing a native pdf in Chrome

When viewing a pdf file produced by an application which may be different from one case to the next, it can be very difficult to verify that the pdf is displayed well: the content may be totally different from one publication to another and sometimes you do not really know what to look for.

It becomes interesting to check that the case of non-display of the pdf does not occur. But here it is: how to simulate it if my page works correctly.

The trick is to go directly edit the page in Chrome to tell him to open a pdf document that does not exist.

Just click on F12 to display the HTML code of the page:

Opening the HTML code edition in Chrome

The code displayed is as follows:

<div align="middle">
<object data="agilitest.pdf" type="application/pdf">
<iframe src="">

Then just change the name of the file, for example by adding a letter and press ENTER: Chrome will interpret the new code and display the result: This display corresponds to the one you will get when the pdf file is not correctly generated and is not available.

Result displayed when the file is not found

You just have to do a graphical control on a part of this display representative of an error case:

Switch to capture mode and select a portion of the displayed message, then drop it into Agilitest to create a check on occurences

Be sure to set that the number of occurrences of the image must be zero which corresponds to nominal result.

In this particular example, we used graphic recognition because we want to control the display of an internal pdf viewer to Chrome. It is possible that for your particular cases, you can treat this final control only with internal elements, (DOM or structure of your Android or iOS application) displayed in a nice error popup.

If you want to practice, you can use the following page:

Still require support?
Contact support