Modern Web Testing with TestCafe
上QQ阅读APP看书,第一时间看更新

Exploring the main features of TestCafe

Now, let's take a more detailed look at all the bells and whistles that TestCafe has to offer:

  • Pretty much all TestCafe needs to run is a browser and Node.js configured on your machine, so there is minimal setup.
  • TestCafe can run tests in headless mode (on Chrome or Firefox) without a need to render a Document Object Model (DOM). This feature is extremely useful when running tests on any Continuous Integration (CI) system.
  • TestCafe supports all main operating systems, including Windows, macOS, and Linux.
  • The officially supported browsers of TestCafe are Google Chrome (Stable, Beta, Dev, and Canary), Internet Explorer (11+), Microsoft Edge (Legacy and Chromium-based), Mozilla Firefox, Safari, Google Chrome mobile, and Safari mobile – so it is cross-browser. You can find a full list of supported browsers and their aliases at https://devexpress.github.io/testcafe/documentation/guides/concepts/browsers.html#officially-supported-browsers.
  • Tests can be written in the latest JavaScript (ES6+), TypeScript, or CoffeeScript formats (we will be using JavaScript to demonstrate this in the upcoming chapters).
  • Clear and flexible API with support of the PageModel pattern (we will see how this works in Chapter 6, Refactoring with PageObjects).
  • Stable tests due to the smart assertion and automatic waiting mechanisms (this will be discussed in Chapter 2, Exploring TestCafe Under the Hood).
  • TestCafe has a lot of free custom plugins: cloud browser providers and emulators (SauceLabs, BrowserStack, CrossBrowserTesting, and so on), framework-specific selectors to interact with page elements in a way that is native to your framework (React, Angular, Vue, and Aurelia), custom reporters to get test results in different formats (TeamCity, Slack, NUnit, and TimeCafe), IDE plugins to run tests and view results from your favorite IDE (Visual Studio Code, Webstorm, and SublimeText), Cucumber support to create and run tests with Cucumber syntax, and much more, as TestCafe developers and community members are extremely active. All of these are ready to use and open source (https://github.com/DevExpress/testcafe#plugins).

These are the main features of the TestCafe open source framework. Wondering if there are any products on top of that that don't require you to write code? Sure thing!

Introducing TestCafe Studio

In addition to the open source TestCafe framework, there is a paid test recording tool called TestCafe Studio. It is built on top of the TestCafe engine to give test engineers the opportunity to record, run, and update tests without any special knowledge of JavaScript. It is achieved by transforming user actions from recording into repeatable code.

As well as complementing the features provided by the TestCafe framework, TestCafe Studio takes things even further with the following:

  • Visual test recorder: This allows you to create tests without writing any code. It records your interactions with the web page in the browser and generates corresponding tests (https://docs.devexpress.com/TestCafeStudio/400165/guides/record-tests).
  • Interactive test editor: Allows you to view and edit tests and hooks in a comprehensive, visualized manner (https://docs.devexpress.com/TestCafeStudio/400190/user-interface/test-editor).
  • Automatic selector generation: TestCafe Studio can generate element selectors while recording when you interact with a web page or when a web page element is picked with the element picker (https://docs.devexpress.com/TestCafeStudio/400407/test-actions/element-selectors#auto-generated-element-selectors).
  • Run configuration manager: Allows you to create, modify, and delete run configurations for desktop, headless, and mobile browsers (https://docs.devexpress.com/TestCafeStudio/400189/user-interface/run-configurations-dialog).
  • Code editor: Allows you to write and modify test scripts (https://docs.devexpress.com/TestCafeStudio/400181/user-interface/code-editor).

    Note

    TestCafe Studio has 30-day free trial period – you can find more information about this at https://www.devexpress.com/products/testcafestudio/qa-end-to-end-web-testing.xml.

Let's stop for a moment, catch our breath, and review what we have learned so far. We have acquired a basic understanding of what TestCafe is and have gone through a list of what it has to offer – the main features, plugins, and the TestCafe Studio test recording tool. Now, let's proceed with an overview of how TestCafe competes with Selenium.