简体   繁体   English

所有Codeception Gherkin .feature测试是否都在Context文件中结束吗?

[英]Do all Codeception gherkin .feature tests end up in Context files?

Moving to Codeception from Behat and still getting used to it's concepts & where things go. 从Behat转到Codeception,仍然习惯它的概念和发展方向。

In the hypothetical that my tests are 100% driven from .feature files, does this mean that all of the test code could be in Contexts? 假设我的测试100%由.feature文件驱动,这是否意味着所有测试代码都可以在Context中使用? That there wouldn't be anything in any functional tests that extend PHPUnit_Framework_TestCase? 在任何扩展PHPUnit_Framework_TestCase的功能测试中都没有任何东西吗? (Assuming that all my functional tests would extend that) (假设我所有的功能测试都可以对此进行扩展)

Codeception is not driven by Gherkin as Behat is. 编码接收不是像Behat那样由Gherkin驱动的。 If you are moving away from Behat you will write functions in classes in Codeception directly and you are not going to start from a Gherkin script to then derive the executable specs (in your contexts files, page objects). 如果您要离开Behat,您将直接在Codeception中的类中编写函数,而您不会从Gherkin脚本开始然后继承可执行规范(在您的上下文文件中,页面对象)。

In brief the two flows 简而言之,两种流程

Behat 贝哈特

  1. Write the BDD scripts/Gherkin - features. 编写BDD脚本/小黄瓜功能。 These are totally abstract and should usually be logic descriptions of the use cases your system implements. 这些是完全抽象的,通常应该是系统实现的用例的逻辑描述。 A product owner can start writing this for instance when a user story is created. 例如,当创建用户故事时,产品所有者可以开始编写此内容。 Requires no programming logic 无需编程逻辑
  2. For each line in the feature implement an executable specification (a function in a Context class) that handles that action 对于功能中的每一行,请执行可执行的规范 (Context类中的函数)以处理该操作
  3. In Behat usually you also use Page objects (unsure if this can also be done in Codeception but I dont see why not if you can import the Page Object library) 在Behat中,通常还使用Page对象(不确定是否也可以在Codeception中完成此操作,但我不明白为什么不能导入Page Object库)

Codeception Codeception

  1. You write executable specifications as a first step for instance in a Cept class. 例如,您要在Cept类中编写可执行文件规范。 A developer is needed here as this is actual PHP Code/Classes 这里需要开发人员,因为这是实际的PHP代码/类
  2. When you run codeception then it prints out a list of all the statements it has run, just like a report. 当您运行代码接收时,它将打印出已运行的所有语句的列表,就像报告一样。

The above is a very simplified description as your question is also very generic. 上面的描述非常简单,因为您的问题也很笼统。 I hope it answers your question 我希望它能回答您的问题

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

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