04. Running a Test

Last modified by ishikawa on 2016/03/25, 21:01

In this chapter we show how to run pitalium tests and output results.

Setup Run Configuration

Configure Execution Mode

Pitalium has three execution modes, TAKE_SCREENSHOT, SET_EXPECTED and RUN_TEST. The default is SET_EXPECTED . In SET_EXPECTED mode Pitalium saves a screenshot as the expected(correct answer) image of the view .
Then in RUN_TEST mode compare a current screenshot with the expected one. See specs  for further information.

There are two way to set your test's execution mode. One is to edit the configuration file.
For example if you edit src/main/resources/environmentConfig.json as below the tests runs in RUN_TEST mode.

 "execMode": "RUN_TEST"

The other is to set runtime argument of the tests.


If you do neither, tests runs in SET_EXPECTED mode.
If you do both, runtime argument priors to configuration file.

Configure Selenium Grid Hub Server

In chapter 2 we run Selenium Grid Hub Server on a local environment.
If you run it on another machine, you should set the address/port in environmentConfig.json

 "hubHost": "",
 "hubPort": 4444

Output Result

Tests inherited PtlTestBase put screenshots and result files collected through testcases under "results" directory.
The directory structure after running tests is as below.

  ├Execution Date
  │  └Test Class Name
  │      ├result.json
  │      ├result_by_screenshot_id.json
  │      ├whole_page_screenshot_by_screenshot_id.png
  │      └screenshot_by_screenshot_id.png

For the detail about screenshot images and result files see specs .


currentExpectedIds.json holds screenshot ids set as expected.
It is updated by running test in SET_EXPECTED mode.

Results By Screenshot Id(JSON)

These files hold screenshot metadata of each browser/test method.
The naming rule is as follows.


For Example:


These files hold the result of taking the screenshot of each test class.
In RUN_TEST mode they have also hold the result of comparing images.

Screenshot By Screenshot Id

These are screenshots taken by assertView method.
Each time the method called, Pitalium saves two images.
One is the whole page screenshot at the time.
The other is the partial page image specified by arguments of the method, which is named as follows.


For Example:

Next step ⇒ 05.Taking a Screenshot of a Specific DOM Element

See Also

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