Cypress Tutorial
Selected Reading
- Cypress - Discussion
- Cypress - Useful Resources
- Cypress - Quick Guide
- Cypress - GitHub
- Cypress - Plugins
- Cypress - Reports
- Cypress - Configuration of JSON File
- Cypress - Hooks
- Cypress - Environment Variables
- Cypress - Fixtures
- Cypress - Custom Commands
- Cypress - Debugging
- Cypress - Screenshots and Videos
- Cypress - Dashboards
- Cypress - Prompt Pop-up Window
- Cypress - Data Driven Testing
- Cypress - File Upload
- Cypress - Get and Post
- Cypress - Cookies
- Cypress - Mouse Actions
- Cypress - Web Tables
- Cypress - Frames
- Cypress - Hidden Elements
- Cypress - Child Windows
- Cypress - Alerts
- Cypress - Dropdown
- Cypress - Tabs
- Cypress - Checkbox
- Cypress - jQuery
- Cypress - Working with XHR
- Cypress - Asynchronous Behavior
- Cypress - Text Verification
- Cypress - Assertions
- Cypress - Locators
- Cypress - Aliases
- Cypress - Variables
- Cypress - Basic Commands
- Cypress - Supported Browsers
- Cypress - Build First Test
- Cypress - Test Runner
- Cypress - Architecture and Environment Setup
- Cypress - Introduction
- Cypress - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Cypress - Fixtures
Cypress - Fixtures
添加气压装置,以保持和掌握自动化测试数据。 固定装置在Cypress项目夹(Example.json文档)内。 基本上,它帮助我们从外部档案中获得数据投入。
气压固定装置的夹可有JSON或其他格式的文档,数据则以“钥匙:价值”制成。
所有测试数据都可以通过一次以上的测试加以利用。 所有固定装置数据必须在前栏目中公布。
Syntax
The syntax for Cypress data Drive test is as follows -
cy.fixture(path of test data) cy.fixture(path of test data, encoding type) cy.fixture(path of test data, opts) cy.fixture(path of test data, encoding type, options)
这里
编码类型——编码类型(tf-8, asci,等等)用于读文档。
Opts − Modifies the timeout for response. The default value is 30000ms. The wait time for cy.fixture(), prior throws an exception.
Implementation in example.json
下面是用example.json在Cypress进行数据驱动检测。
{ "fullName": "Robert", "number": "789456123" }
Implementation of Actual Test
在Cypress实施实际数据驱动测试如下:
describe( Tutorialspoint Test , function () { //part of before hook before(function(){ //access fixture data cy.fixture( example ).then(function(regdata){ this.regdata=regdata }) }) // test case it( Test Case1 , function (){ // launch URL cy.visit("https://register.rediff.com/register/register.php") //data driven from fixture cy.get( :nth-child(3) > [width="185"] > input ) .type(this.regdata.fullName) cy.get( #mobno ).type(this.regdata.number) }); });
产出如下:
产出记录显示,将罗伯特和789456123的数值分别输入全称和移动区。 这些数据已经通过固定装置进行测试。
Advertisements