We have just released TestCafe v14.1.2 - a new version of our functional testing framework for web applications. There have been several changes to the product and I’d like to show off some of the more important new features and improvements.
(Not familiar with TestCafe yet? Read this FAQ)
ExtendedReporter/CI API – The most popular continuous integration (CI) system report formats - JUnit and NUnit - are now supported.
Test Parameterization - TestCafe now provides a way to define data sets (test cases) and use them as inputs to run the same test with a different set of data each time.
Here’s how to specify several test cases within the test code and run the test with each of the different parameters:
'@test'['Data-driven testing'] = {
'@testCases': [
{ "@name": "Peter", login: "Peter Parker", password: "12345", group: "admin" },
{ "@name": "John", login: "John Smith", password: "test", group: "user" },
{ "@name": "Olivia", login: "Olivia Taylor", password: "qwerty", group: "moderator" }
],
'Type in input login': function () {
var input = $('#login_input');
act.type(input, this.login);
},
'Type in input password': function () {
var input = $('#password_input');
act.type(input, this.password);
},
'Click submit button': function () {
var submitButton = $('#submit_button');
act.click(submitButton);
},
'Check Result': function () {
var header = $('#group_header');
eq(header, this.group);
}
};
If there are many test cases, you can save them to a separate JSON file. This is also useful if you are going to share these data sets with other tests and fixtures.
Mixins –We’ve also added support for mixins that represent reusable test code snippets.
This example shows how to use a mixin to log in to an account before viewing or editing a profile. The "Authentication” mixin contains three steps: enter login, enter password, and click the "Submit" button. When you need to log in to an account, just call the "Authentication” mixin in the "Log In" step. This will allow you to re-use code without duplicating it:
'@mixin'['Authentication'] = {
'Type in input login': function () {
var input = $('#login_input');
act.type(input, 'Peter Parker');
},
'Type in input password': function () {
var input = $('#password_input');
act.type(input, '12345');
},
'Click submit button': function () {
var submitButton = $('#submit_button');
act.click(submitButton);
}
};
'@test'['View profile'] = {
'Log In': '@mixin Authentication',
'Click link "My Profile"': function () {
var link = $(':containsExcludeChildren(My Profile)');
act.click(link);
}
};
'@test'['Edit profile'] = {
'Log In': '@mixin Authentication',
'Click link "Edit Profile"': function () {
var link = $(':containsExcludeChildren(Edit Profile)');
act.click(link);
}
};
Improved Architecture - The TestCafe Core engine has been significantly overhauled to provide greater reliability and performance and to close many outstanding issues.
Test Run Metadata - A new property (this.__workerName) has been introduced to the TestCafe API. This allows your test code to retrieve the name of the current worker.
New Installer with GUI Runner for Mac OS Users - TestCafe for Mac OS now ships with a simplified installer that initializes the testing environment as well as installing the product. There is no need any more to unpack the TestCafe distribution and configure it using the command line.
When you launch TestCafé on the Mac, it will display a specific icon within the menu bar. Click this icon to access a context menu. This context menu allows you to open the TestCafe Control Panel, to copy TestCafe's URL to the clipboard, or to exit TestCafe.
You can also run TestCafe from the application launcher by clicking the TestCafe icon listed in Launchpad.
Get started today
TestCafe is easy to get started with. Just download, install, and you're ready to record your first test.
You can download the new version of TestCafe from our site (http://testcafe.devexpress.com/Download). We look forward to your feedback as you use TestCafe v14.1.2.