Easy Install

Everything is included in a single module installed with one command.

npm install -g testcafe

No native parts to compile, no browsers plugins to install.

Complete Test Harness

TestCafe automatically starts browsers, runs tests and gathers results. You only type a single command to begin testing.

testcafe chrome,firefox tests/

When testing is finished, TestCafe aggregates test results from different browsers and outputs them into one comprehensive report.

Write Test Code Using ES2016

You can write TestCafe tests in ES2016 using the latest javascript features like async/await .

Test API consists of over two dozen methods that can emulate all actions one could possibly do with a webpage. Chained syntax allows for code that is easy to write and read.

import { expect } from 'chai'; fixture `Example page` .page('http://devexpress.github.io/testcafe/example'); test('Emulate user actions and perform a verification', async t => { await t .click('#send-button') .typeText('#input', 'Peter Parker') .wait(1000); expect(await t.eval(() => getSomethingOnTheClient())).to.be.true; });

Additionally, TestCafe automatically generates source maps for easy debugging. To debug your test code, start a debugging session in an IDE that supports source maps.

Direct Access to Page Elements

TestCafe allows you to access webpage elements using standard CSS selectors orcustom selectors that run client JavaScript code. You can call a custom selector as a regular function within your test. It will execute your code on the client and pass the returned value back to the test. This allows you to determine the state of each element on the tested page or select a proper element to perform an action on.

import { Selector } from 'testcafe'; const getElementById = Selector(id => document.querySelector(`#${id}`)); fixture `Example page` .page('http://devexpress.github.io/testcafe/example'); test('Type the developer name, obtain the header text and check it', async t => { await t .typeText('#developer-name', 'John Smith') .click('#submit-button'); const articleHeader = await getElementById('article-header'); const headerText = articleHeader.innerText; expect(headerText).to.equal('Thank you, John!'); });

No Extra Coding

Write tests without boilerplate code.

TestCafe automatically waits for page loads and XHRs to complete, as well as for DOM elements to become visible. You do not need to write custom code for that. Test runs are isolated, which means that they do not share cookies, local or session storages. There is nothing to clean up between test runs. Descriptive Reports

TestCafe automatically generates full-detailed reports that provide a test run summary and comprehensive information about errors. Automatic page screenshots, fancy call sites and call stacks free of TestCafe internals allow you to easily detect error causes.

Use one ofbuilt-in reporters to output test results orcreate your own one to produce custom reports.

Straightforward Continuous Integration

TestCafe is easy to set up on popular Continuous Integration platforms as it allows you to test against various browsers: local, remote or cloud (e.g. Sauce Labs ). You can also create a custombrowser provider to add support for a browser or a cloud platform of your choice.

More to Come…

We plan to introduce other outstanding features so that you can test apps with even more efficiency. Meanwhile, you can help us improve TestCafe by voting for features on our road map or sharing your own ideas and code in our GitHub repository .

Get Started

本文前端(javascript)相关术语:javascript是什么意思 javascript下载 javascript权威指南 javascript基础教程 javascript 正则表达式 javascript设计模式 javascript高级程序设计 精通javascript javascript教程

主题: JavaScriptJavaGitGitHubCSSHead
分页:12
转载请注明
本文标题:TestCafe - a new open-source browser testing framework based on node.js
本站链接:http://www.codesec.net/view/484558.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 前端(javascript) | 评论(0) | 阅读(30)