大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺
前提
- 已经熟练掌握了Cypress的基本知识,请参考自动化测试框架[Cypress概述]和自动化测试框架[各自动化测试框架比较]
- 已经熟练掌握Cypress环境配置,请参考自动化测试框架[Cypress环境搭建与配置详解]
和自动化测试框架[Cypress测试实例凸显其优势]
- 已经熟练掌握Cypress框架结构,请参考自动化测试框架[Cypress框架拆解]
和自动化测试框架[Cypress重试机制]
- 已经熟练掌握Cypress内置测试报告,请参考自动化测试框架[Cypress内置测试报告详解]
- 已经熟练掌握Cypress内置测试报告,请参考自动化测试框架[Cypress自定义测试报告详解]
下载并配置Allure
通过Allure下载
下载解压后,将bin路径添加到系统环境变量中
环境验证
在命令行直接执行allure
C:\Users\Administrator>allure
Usage: allure [options] [command] [command options]
Options:
--help
Print commandline help.
-q, --quiet
Switch on the quiet mode.
Default: false
-v, --verbose
Switch on the verbose mode.
Default: false
--version
Print commandline version.
Default: false
Commands:
generate Generate the report
Usage: generate [options] The directories with allure results
Options:
-c, --clean
Clean Allure report directory before generating a new one.
Default: false
--config
Allure commandline config path. If specified overrides values from
--profile and --configDirectory.
--configDirectory
Allure commandline configurations directory. By default uses
ALLURE_HOME directory.
--profile
Allure commandline configuration profile.
-o, --report-dir, --output
The directory to generate Allure report into.
Default: allure-report
serve Serve the report
Usage: serve [options] The directories with allure results
Options:
--config
Allure commandline config path. If specified overrides values from
--profile and --configDirectory.
--configDirectory
Allure commandline configurations directory. By default uses
ALLURE_HOME directory.
-h, --host
This host will be used to start web server for the report.
-p, --port
This port will be used to start web server for the report.
Default: 0
--profile
Allure commandline configuration profile.
open Open generated report
Usage: open [options] The report directory
Options:
-h, --host
This host will be used to start web server for the report.
-p, --port
This port will be used to start web server for the report.
Default: 0
plugin Generate the report
Usage: plugin [options]
Options:
--config
Allure commandline config path. If specified overrides values from
--profile and --configDirectory.
--configDirectory
Allure commandline configurations directory. By default uses
ALLURE_HOME directory.
--profile
Allure commandline configuration profile.
执行Cypress测试用例
生成junit报告
首先在cypress.json
文件中添加如下配置
{
"reporter": "junit",
"reporterOptions": {
"mochaFile": "results/test_report_[hash].xml",
"toConsole": true
}
}
执行测试
D:\Cypress>npm run cypress:run
> davieyang@1.0.0 cypress:run D:\Cypress
> cypress run
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 6.2.0 │
│ Browser: Electron 87 (headless) │
│ Specs: 19 found (examples\actions.spec.js, examples\aliasing.spec.js, examples\assertions │
│ .spec.js, examples\connectors.spec.js, examples\cookies.spec.js, examples\cypress_ │
│ api.spec.js, examples\files.spec.js, examples\local_storage.spec.js, examples\loca │
│ tion.spec.j...) │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\actions.spec.js (1 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="24.4100" tests="14" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:18:28" tests="0" file="cypress\integration\examples\actions.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Actions" timestamp="2020-12-28T08:18:28" tests="14" time="24.4100" failures="0">
<testcase name="Actions .type() - type into a DOM element" time="7.5330" classname=".type() - type into a DOM element">
</testcase>
<testcase name="Actions .focus() - focus on a DOM element" time="0.9090" classname=".focus() - focus on a DOM element">
</testcase>
<testcase name="Actions .blur() - blur off a DOM element" time="1.1660" classname=".blur() - blur off a DOM element">
</testcase>
<testcase name="Actions .clear() - clears an input or textarea element" time="1.0710" classname=".clear() - clears an input or textarea element">
</testcase>
<testcase name="Actions .submit() - submit a form" time="1.2170" classname=".submit() - submit a form">
</testcase>
<testcase name="Actions .click() - click on a DOM element" time="2.9620" classname=".click() - click on a DOM element">
</testcase>
<testcase name="Actions .dblclick() - double click on a DOM element" time="0.5200" classname=".dblclick() - double click on a DOM element">
</testcase>
<testcase name="Actions .rightclick() - right click on a DOM element" time="0.7680" classname=".rightclick() - right click on a DOM element">
</testcase>
<testcase name="Actions .check() - check a checkbox or radio element" time="1.6750" classname=".check() - check a checkbox or radio element">
</testcase>
<testcase name="Actions .uncheck() - uncheck a checkbox element" time="1.3970" classname=".uncheck() - uncheck a checkbox element">
</testcase>
<testcase name="Actions .select() - select an option in a <select> element" time="1.3890" classname=".select() - select an option in a <select> element">
</testcase>
<testcase name="Actions .scrollIntoView() - scroll an element into view" time="0.8320" classname=".scrollIntoView() - scroll an element into view">
</testcase>
<testcase name="Actions .trigger() - trigger an event on a DOM element" time="0.4250" classname=".trigger() - trigger an event on a DOM element">
</testcase>
<testcase name="Actions cy.scrollTo() - scroll the window or element to a position" time="2.5460" classname="cy.scrollTo() - scroll the window or element to a position">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 14 │
│ Passing: 14 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 28 seconds │
│ Spec Ran: examples\actions.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\actions.spec.js.mp4 (8 seconds)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\aliasing.spec.js (2 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="3.8930" tests="2" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:19:08" tests="0" file="cypress\integration\examples\aliasing.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Aliasing" timestamp="2020-12-28T08:19:08" tests="2" time="3.8930" failures="0">
<testcase name="Aliasing .as() - alias a DOM element for later use" time="2.1600" classname=".as() - alias a DOM element for later use">
</testcase>
<testcase name="Aliasing .as() - alias a route for later use" time="1.7330" classname=".as() - alias a route for later use">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 2 │
│ Passing: 2 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 5 seconds │
│ Spec Ran: examples\aliasing.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\aliasing.spec.js.mp4 (1 second)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\assertions.spec.js (3 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="7.6600" tests="9" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:19:19" tests="0" file="cypress\integration\examples\assertions.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Assertions" timestamp="2020-12-28T08:19:20" tests="0" time="0.0000" failures="0">
</testsuite>
<testsuite name="Implicit Assertions" timestamp="2020-12-28T08:19:20" tests="2" time="3.5400" failures="0">
<testcase name="Assertions Implicit Assertions .should() - make an assertion about the current subject" time="2.7210" classname=".should() - make an assertion about the current subject">
</testcase>
<testcase name="Assertions Implicit Assertions .and() - chain multiple assertions together" time="0.8190" classname=".and() - chain multiple assertions together">
</testcase>
</testsuite>
<testsuite name="Explicit Assertions" timestamp="2020-12-28T08:19:25" tests="7" time="4.1200" failures="0">
<testcase name="Assertions Explicit Assertions expect - make an assertion about a specified subject" time="0.3660" classname="expect - make an assertion about a specified subject">
</testcase>
<testcase name="Assertions Explicit Assertions pass your own callback function to should()" time="0.4940" classname="pass your own callback function to should()">
</testcase>
<testcase name="Assertions Explicit Assertions finds element by class name regex" time="0.3710" classname="finds element by class name regex">
</testcase>
<testcase name="Assertions Explicit Assertions can throw any error" time="0.4810" classname="can throw any error">
</testcase>
<testcase name="Assertions Explicit Assertions matches unknown text between two elements" time="0.3100" classname="matches unknown text between two elements">
</testcase>
<testcase name="Assertions Explicit Assertions assert - assert shape of an object" time="0.2670" classname="assert - assert shape of an object">
</testcase>
<testcase name="Assertions Explicit Assertions retries the should callback until assertions pass" time="1.8310" classname="retries the should callback until assertions pass">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 9 │
│ Passing: 9 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 10 seconds │
│ Spec Ran: examples\assertions.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\assertions.spec.js.mp4 (3 seconds)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\connectors.spec.js (4 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="5.2420" tests="8" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:19:35" tests="0" file="cypress\integration\examples\connectors.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Connectors" timestamp="2020-12-28T08:19:35" tests="4" time="3.1580" failures="0">
<testcase name="Connectors .each() - iterate over an array of elements" time="1.7410" classname=".each() - iterate over an array of elements">
</testcase>
<testcase name="Connectors .its() - get properties on the current subject" time="0.3950" classname=".its() - get properties on the current subject">
</testcase>
<testcase name="Connectors .invoke() - invoke a function on the current subject" time="0.3290" classname=".invoke() - invoke a function on the current subject">
</testcase>
<testcase name="Connectors .spread() - spread an array as individual args to callback function" time="0.6930" classname=".spread() - spread an array as individual args to callback function">
</testcase>
</testsuite>
<testsuite name=".then()" timestamp="2020-12-28T08:19:40" tests="4" time="2.0840" failures="0">
<testcase name="Connectors .then() invokes a callback function with the current subject" time="0.6780" classname="invokes a callback function with the current subject">
</testcase>
<testcase name="Connectors .then() yields the returned value to the next command" time="0.5360" classname="yields the returned value to the next command">
</testcase>
<testcase name="Connectors .then() yields the original subject without return" time="0.4390" classname="yields the original subject without return">
</testcase>
<testcase name="Connectors .then() yields the value yielded by the last Cypress command inside" time="0.4310" classname="yields the value yielded by the last Cypress command inside">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 8 │
│ Passing: 8 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 7 seconds │
│ Spec Ran: examples\connectors.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\connectors.spec.js.mp4 (5 seconds)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\cookies.spec.js (5 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="4.3780" tests="5" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:19:52" tests="0" file="cypress\integration\examples\cookies.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Cookies" timestamp="2020-12-28T08:19:53" tests="5" time="4.3780" failures="0">
<testcase name="Cookies cy.getCookie() - get a browser cookie" time="2.0500" classname="cy.getCookie() - get a browser cookie">
</testcase>
<testcase name="Cookies cy.getCookies() - get browser cookies" time="0.8520" classname="cy.getCookies() - get browser cookies">
</testcase>
<testcase name="Cookies cy.setCookie() - set a browser cookie" time="0.5070" classname="cy.setCookie() - set a browser cookie">
</testcase>
<testcase name="Cookies cy.clearCookie() - clear a browser cookie" time="0.4720" classname="cy.clearCookie() - clear a browser cookie">
</testcase>
<testcase name="Cookies cy.clearCookies() - clear browser cookies" time="0.4970" classname="cy.clearCookies() - clear browser cookies">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 5 │
│ Passing: 5 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 7 seconds │
│ Spec Ran: examples\cookies.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\cookies.spec.js.mp4 (3 seconds)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\cypress_api.spec.js (6 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="5.6060" tests="12" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:20:07" tests="0" file="cypress\integration\examples\cypress_api.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Cypress.Commands" timestamp="2020-12-28T08:20:07" tests="1" time="1.7090" failures="0">
<testcase name="Cypress.Commands .add() - create a custom command" time="1.7090" classname=".add() - create a custom command">
</testcase>
</testsuite>
<testsuite name="Cypress.Cookies" timestamp="2020-12-28T08:20:10" tests="3" time="1.0570" failures="0">
<testcase name="Cypress.Cookies .debug() - enable or disable debugging" time="0.4060" classname=".debug() - enable or disable debugging">
</testcase>
<testcase name="Cypress.Cookies .preserveOnce() - preserve cookies by key" time="0.3750" classname=".preserveOnce() - preserve cookies by key">
</testcase>
<testcase name="Cypress.Cookies .defaults() - set defaults for all cookies" time="0.2760" classname=".defaults() - set defaults for all cookies">
</testcase>
</testsuite>
<testsuite name="Cypress.arch" timestamp="2020-12-28T08:20:11" tests="1" time="0.3590" failures="0">
<testcase name="Cypress.arch Get CPU architecture name of underlying OS" time="0.3590" classname="Get CPU architecture name of underlying OS">
</testcase>
</testsuite>
<testsuite name="Cypress.config()" timestamp="2020-12-28T08:20:12" tests="1" time="0.3730" failures="0">
<testcase name="Cypress.config() Get and set configuration options" time="0.3730" classname="Get and set configuration options">
</testcase>
</testsuite>
<testsuite name="Cypress.dom" timestamp="2020-12-28T08:20:12" tests="1" time="0.5210" failures="0">
<testcase name="Cypress.dom .isHidden() - determine if a DOM element is hidden" time="0.5210" classname=".isHidden() - determine if a DOM element is hidden">
</testcase>
</testsuite>
<testsuite name="Cypress.env()" timestamp="2020-12-28T08:20:13" tests="1" time="0.3300" failures="0">
<testcase name="Cypress.env() Get environment variables" time="0.3300" classname="Get environment variables">
</testcase>
</testsuite>
<testsuite name="Cypress.log" timestamp="2020-12-28T08:20:13" tests="1" time="0.2940" failures="0">
<testcase name="Cypress.log Control what is printed to the Command Log" time="0.2940" classname="Control what is printed to the Command Log">
</testcase>
</testsuite>
<testsuite name="Cypress.platform" timestamp="2020-12-28T08:20:13" tests="1" time="0.2680" failures="0">
<testcase name="Cypress.platform Get underlying OS name" time="0.2680" classname="Get underlying OS name">
</testcase>
</testsuite>
<testsuite name="Cypress.version" timestamp="2020-12-28T08:20:14" tests="1" time="0.4290" failures="0">
<testcase name="Cypress.version Get current version of Cypress being run" time="0.4290" classname="Get current version of Cypress being run">
</testcase>
</testsuite>
<testsuite name="Cypress.spec" timestamp="2020-12-28T08:20:14" tests="1" time="0.2660" failures="0">
<testcase name="Cypress.spec Get current spec information" time="0.2660" classname="Get current spec information">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 12 │
│ Passing: 12 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 7 seconds │
│ Spec Ran: examples\cypress_api.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\cypress_api.spec.js.mp4 (3 seconds)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\files.spec.js (7 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="3.7530" tests="4" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:20:22" tests="0" file="cypress\integration\examples\files.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Files" timestamp="2020-12-28T08:20:22" tests="4" time="3.7530" failures="0">
<testcase name="Files cy.fixture() - load a fixture" time="1.9350" classname="cy.fixture() - load a fixture">
</testcase>
<testcase name="Files cy.fixture() or require - load a fixture" time="0.3500" classname="cy.fixture() or require - load a fixture">
</testcase>
<testcase name="Files cy.readFile() - read file contents" time="0.4430" classname="cy.readFile() - read file contents">
</testcase>
<testcase name="Files cy.writeFile() - write to a file" time="1.0250" classname="cy.writeFile() - write to a file">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 4 │
│ Passing: 4 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 5 seconds │
│ Spec Ran: examples\files.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\files.spec.js.mp4 (2 seconds)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\local_storage.spec.js (8 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="1.8880" tests="1" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:20:33" tests="0" file="cypress\integration\examples\local_storage.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Local Storage" timestamp="2020-12-28T08:20:33" tests="1" time="1.8880" failures="0">
<testcase name="Local Storage cy.clearLocalStorage() - clear all data in local storage" time="1.8880" classname="cy.clearLocalStorage() - clear all data in local storage">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 1 │
│ Passing: 1 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 4 seconds │
│ Spec Ran: examples\local_storage.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\local_storage.spec.js.mp (1 second)
4
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\location.spec.js (9 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="2.7150" tests="3" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:20:42" tests="0" file="cypress\integration\examples\location.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Location" timestamp="2020-12-28T08:20:42" tests="3" time="2.7150" failures="0">
<testcase name="Location cy.hash() - get the current URL hash" time="1.6480" classname="cy.hash() - get the current URL hash">
</testcase>
<testcase name="Location cy.location() - get window.location" time="0.5150" classname="cy.location() - get window.location">
</testcase>
<testcase name="Location cy.url() - get the current URL" time="0.5520" classname="cy.url() - get the current URL">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 3 │
│ Passing: 3 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 5 seconds │
│ Spec Ran: examples\location.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\location.spec.js.mp4 (1 second)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\misc.spec.js (10 of 19)
(node:2996) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 preprocessor:close listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="6.4980" tests="6" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:20:53" tests="0" file="cypress\integration\examples\misc.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Misc" timestamp="2020-12-28T08:20:53" tests="4" time="3.0890" failures="0">
<testcase name="Misc .end() - end the command chain" time="1.7480" classname=".end() - end the command chain">
</testcase>
<testcase name="Misc cy.exec() - execute a system command" time="0.5760" classname="cy.exec() - execute a system command">
</testcase>
<testcase name="Misc cy.focused() - get the DOM element that has focus" time="0.5140" classname="cy.focused() - get the DOM element that has focus">
</testcase>
<testcase name="Misc cy.wrap() - wrap an object" time="0.2510" classname="cy.wrap() - wrap an object">
</testcase>
</testsuite>
<testsuite name="Cypress.Screenshot" timestamp="2020-12-28T08:20:58" tests="2" time="3.4090" failures="0">
<testcase name="Misc Cypress.Screenshot cy.screenshot() - take a screenshot" time="3.0220" classname="cy.screenshot() - take a screenshot">
</testcase>
<testcase name="Misc Cypress.Screenshot Cypress.Screenshot.defaults() - change default config of screenshots" time="0.3870" classname="Cypress.Screenshot.defaults() - change default config of screenshots">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 6 │
│ Passing: 6 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 1 │
│ Video: true │
│ Duration: 8 seconds │
│ Spec Ran: examples\misc.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Screenshots)
- D:\Cypress\cypress\screenshots\examples\misc.spec.js\my-image.png (1000x1800)
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\misc.spec.js.mp4 (4 seconds)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\navigation.spec.js (11 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="5.8600" tests="3" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:21:10" tests="0" file="cypress\integration\examples\navigation.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Navigation" timestamp="2020-12-28T08:21:10" tests="3" time="5.8600" failures="0">
<testcase name="Navigation cy.go() - go back or forward in the browser's history" time="3.4720" classname="cy.go() - go back or forward in the browser's history">
</testcase>
<testcase name="Navigation cy.reload() - reload the page" time="1.0150" classname="cy.reload() - reload the page">
</testcase>
<testcase name="Navigation cy.visit() - visit a remote url" time="1.3730" classname="cy.visit() - visit a remote url">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 3 │
│ Passing: 3 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 7 seconds │
│ Spec Ran: examples\navigation.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\navigation.spec.js.mp4 (2 seconds)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\network_requests.spec.js (12 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="10.9760" tests="6" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:21:24" tests="0" file="cypress\integration\examples\network_requests.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Network Requests" timestamp="2020-12-28T08:21:24" tests="6" time="10.9760" failures="0">
<testcase name="Network Requests cy.request() - make an XHR request" time="2.4480" classname="cy.request() - make an XHR request">
</testcase>
<testcase name="Network Requests cy.request() - verify response using BDD syntax" time="1.6560" classname="cy.request() - verify response using BDD syntax">
</testcase>
<testcase name="Network Requests cy.request() with query parameters" time="0.9890" classname="cy.request() with query parameters">
</testcase>
<testcase name="Network Requests cy.request() - pass result to the second request" time="1.8150" classname="cy.request() - pass result to the second request">
</testcase>
<testcase name="Network Requests cy.request() - save response in the shared test context" time="1.4990" classname="cy.request() - save response in the shared test context">
</testcase>
<testcase name="Network Requests cy.intercept() - route responses to matching requests" time="2.5690" classname="cy.intercept() - route responses to matching requests">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 6 │
│ Passing: 6 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 12 seconds │
│ Spec Ran: examples\network_requests.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\network_requests.spec.js (7 seconds)
.mp4
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\querying.spec.js (13 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="3.9270" tests="5" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:21:48" tests="0" file="cypress\integration\examples\querying.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Querying" timestamp="2020-12-28T08:21:48" tests="5" time="3.9270" failures="0">
<testcase name="Querying cy.get() - query DOM elements" time="1.7890" classname="cy.get() - query DOM elements">
</testcase>
<testcase name="Querying cy.contains() - query DOM elements with matching content" time="0.4540" classname="cy.contains() - query DOM elements with matching content">
</testcase>
<testcase name="Querying .within() - query DOM elements within a specific element" time="0.3690" classname=".within() - query DOM elements within a specific element">
</testcase>
<testcase name="Querying cy.root() - query the root DOM element" time="0.3720" classname="cy.root() - query the root DOM element">
</testcase>
<testcase name="Querying best practices - selecting elements" time="0.9430" classname="best practices - selecting elements">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 5 │
│ Passing: 5 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 6 seconds │
│ Spec Ran: examples\querying.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\querying.spec.js.mp4 (2 seconds)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\spies_stubs_clocks.spec.js (14 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="6.0980" tests="7" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:22:00" tests="0" file="cypress\integration\examples\spies_stubs_clocks.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Spies, Stubs, and Clock" timestamp="2020-12-28T08:22:01" tests="7" time="6.0980" failures="0">
<testcase name="Spies, Stubs, and Clock cy.spy() - wrap a method in a spy" time="1.6860" classname="cy.spy() - wrap a method in a spy">
</testcase>
<testcase name="Spies, Stubs, and Clock cy.spy() retries until assertions pass" time="2.5740" classname="cy.spy() retries until assertions pass">
</testcase>
<testcase name="Spies, Stubs, and Clock cy.stub() - create a stub and/or replace a function with stub" time="0.5710" classname="cy.stub() - create a stub and/or replace a function with stub">
</testcase>
<testcase name="Spies, Stubs, and Clock cy.clock() - control time in the browser" time="0.5000" classname="cy.clock() - control time in the browser">
</testcase>
<testcase name="Spies, Stubs, and Clock cy.tick() - move time in the browser" time="0.5770" classname="cy.tick() - move time in the browser">
</testcase>
<testcase name="Spies, Stubs, and Clock cy.stub() matches depending on arguments" time="0.0840" classname="cy.stub() matches depending on arguments">
</testcase>
<testcase name="Spies, Stubs, and Clock matches call arguments using Sinon matchers" time="0.1060" classname="matches call arguments using Sinon matchers">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 7 │
│ Passing: 7 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 8 seconds │
│ Spec Ran: examples\spies_stubs_clocks.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\spies_stubs_clocks.spec. (2 seconds)
js.mp4
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\traversal.spec.js (15 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="8.4950" tests="18" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:22:15" tests="0" file="cypress\integration\examples\traversal.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Traversal" timestamp="2020-12-28T08:22:15" tests="18" time="8.4950" failures="0">
<testcase name="Traversal .children() - get child DOM elements" time="1.7530" classname=".children() - get child DOM elements">
</testcase>
<testcase name="Traversal .closest() - get closest ancestor DOM element" time="0.3320" classname=".closest() - get closest ancestor DOM element">
</testcase>
<testcase name="Traversal .eq() - get a DOM element at a specific index" time="0.3270" classname=".eq() - get a DOM element at a specific index">
</testcase>
<testcase name="Traversal .filter() - get DOM elements that match the selector" time="0.3330" classname=".filter() - get DOM elements that match the selector">
</testcase>
<testcase name="Traversal .find() - get descendant DOM elements of the selector" time="0.4650" classname=".find() - get descendant DOM elements of the selector">
</testcase>
<testcase name="Traversal .first() - get first DOM element" time="0.3630" classname=".first() - get first DOM element">
</testcase>
<testcase name="Traversal .last() - get last DOM element" time="0.3470" classname=".last() - get last DOM element">
</testcase>
<testcase name="Traversal .next() - get next sibling DOM element" time="0.4770" classname=".next() - get next sibling DOM element">
</testcase>
<testcase name="Traversal .nextAll() - get all next sibling DOM elements" time="0.3150" classname=".nextAll() - get all next sibling DOM elements">
</testcase>
<testcase name="Traversal .nextUntil() - get next sibling DOM elements until next el" time="0.3360" classname=".nextUntil() - get next sibling DOM elements until next el">
</testcase>
<testcase name="Traversal .not() - remove DOM elements from set of DOM elements" time="0.4780" classname=".not() - remove DOM elements from set of DOM elements">
</testcase>
<testcase name="Traversal .parent() - get parent DOM element from DOM elements" time="0.8780" classname=".parent() - get parent DOM element from DOM elements">
</testcase>
<testcase name="Traversal .parents() - get parent DOM elements from DOM elements" time="0.3320" classname=".parents() - get parent DOM elements from DOM elements">
</testcase>
<testcase name="Traversal .parentsUntil() - get parent DOM elements from DOM elements until el" time="0.3350" classname=".parentsUntil() - get parent DOM elements from DOM elements until el">
</testcase>
<testcase name="Traversal .prev() - get previous sibling DOM element" time="0.3110" classname=".prev() - get previous sibling DOM element">
</testcase>
<testcase name="Traversal .prevAll() - get all previous sibling DOM elements" time="0.3390" classname=".prevAll() - get all previous sibling DOM elements">
</testcase>
<testcase name="Traversal .prevUntil() - get all previous sibling DOM elements until el" time="0.3230" classname=".prevUntil() - get all previous sibling DOM elements until el">
</testcase>
<testcase name="Traversal .siblings() - get all sibling DOM elements" time="0.4510" classname=".siblings() - get all sibling DOM elements">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 18 │
│ Passing: 18 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 10 seconds │
│ Spec Ran: examples\traversal.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\traversal.spec.js.mp4 (4 seconds)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\utilities.spec.js (16 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="5.3040" tests="6" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:22:33" tests="0" file="cypress\integration\examples\utilities.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Utilities" timestamp="2020-12-28T08:22:33" tests="6" time="5.3040" failures="0">
<testcase name="Utilities Cypress._ - call a lodash method" time="1.8660" classname="Cypress._ - call a lodash method">
</testcase>
<testcase name="Utilities Cypress.$ - call a jQuery method" time="0.4240" classname="Cypress.$ - call a jQuery method">
</testcase>
<testcase name="Utilities Cypress.Blob - blob utilities and base64 string conversion" time="0.9300" classname="Cypress.Blob - blob utilities and base64 string conversion">
</testcase>
<testcase name="Utilities Cypress.minimatch - test out glob patterns against strings" time="0.2880" classname="Cypress.minimatch - test out glob patterns against strings">
</testcase>
<testcase name="Utilities Cypress.moment() - format or parse dates using a moment method" time="0.4720" classname="Cypress.moment() - format or parse dates using a moment method">
</testcase>
<testcase name="Utilities Cypress.Promise - instantiate a bluebird promise" time="1.3240" classname="Cypress.Promise - instantiate a bluebird promise">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 6 │
│ Passing: 6 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 7 seconds │
│ Spec Ran: examples\utilities.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\utilities.spec.js.mp4 (2 seconds)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\viewport.spec.js (17 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="4.2900" tests="1" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:22:46" tests="0" file="cypress\integration\examples\viewport.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Viewport" timestamp="2020-12-28T08:22:46" tests="1" time="4.2900" failures="0">
<testcase name="Viewport cy.viewport() - set the viewport size and dimension" time="4.2900" classname="cy.viewport() - set the viewport size and dimension">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 1 │
│ Passing: 1 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 6 seconds │
│ Spec Ran: examples\viewport.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\viewport.spec.js.mp4 (2 seconds)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\waiting.spec.js (18 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="7.7700" tests="2" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:22:59" tests="0" file="cypress\integration\examples\waiting.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Waiting" timestamp="2020-12-28T08:22:59" tests="2" time="7.7700" failures="0">
<testcase name="Waiting cy.wait() - wait for a specific amount of time" time="5.9630" classname="cy.wait() - wait for a specific amount of time">
</testcase>
<testcase name="Waiting cy.wait() - wait for a specific route" time="1.8070" classname="cy.wait() - wait for a specific route">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 2 │
│ Passing: 2 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 9 seconds │
│ Spec Ran: examples\waiting.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\waiting.spec.js.mp4 (2 seconds)
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: examples\window.spec.js (19 of 19)
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="1.8630" tests="3" failures="0">
<testsuite name="Root Suite" timestamp="2020-12-28T08:23:14" tests="0" file="cypress\integration\examples\window.spec.js" time="0.0000" failures="0">
</testsuite>
<testsuite name="Window" timestamp="2020-12-28T08:23:14" tests="3" time="1.8630" failures="0">
<testcase name="Window cy.window() - get the global window object" time="1.3430" classname="cy.window() - get the global window object">
</testcase>
<testcase name="Window cy.document() - get the document object" time="0.2650" classname="cy.document() - get the document object">
</testcase>
<testcase name="Window cy.title() - get the title" time="0.2550" classname="cy.title() - get the title">
</testcase>
</testsuite>
</testsuites>
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 3 │
│ Passing: 3 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: 3 seconds │
│ Spec Ran: examples\window.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: D:\Cypress\cypress\videos\examples\window.spec.js.mp4 (1 second)
====================================================================================================
(Run Finished)
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ √ examples\actions.spec.js 00:28 14 14 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\aliasing.spec.js 00:05 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\assertions.spec.js 00:10 9 9 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\connectors.spec.js 00:07 8 8 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\cookies.spec.js 00:07 5 5 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\cypress_api.spec.js 00:07 12 12 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\files.spec.js 00:05 4 4 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\local_storage.spec.js 00:04 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\location.spec.js 00:05 3 3 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\misc.spec.js 00:08 6 6 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\navigation.spec.js 00:07 3 3 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\network_requests.spec.js 00:12 6 6 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\querying.spec.js 00:06 5 5 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\spies_stubs_clocks.spec.js 00:08 7 7 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\traversal.spec.js 00:10 18 18 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\utilities.spec.js 00:07 6 6 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\viewport.spec.js 00:06 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\waiting.spec.js 00:09 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ √ examples\window.spec.js 00:03 3 3 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
√ All specs passed! 02:43 115 115 - - -
生成的xml结果如图所示
生成Allure报告
执行命令allure serve results
D:\Cypress>allure serve results
Generating report to temp directory...
Report successfully generated to C:\Users\ADMINI~1\AppData\Local\Temp\5521898862344816758\allure-report
Starting web server...
2020-12-28 16:24:21.236:INFO::main: Logging initialized @3690ms to org.eclipse.jetty.util.log.StdErrLog
Server started at <http://192.168.74.228:51984/>. Press <Ctrl+C> to exit
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/164436.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...