TestCafe 团队是否计划正式支持 Gherkin (BDD)?如果不是,目前将 TestCafe 与 Gherkins 集成的最佳方式是什么?

Is the TestCafe team planning to support Gherkin (BDD) officially? If not what is the best way of integrating TestCafe with Gherkins at the moment?

我的团队有点喜欢 TestCafe,但对采用它有一些保留意见。主要的是支持 Gherkin 集成。 gherkin-testcafe npm 包和示例 https://github.com/helen-dikareva/testcafe-cucumber-demo 似乎还没有准备好迎接黄金时段。

目前支持 BDD 的方式是否更可靠?

我来自 TestCafe 团队。现在,我们不打算在不久的将来添加此功能。但我想 gherkin-testcafe 是一个很好的开始模块。这是一个开源模块,因此社区很有可能会添加所需的功能。如果你愿意,你可以自己动手做。

在与办公室的同事交谈后,我们得出结论,

  • 保持我们的 BDD 流程,
  • 使用 TestCafe 和
  • 在 Typescript 中编写测试而不添加对 javascript 不是最可靠的包的依赖性

只是在编写 TestCafe 测试时使用一些约定。例如,假设您获得了以下 Gherkin 文件:

Feature: Application
As an administrator
I want to be able to view and manage Applications in my account

Scenario: Verify creating and deleting an application
    Given I am in the login page
    When I login to console with allowed user
    And I go to Applications page
    And I add an application
    Then the application is added in the application page

然后 feature.ts 文件将如下所示:

import {Selector} from 'testcafe';
import {LoginPageModel} from '../pagemodels/login.pagemodel';
import {ApplicationPageModel} from '../pagemodels/application.pagemodel';

let applicationPageModel: ApplicationPageModel = new ApplicationPageModel();
let loginPageModel: LoginPageModel = new LoginPageModel();

fixture(`Feature: Application
   As a administrator
   I want to be able to view and manage Applications in my account
 `);

let scenarioImplementation = async t => {
  let stepSuccess: boolean;

  stepSuccess = await loginPageModel.goToPage(t);
  await t.expect(stepSuccess).eql(true, 'Given I am in the login page');

  stepSuccess = await loginPageModel.login(t);
  await t.expect(stepSuccess).eql(true, 'When I login to console with 
  allowed user');

  stepSuccess = await applicationPageModel.selectPage(t);
  await t.expect(stepSuccess).eql(true, 'And I go to Applications page');

  stepSuccess = await applicationPageModel.addApplication(t);
  await t.expect(stepSuccess).eql(true, 'And I add an application');

  stepSuccess = await applicationPageModel.verifyAddedApplication(t);
  await t.expect(stepSuccess).eql(true, 'Then the application is added in 
  the application page');

 };

test(`Scenario: Verify creating and deleting an application
   Given I am in the login page
   When I login to console with allowed user
   And I go to Applications page
   And I add an application
   Then the application is added in the application page`, 
                                            scenarioImplementation);