TestCafe v15.1 - Web Testing and Automated Screenshot Capture (Coming soon)

Thinking Out Loud
14 May 2015

As I mentioned yesterday, we are getting close to the official release of TestCafe v15.1. Among the new features we'll introduce in this release is the ability to automatically capture screenshots during test execution so you can track down defects more effectively and get a dynamic look at the state of your web app or failure conditions of any test.

Capturing Screenshots on Demand

You can command TestCafe to capture screenshots by using its special Screenshot action. This action can be used anywhere within a test and as many times as needed. There are two ways to add the Screenshot action to a test. The first is to record it with TestCafe's Visual Test Recorder by clicking the "Add Screenshot" button within the recorder’s toolbar...

Automated Web Application Testing - How to Capture a Screenshot During a Test

...The second way to capture a screenshot during a test is to add the act.screenshot API method to your test code using the code editor.

Automated Web App Testing - Capturing Screenshots during a Test Run

Once you command TestCafe to capture a screenshot - via the Visual Test Recorder or by using its API - it will automatically capture and post the image to your test report within the Results tab. To view the screenshots TestCafe captures, simply click the "Screenshot" icon in the Screenshot column of the report.

Automated Web App Testing - View Captured Screenshots

TestCafe displays the captured image collection in a new window. As you can see below, screenshots are grouped by test steps.

Automated Web Testing - Captured Screenshot Image Collection

Capturing Screenshots on Failure

TestCafe also allows you to capture screenshots when a test fails. These captured images help you quickly isolate the cause of failures within any test. To enable this functionality, check the "Take a screenshot if a test fails" option when starting a test.

Automated Web Testing - Take a Screenshot when a Test Fails

If an error occurs or an assertion fails during the test run, TestCafe will snap an image of the tested application and post it to your test report.

To view the captured image:

  • Switch to the Results tab and click the task report. TestCafe will display detailed results;
  • Click the failed test to view an extended message about the failure.

Automated Web Testing - Failed Tests

As you can see in the image above, the test failed because the assertion did not pass: the actual text for the article header did not match the expected value.  The auto-captured screenshot makes it infinitely easier to understand the cause and effect of test failures. In order to view the screenshot in full screen mode, simply click it - TestCafe will display it in a new browser tab.

Automated Web Testing Made Easy

Hopefully I've been able to show you the value of this new feature - automated screenshots truly make test analysis easier. We'd love to hear your feedback - let us know what you think about TestCafe's automated screenshot capture option.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.