组织 JBehave 故事

发布于 2024-09-29 22:17:44 字数 165 浏览 11 评论 0原文

我们刚刚开始考虑使用 JBehave 进行验收测试,我想知道使用它的人们如何组织故事的编写和故事文件的存储。目前只是进行开发,因此我们将故事文件与实现它们的 Java 代码一起存储在资源文件夹中。

我想我真正的问题是你如何以及在哪里存储你的故事文件,以及这如何与产品所有者或 QA 编写故事一起工作?

We've just started looking at using JBehave for acceptance tests and I was wondering how people that are using it are organising the writing of stories and the storage of story files. It's just development that are working on them at the moment so we have the story files stored in the resources folder alongside the Java code to implement them.

I guess my actual question is how and where are you storing your story files and how does this work with the product owner or QA writing stories?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小梨窩很甜 2024-10-06 22:17:44

@威格斯先生
正如 t0rx 所说,您很幸运有 QA 来编写故事/场景。
回答您的问题:
行为驱动开发鼓励您开始通过表达所需的场景来定义故事文本格式的行为。

您可以通过在 Maven (pom.xml) 中配置来运行 JBehave Stories。

您可以在包结构中创建一个文件夹来存储您的故事文件,如下所示:

Your_Project
      |
      |
      |--Source_Code
      |
      |--Stories
      |
      |--Testing
      |
      *pom.xml

通过在 Maven 中配置您的故事,每次构建项目时,它都会给出成功和失败的故事/场景结果。
QA 会更新 Stories 文件夹中的场景,开发人员将通过省略现有步骤(已经开发并在其他场景中出现)来逐步实现场景。
QA 只需运行场景/故事,他就会以文本(可理解的)格式找到结果。
就像下面这样:
在此处输入图像描述

测试级别的行为驱动开发。
在此处输入图像描述

一些 JBehave 功能专注于轻松组织。

  • 基于注释的配置和 Steps 类规范
  • 依赖注入支持允许通过您最喜欢的容器(Guice、PicoContainer、Spring)组成配置和 Steps 实例。
  • 可扩展的故事报告:输出以不同的人类可读的基于文件的格式(HTML、TXT、XML)执行的故事。完全可样式化的视图。
  • 自动生成待处理步骤,因此构建不会因缺少步骤而中断,但可以选择为待处理步骤配置中断构建。
  • 用户故事本地化,允许用任何语言编写。
  • IDE 集成:故事可以作为 JUnit 测试或其他基于注释的单元测试框架运行,从而可以轻松地与您喜欢的 IDE 集成。
  • Ant 集成:允许通过 Ant 任务运行故事
  • Maven 集成:允许在给定构建阶段通过 Maven 插件运行故事

@MrWiggles
as t0rx told you are lucky to have QA to write stories/scenarios.
coming to your question:
Behaviour-Driven Development encourages you to start defining the stories via scenarios that express the desired behavior in a textual format.

JBehave Stories you can run by configuring in Maven (pom.xml).

You can make a folder for storing your story files in your package structure, like below:

Your_Project
      |
      |
      |--Source_Code
      |
      |--Stories
      |
      |--Testing
      |
      *pom.xml

By configuring your stories in maven, every time you build project it will give result with succeeded and failed stories/scenarios results.
QA will update the scenarios in the folder Stories, and the developer will implement the scenarios step by step by omitting existing steps (which are already developed and came in other scenarios).
QA simply run the scenario/story and he will find out the result in a textual (understandable) format.
Like below:
enter image description here

Behaviour-Driven Development in test levels.
enter image description here

Some of the JBehave features concentrate on easy organizing.

  • Annotation-based configuration and Steps class specifications
  • Dependency Injection support allowing both configuration and Steps instances composed via your favourite container (Guice, PicoContainer, Spring).
  • Extensible story reporting: outputs stories executed in different human-readable file-based formats (HTML, TXT, XML). Fully style-able view.
  • Auto-generation of pending steps so the build is not broken by a missing step, but has option to configure breaking build for pending steps.
  • Localisation of user stories, allowing them to be written in any language.
  • IDE integration: stories can be run as JUnit tests or other annotation-based unit test frameworks, providing easy integration with your favourite IDE.
  • Ant integration: allows stories to be run via Ant task
  • Maven integration: allows stories to be run via Maven plugin at given build phase
萌酱 2024-10-06 22:17:44

如果您足够幸运,让产品负责人或 QA 编写故事,那么您可能希望将它们放在源代码存储库的特定区域中,这样您就可以独立于主源来控制访问(并且在 CI 构建时为您提供更大的灵活性)。如果您这样做,则会触发)。

您可能会发现大量的来回操作,以最大限度地减少开发人员必须编写的新步骤的数量(即使用十种不同的方式来阻止他们编写相同的步骤),因此还需要以待处理的步骤运行,而不是使场景失败(这是开箱即用的默认设置)。

另一种方法是,QA/产品负责人将场景发送给开发人员,然后由开发人员在添加到源代码控制之前清理它们,但这会将精力重新放在开发人员身上。

If you are lucky enough to have the product owner or QA writing stories then you probably want them in a specific area of your source code repository so you can control access independently from your main source (and also give you more flexibility with when CI builds are triggered if you're doing that).

You'll likely find a lot of back-and-forth to minimise the number of new steps the devs have to write (i.e. stop them using ten different ways to write the same step), so will also need to run with pending steps not failuring the scenario (which is the default out of the box).

An alternative approach is that QA/product owner send scenarios to the devs who then cleanse them before adding to source control, but this puts effort back on the devs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文