admin管理员组文章数量:1122846
I am new in Cucumber and want to write optime code for 50 test cases. Every test case has different examples (set of test data flags) and different one when, different one then steps.
How can I write optimize Feature for above 2 test cases as I have to write similar for 50 test case?
Feature : have to automate one api
@tag1
scenario outline : scenario outline1
Given A
When B
When C
Then D
Then E
Examples:
|statusCode |payload|
|"200" | "quantity:one;rollno:123;isStudent:true;isTeacher:true |
@tag2
scenario outline : scenario outline2
Given A
When B
When X
Then D
Then Y
Examples:
|statusCode |payload|
|"200" | "quantity:one;rollno:123;isStudent:false;isTeacher:false |
I am new in Cucumber and want to write optime code for 50 test cases. Every test case has different examples (set of test data flags) and different one when, different one then steps.
How can I write optimize Feature for above 2 test cases as I have to write similar for 50 test case?
Feature : have to automate one api
@tag1
scenario outline : scenario outline1
Given A
When B
When C
Then D
Then E
Examples:
|statusCode |payload|
|"200" | "quantity:one;rollno:123;isStudent:true;isTeacher:true |
@tag2
scenario outline : scenario outline2
Given A
When B
When X
Then D
Then Y
Examples:
|statusCode |payload|
|"200" | "quantity:one;rollno:123;isStudent:false;isTeacher:false |
Share
Improve this question
edited Nov 27, 2024 at 2:33
Rahil Kumar
asked Nov 22, 2024 at 4:30
Rahil KumarRahil Kumar
4288 silver badges24 bronze badges
1 Answer
Reset to default 0you can use the following code.
Scenario Outline: Execute test case with specific flags
Given the system is in "<initial state>"
When I perform "<action>"
Then I expect "<result>"
Examples:
| initial state | action | result |
| logged out | login attempt | login successful |
| logged in | logout attempt | logout successful |
| logged in | invalid action | error displayed |
本文标签: selenium webdriverEnhanced Cucumber feature file scriptsStack Overflow
版权声明:本文标题:selenium webdriver - Enhanced Cucumber feature file scripts - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736305617a1932653.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论