在小黄瓜语法中(由Cucumber和SpecFlow使用,我可以通过在前面添加'#'来注释掉一行
有没有办法阻止评论多行?
我有一些SpecFlow功能(使用Gherkin语法),我想暂时禁用该功能,以防止其测试运行?
是否有一个属性可以标记该功能来执行此操作?我猜测适用于Cucumber的东西也可能适用于SpecFlow.
Gherkin语法文件只是纯文本,因此可以使用任何编辑器,如记事本.但是,我们使用它的一个更重要的事情是提供样本数据表.没有良好的格式化选项,文件变得难以阅读.
对于visual studio,如specflow.org或https://github.com/henritersteeg/cuke4vs,有一些很好的工具(请参阅:如何在Visual Studio中为.feature文件突出显示Gherkin语法?).使用eclipse的开发人员的另一个选项在Cucumber IDE中讨论了使用自动完成功能编写功能吗?但是,我不想要求我们的业务分析师安装它.
这是一个语法高亮显示文件(http://productive.me/develop/cucumbergherkin-syntax-highlighting-for-notepad/),可以导入到notepad ++中,但它对表格格式没有任何作用.
我是否还有其他选择可以让非开发人员有效地编辑.feature小黄瓜文件?
我正在寻找一个带有pageObject设计模式和小黄瓜的代码的简单示例,因为当我遵循代码生成BDD文档时,所有示例都在tests/support/AcceptanceTester.php中编写.我不明白(英语技能差 - - )如何不将所有代码集中在AcceptanceTester.php文件中.
例如,我有一个带有两个按钮A和B的示例主页.如果用户单击按钮A,则加载页面A,否则如果用户单击按钮B,则加载页面B.
目前,我的AcceptanceTester:
<?php
// tests/_support/AcceptanceTester.php
/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class AcceptanceTester extends \Codeception\Actor
{
use _generated\AcceptanceTesterActions;
/**
* @Given The home …
Run Code Online (Sandbox Code Playgroud) 我有一个specflow步骤表,我希望将|
(管道)字符作为内容的一部分.
例:
Then the data should be
| Field | Value |
| SomeField | a|b|c |
Run Code Online (Sandbox Code Playgroud)
但这不起作用.我怎样才能逃脱管道角色?
在谷歌搜索此错误消息没有运气
features/manage_hand_evaluator.feature:features/manage_hand_evaluator.feature中的解析错误:21.在期待以下之一时找到示例:comment,py_string,row,scenario,scenario_outline,step,tag.(现状:步骤).(小黄瓜::分析器:: ParseError)
这是我为示例部分设置的(此时没有其他方案,只是在"功能:"部分之后的这个方案)
...
Scenario: Evaluating for current straights
Given I am a player with <hand>
When the board is <board>
Then the current possible straights should be <possibles>
Examples:
| board | hand | possibles |
| A23 | 45 | A2345 |
| 3456 | 23 | A2345,23456,34567,45678 |
| 789T | A2 | 56789,6789T,789TJ,89TJQ |
| 45678 | 23 | 23456,34567,45678,56789,6789T |
Run Code Online (Sandbox Code Playgroud)
我也已经为那些"Given,When,Then"行设置了步骤定义(当我替换时测试通过,并且有一些文本并注释掉"Examples"部分).所以似乎步骤定义设置得恰当,只是因为我在.feature文件中的内容存在某种解析问题,我无法弄清楚我做错了什么.
相关的宝石安装:小黄瓜(2.1.5)(尝试2.2.0,但它与我的黄瓜版本打破)黄瓜(0.8.5)黄瓜 - 铁路(0.3.2)导轨(2.3.8)
使用Test Automation的页面对象模型,我们将页面链接在一起,如下所示:
WebDriver driver = new WebDriver()
HomePage homePage = new HomePage(driver);
LoginPage loginPage = homePage.GoToLoginPage();
WelcomePage welcomePage = loginPage.Login();
etc
etc
Run Code Online (Sandbox Code Playgroud)
这样做的最大好处是,如果开发人员更改主页,使其不再链接到登录页面,我可以更新我的主页类,并在运行测试之前查看我需要更新的所有测试(有错误).
然而,对于小黄瓜,上面的每一行将形成一个单独的"步骤",因此是一个单独的方法.因此,如何进行这种连接?
是将页面对象类的实例(例如homePage,loginPage等)放入交叉gherkin语句持久性存储(例如specflow POCO或'World')的唯一方法吗?
我想让业务分析师能够使用Gherkin编写Cucumber友好的功能,场景和步骤的所有规范.
我已经阅读了github网站上的一些关于Cucumber的基本信息以及快速谷歌搜索,但想知道是否有推荐的资源让非技术人员能够使用Gherkin编写全面的BDD(我假设是用于创建黄瓜测试的首选语言.
谢谢.
我们正在Gherkin中构建规范,我们希望将这些功能文件呈现给业务利益相关者.我们如何以某种"漂亮"格式导出所有功能文件?
例如:
我们已经意识到在定义典型的CRUD场景时有两种指定测试数据的选项:
选项1:描述要使用的数据,并让实现定义数据
Scenario: Create a region
Given I have navigated to the "Create Region" page
And I have typed in a valid name
And I have typed in a valid code
When I click the "Save" button
Then I should be on the "Regions" page
And the page should show the created region details
Run Code Online (Sandbox Code Playgroud)
选项2:明确说明要使用的测试数据
Scenario: Create a region
Given I have navigated to the "Create Region" page
And I have filled out the form as follows
| Label | …
Run Code Online (Sandbox Code Playgroud)