Verifying test accuracy

After having written a test and done all the necessary checks, it is necessary to make sure that, at least those cross-checks which we have explicitly assigned are working properly. The simplest way to get this done is to change the expected values to the opposite ones (or different ones) and launch the test again. Let's suppose that one of the working conditions of our tests is launching them on the 64-bit system, which is the first check we are making in our tests.

Getting ready

Write up the following function that checks the bit rate of the system:

function isWin64()
{
  aqObject.CompareProperty(Sys.OSInfo.Windows64bit, cmpEqual, true);
}

At the point of launching our test this check will successfully go over and in the log there will appear messages about the verified values.

How to do it...

To verify test accuracy, we will need to perform the following steps:

  1. Change the expected value to a different one. In our case, we will replace true with false:
    aqObject.CompareProperty(Sys.OSInfo.Windows64bit, cmpEqual, false);
  2. Now, we will launch our test and make sure that in the log we indeed receive the warning or an error message, as initially intended by test conditions.
  3. If no error message or a warning appears in the log, this means that the check has not worked correctly (for example, a wrong property or controls element has been selected for the check); and we should make the necessary changes in the test.

How it works...

We check all the checkpoints throughout the test in the same way, after which the test can be added to the testing plan for routine launches. This ought to be done in order to verify that the checks in the test are working properly, concordant to the original intent at creation. It is also possible to emulate other situations (for example, as the test is working, close the window manually (the one the test is checking) and see that the log has a clearly generated entry about the error). If these checks are not being done, it may turn out that the created tests never generate error messages, even though there are errors to be found in the application. We have no use for such tests.

Note

After all the undertaken checks, correct values should be returned in the result!

See also

Checkpoints are explained in details in the following recipes:

  • The Creating property checkpoints recipe in Chapter 3, Scripting
  • The Creating object checkpoints recipe in Chapter 3, Scripting
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.130.199