Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this tutorial, we will create some E2E tests in JavaScript using TestCafé.

TestCafé is a Node.js utility for E2E testing that does not use Selenium WebDriver; it uses a proxy mechanism instead. Some of its features include the ability to handle automatically the wait times of page loads/XHR requests for stabler tests.

...

TestCafé is not just an automation library; it's a complete testing tool that provides assertions and a runner, to implement and run the tests.

Requirements

...

No Format
testcafe chrome test1.js test2.js --reporter xunit > results.xml


In case you want ro run your tests concurrently, you can pass an argument to identify the number of sessions and the browsers to use.

No Format
testcafe -c 10 chrome,firefox test1.js test2.js --reporter xunit > results.xml


It is also possible to perform headless testing (e.g. use "chrome:headless" as the browser name, for example).

No Format
testcafe "chrome:headless"  test1.js test2.js --reporter xunit > results.xml


After running the tests and generating the JUnit XML reports (e.g., results.xml), they can be imported to Xray (either by the REST API or through the Import Execution Results action within the Test Execution).

Image Added


JUnit's Test Case is mapped to a Generic Test in Jira, and the Generic Test Definition field contains the name of of the fixture concatenated with the name of the test .

The Execution Details of the Generic Test contains information about the Test Suite, which in this case contains the identification of the target environment (i.e. browser + OS).


Image Added


Running tests using cloud providers

Tests can easily be run using different cloud providers and it's possible to generate a JUnit XML report with the results on a per test basis.

Both in BrowserStack and in Sauce Labs backoffice only a session/test will appear though.


To run them in the cloud using BrowserStack, the command line would be something like this (BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY environment variables would need to be defined beforehand):

No Format
testcafe "browserstack:Chrome@66.0:Windows 10" test1.js test2.js --reporter xunit > results.xml


Image Added


To run them in the cloud using Sauce Labs, the command line would be something like this (SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables would need to be defined beforehand):

No Format
testcafe "saucelabs:Chrome@66.0:Windows 10" test1.js test2.js --reporter xunit > results.xml

After running the tests and generating the JUnit XML reports (e.g., results.xml), they can be imported to Xray (either by the REST API or through the Import Execution Results action within the Test Execution).

Image Removed

JUnit's Test Case is mapped to a Generic Test in Jira, and the Generic Test Definition field contains the value of the "it" concatenated with the several "describe"' that make up the test case.

The Execution Details of the Generic Test contains information about the Test Suite, which in this case corresponds to the concatenation of the test's "describe".


Image RemovedImage Added

References

...