08.Redefining of Correct Images
- 01.About Pitalium
- 02.Environment Setup
- 03.Writing Test Code
- 04.Running a Test
- 05.Taking a Screenshot of a Specific DOM Element
- 06.Taking a Screenshot of a DOM Element with Scroll
- 07.Excluding Elements from Comparison Targets
- 08.Redefining of Correct Images
- 09.Running a Test in Mobile Devices
- 10.Pitalium Explorer
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.
- 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.
- 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.
- Fix the test scenario.
- Run the test in TAKE_SCREENSHOT mode.
Make sure the fixed test case works and the image taken by the test is correct. - 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