简体   繁体   English

跳过方案黄瓜javascript

[英]skip scenario cucumber javascript

I am a newbie to cucumber and don't find any relevant information in a cucumber javascript version Basically, I am having 3 scenarios "a", "b" and "c" in a feature file, "a" is the setup scenario which has the login step for example. 我是黄瓜的新手,在黄瓜javascript版本中找不到任何相关信息基本上,我在功能文件中有3个场景“ a”,“ b”和“ c”,“ a”是设置场景例如具有登录步骤。 "b" and "c" are the actual test scenarios for my UI. “ b”和“ c”是我的UI的实际测试方案。 So if scenario "a" fails(login fails), I want "b" and "c" to be skipped and reported as skipped in the output JSON file. 因此,如果方案“ a”失败(登录失败),我希望跳过“ b”和“ c”,并在输出JSON文件中将其报告为跳过。 Can someone please help me out giving an example of how to achieve this? 有人可以帮我举例说明如何实现这一目标吗? I need some kind of way to skip scenarios in the form of before and after in the hooks. 我需要某种方式来以钩子之前和之后的形式跳过方案。

Note: The cucumber version that I am using is 2.3.1 注意:我使用的黄瓜版本是2.3.1

At first glance (as apparent by my edit history), I read that you wanted to skip scenarios, but I didn't read on further. 乍一看(从我的编辑历史中可以明显看出),我读到您想跳过场景,但是我没有进一步阅读。

What you're asking for is not how cucumber was meant to be used. 您要的不是黄瓜的用途。

Each of the scenarios within cucumber should be completely independent of each other, and should not rely on the outcome of previous scenarios to determine whether or not it should continue with others. 黄瓜中的每个方案都应完全相互独立,并且不应依赖先前方案的结果来确定是否应与其他方案继续进行。

If you're doing set up steps for everything in the feature file: 如果要为功能文件中的所有内容设置步骤:

Background:
   Given I am logged in as "Jerry Tarpin"
   And I am browsing the "search" page

Scenario: ....
   ...

The Background runs for each Scenario within. Background针对其中的每个Scenario运行。

If you don't want to log in more than once per feature, in your log in step, check if there is a user logged in, and if it's the right person, don't log in, if it's the wrong person, log out and log in again, and if there is nobody logged in, just log in. 如果您不想每个功能多次登录,请在登录步骤中检查是否有用户登录,如果是正确的人,则不要登录,如果是错误的人,请登录退出并再次登录,如果没有人登录,请登录。

Skipping scenarios in your Before and After hooks means that you'll be less equipped to be able to identify problems with the site under test, especially if there isn't actually a bug on the page, and your site just took longer than usual to load the correct page. 在“之前”和“之后”挂钩中跳过场景意味着您将没有能力识别被测站点的问题,尤其是如果页面上实际上没有错误,并且您的站点花了比平时更长的时间时加载正确的页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM