课程大纲
第1天 – 介绍与基础
介绍
-
Cypress在测试金字塔中的角色
-
测试自动化环境设置(Node LTS, npm)
-
创建一个最小的Cypress项目
-
在GUI和无头模式下进行首次“烟雾”端到端测试
核心概念
-
Cypress基础、命令队列、自动重试
-
使用钩子:before, beforeEach, afterEach, after
-
别名与可重用性(
.as(),cy.get('@alias'))
API(契约)测试
-
使用Cypress进行直接API测试(
cy.request()) -
使用
cy.intercept()进行API桩测试,处理边缘情况 -
确保前端与后端的集成稳定性
自定义Cypress命令
-
将重复操作(登录、导航)组织成自定义命令
-
使用可重用的调用编写更清晰、可维护的代码(
cy.login())
日程安排:理论+演示+实践练习
先决条件:基本的JS知识,VSCode,Git
第2天 – 高级实践与CI/CD
构建复杂测试
-
自动化完整用户流程
-
使用
cy.intercept和cy.session进行状态控制 -
避免不稳定测试,提高稳定性和速度
数据驱动测试
-
将测试数据存储在JSON文件中(fixtures)
-
参数化测试,使用多个输入运行相同逻辑
Cypress插件
-
报告:mochawesome, allure-cypress, junit-reporter
-
交互:cypress-file-upload, cypress-real-events
-
可访问性:cypress-axe, cypress-audit
-
视觉回归:cypress-image-snapshot
-
可维护性:@testing-library/cypress, cypress-plugin-tab
使用Cypress的CI/CD
-
GitHub Actions集成
-
设置Node.js和Cypress环境,无头执行
-
在push/PR时自动运行测试
-
安全处理密钥
总结与结论
要求
- 对软件测试的理解
受众
- 软件测试员
客户评论 (5)
良好的融洽关系,Łukasz 有时间回答每个人的问题,并且能够说明任何有任何问题的人
Kelly Morris - Titian Software Poland Sp. z o.o.
课程 - Selenium WebDriver in C#
机器翻译
我喜欢一切,因为它对我来说都是新的,我可以看到它可以为我的工作带来附加值。
Zareef - BMW South Africa
课程 - Tosca: Model-Based Testing for Complex Systems
机器翻译
The trainer explained every functionality thoroughly.
Argean Quilaquil - DXC
课程 - TestComplete
Trainer is nice. His explanation is clear and interesting. He try to make the lessons interesting as possible. I enjoyed the lesson and gained a lot of knowledge. Thank you so much. The most useful technique I learned is the locating elements for different web component like textbox, radio buttons and buttons. Sometimes, the element ID is not capture correctly. We learned a different way of locating elements by using CSS selectors, XPath, Name and ID. I like the explanation. Thanks
Bee Chin Chuah - I-Access Solutions Pte Ltd
课程 - Advanced Selenium with C#
I liked how the examples lead to the next. You are able to use what you learnt in the previous segment in the next.