Understanding Test Results and Debugging Tests
Poshi tests are run on the terminal or command line. When a test run is completed there are multiple ways to view the test results and diagnose test issues.
Viewing Test Results on the Console Log
When a test run is successful the console log will display a message similar to the following:
A failed test run displays more information which will include the reason the test failed. Note that the following log displays that the failure point being Element is not visible at "//h4[@id="noResultsMessage"]"
.
Viewing the Test Reports
Another way to view the test results is through the Test Report. After a test run, a test-results
folder gets created in your root directory. Within this folder are the test logs and summary pages of the completed test run. If you ran the test example in this tutorial your test-results folder should look similar to this:
Navigate to the index.html
and open the file on a browser.
A successful test result will display the test steps with a green bar indicating that the step passed.
A failed test result will display the failing test step with a red bar indicating that the step failed. You can expand the exclamation mark icon to view more information on the failure point, including screenshots of the system state before and after the failure.
To test this, make a copy of your CannotSearchForMyName
test and replace your name with Blogs
. If you are also changing the test name, remember to edit your poshi-ext.properties
file. See Running a Test for more information.
Diagnosing the Cause of a Test Failure
From the information provided in the log, there are a few ways to diagnose the issue:
-
Determine if there is a bug in the system in test by manually testing the test steps, including the variables provided in the Poshi test.
-
If there is no bug and the system behaves as expected, determine if the locator is checking the correct path by searching for the path on the page DOM (Web Developer Console).
-
If there is neither a bug nor an incorrect path, consider whether the function you are using in the macro is appropriate for the interaction. For example, you might be using the
Click
function on a checkbox where the functionCheck
might be more appropriate. See Functions for more information.