Blog
Tutorial(Pitalium: hifive regression test library) » 08.Redefining of Correct Images

08.Redefining of Correct Images

Last modified by ishikawa on 2016/03/30, 14:30

This chapter shows how to deal with the change of appearance caused by modification of the application.

Redefinition of the Expected Image

Check and Analyze the Results of Failed Tests

When you modify your target application that causes change in appearance and rerun Pitalium tests. they of course fail because the result images are different.

The solution depends on the type of modification you made.
Possible cases are like below.

  • The modification has no effect on the test scenario(e.g. The font size is slightly changed)
  • The modification affect the test scenario(e.g. A new UI Element has been added or view method has been updated)

The solution on each case is below.

In the Case The Modification has No Effect on the Test Scenario

The redefinition flow is as below.

  1. Run Pitalium test in RUN_TEST mode.
    Check the difference between current and expected image of the test.
    Make sure the difference is acceptable based on the application modification.
  1. Run the test in SET_EXPECTED mode to update the expected image.

In this case you don't have to change test case itself.
You only have to re-run test case in SET_EXPECTED mode and update expected image.

In the Case The Modification Affect on the Test Scenario

The redefinition flow is as below.

  1. Fix the test scenario.
  2. Run the test in TAKE_SCREENSHOT mode.
    Make sure the fixed test case works and the image taken by the test is correct.
  3. Run the test in SET_EXPECTED mode to update the expected image.

In this case you need not only to fix the test script, but also to make sure the image taken by the test is correct.
Use TAKE_SCREENSHOT mode when neither assertion of images nor update of expected image are needed.

Tips on Updating Expected Images

currentExpectedIds.json has expected values of each test method. But Pitalium can only run tests by each test case in accordance with the specification of JUnit Parameterized tests.
If you want to run a specific test method on a test case, You should put  @Ignore annotation on the head of the other test cases to disable them temporarily.

Next step ⇒ 09.Running a Test in Mobile Devices

See Also


Copyright (C) 2012-2017 NS Solutions Corporation, All Rights Reserved.