TestCafe with Smart Script Injection, Traffic and Markup Analysis Tools
TestCafe, recently released by DevExpress enables you to run tests using any browser that supports HTML5 on either Windows, Mac or Linux platforms. It provides support for smart script injection that enables you to communicate directly with the webpage DOM in addition to intercepting user actions. It also eliminates out of process browser plug-ins and provides wrapper-free access to DOM via jQuery or the browser's API.
In order to work with TestCafe, you need to press REC button and the website loads in the same browser window from where you can start recording. You will also view a confirmation dialog across each recorded action that allows you to preview the action, rollback and customize element selector code. TestCafe also enables you yo run tests via the UI or command line and provides an ability to analyze results using either Integrated UI or by processing JSON output.
InfoQ had a chat with Julian Bucknall, CTO, DevExpress to know more about TestCafe
InfoQ: What kind of applications can be tested with TestCafe?
InfoQ: Can you elaborate on the necessity to download TestCafe if it is a web based testing framework?
TestCafe comprises two parts, in essence. There’s the server part which holds the dashboard and analysis components (as well as the proxy server) that launch the tests being run on the client (one or more browser instances on whatever devices). Then there’s the client-side library that runs the tests within the browser and communicates the results back to the server.
Yes, we could have launched TestCafe in such a manner that we controlled the server part (in essence, we could have "rented" out testing services), but we recognized that a lot of web testing is done in a QA environment which may be just running on an intranet, with no connection to the internet.
In that scenario, it makes sense to sell the server part as well as part of TestCafe. Note that despite the nomenclature, the TestCafe server could quite easily run on the same machine that’s providing the browser environment, say a web developer's machine. The web developer could then write tests, and run them on his machine and devices without interaction from any other PCs on the network.
InfoQ: Is it possible to test Windows Forms and Windows Phone 8 apps using TestCafe?
No. It's for web pages and apps only.
InfoQ: What makes TestCafe different from other tools?
Other functional testing tools for the web generally require special plug-ins for the browsers being used to run the app. The server part communicates with the plug-in and the plug-in has to try and control the app. This means that not only do separate plug-ins have to be written for each browser, but sometimes each version of the browser.
Plug-ins also have difficulties in accessing the DOM of the page; elements in the DOM, visible or not; in controlling user input; and so on. TestCafe does not require such plug-ins, instead it injects a special client library directly into the web page and thus has complete control over the page. This is why TestCafe can test web pages directly on mobile devices such as iPhones or Android phones and it can trap (and report) errors that a page might throw up.
InfoQ: Can I run TestCafe over a shared or dedicated hosting?
TestCafe runs on top of node.js, so if the hosting provider allows for node.js to be installed, then certainly.
InfoQ: Does TestCafe simply point out the bugs associated with the application or automatically rectify them?
TestCafe is a tool for functional testing. The developer writes (or records) a sequence of actions with a certain result. It merely repeats the same sequence of actions and verifies that the result is the same. If the result is not the same, this would indicate a bug, but the tool has no way of knowing what change caused the erroneous result.
InfoQ: Does the usage of TestCafe improve productivity of developers?
Absolutely. The web developer is able to build up a set of functional tests for a particular web page or app and then, as part of a check-in process, verify that the tests all still pass. Bugs are caught before reaching production or even the code repository, and there have been numerous studies published showing that the earlier a bug is found, the cheaper (in time, money, effort) it is to fix.