问题标签 [jgiven]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1197 浏览

java - JGiven parameterized with DataProvider fails with "method 'name' should have no parameters"

I am working on JGiven framework for my tests (already a big fan!). I have an issue though working with @DataProvider

I was going through the documentation http://jgiven.org/docs/parameterizedscenarios/ but I get the following error

My Test class is as follows

Thank You!

0 投票
2 回答
365 浏览

playframework - 使用 SBT 为 JGiven 生成 HTML 报告

我在我的一个 Play 2.3.x 应用程序中使用 JGiven 进行测试。该文档解释了如何为 Maven 和 Gradle 生成 HTML 报告。但是 SBT 没有任何可用的东西。

是否有任何解决方法可以在测试结束时生成报告?也许通过添加一些东西build.sbt?我尝试使用“测试中的 javaOptions”,但不知道如何使其工作。

谢谢。

0 投票
1 回答
301 浏览

spring - @BeforeScenario issues in JGiven Stage (with Spring Support)

Enjoying using JGiven with it's Spring support!

However, I'm having issues with @Autowired playing nice with @BeforeScenario in a Stage class (annoted with @JGivenStage. I have a minimal spring configuration (which reads a couple of property files, scans for components etc) and is denoted with @EnableJGiven i.e.

I'm tyring to create a JGiven scenario which has several methods but only does setup once (as it takes several minutes) inside the Given stage. The feature e.g. MyFeatureTest (names changed for brevity) is as follows: -

My MyGiven class is as follows: -

What i'm trying to achieve is that when I run a scenario (or several tests of a scenario) that the setup setupSingleAnalysedUpload() method is only called once (as it's very slow).

My approach was to annotate this method with the @BeforeScenario annotation. However, the protected QaApi qaApi; is null (doesn't get initialised via the @Autowired annotation).

Note - If I comment out the setupSingleAnalysedUpload method and stick a breakpoint on homePage.visit().login line then QaApi is initialised without issue - assuming spring life-cycling issues with @BeforeScenario annotation.

Completely stomped - my gut feeling is that there is missing functionality in the jgiven-spring library? If so, what is the best-practice work around?

0 投票
3 回答
11228 浏览

java - 如何在黄瓜的特征背景“给定”语句中传递变量?

我可以VARIABLE在上述背景给定的声明中使用吗?我想从属性文件中传递这个 VARIABLE 值。

0 投票
1 回答
142 浏览

spring - JGiven 逐行显示验收测试运行

是否可以使用 JGiven(有或没有 Spring 支持)在执行之前/期间检索语句?例如,如果我们有一个相当典型的登录验收测试,即

是否有可能获得对以下信息的访问权限?

即我正在寻找的是: -

  1. 场景方法的名称 + 所有它的、 和given语句when调用_(通过 JGiven 格式格式化)。thenand
  2. 当每个场景方法在运行时启动时。
  3. 当每个given、和在运行when时执行时。thenand
  4. 当场景方法结束时。

这将使我能够在 UI 中直观地显示 (a) 将要执行的确切内容和 (2) 它在执行期间的当前位置(带有持续时间)。

我在想 Spring AOP 可能会在这里救援?或者 JGiven 是否提供了隐藏在其代码中的任何有用的东西?

0 投票
1 回答
217 浏览

java - jGiven 输出目录

有没有办法将生成的报告的输出目录更改为自定义目录 - 特别是 .json-Report 文件?

文档说(http://jgiven.org/userguide/ - 4.2):

[...] JGiven 尝试自动检测它何时由 Maven surefire 插件 [我正在使用它] 执行,并在这种情况下将报告生成到 target/jgiven-reports/json 中。[...]

我将 jGiven 与 Maven 一起使用(用于 Appium 测试)。

配置(pom.xml - 依赖项):

配置(pom.xml - 构建/插件):

由于该目录是由 jGiven 定义的,因此更改构建目录无济于事。它仍然会使用该target/jgiven-reports/json目录。

提前致谢!

0 投票
1 回答
112 浏览

java - JGiven本地化介绍词

我正在开发一个用法语定义域的项目。我正在使用 JGiven 编写测试,并且正在尝试完全用法语获取报告。我通过继承SpringScenarioTest我的测试类来使用 Spring Test 基础设施。

这是我所做的一个例子:

我发现了如何在我的课程中翻译类似and()with()使用@IntroWord注释的介绍词Stage,但是如何翻译given(),when()then()介绍词?

问题似乎是这些介绍词是由Scenario该类创建的ScenarioTestBase类定义的,我找不到一种方法来覆盖这种行为而不重写整个类层次结构。

有没有办法做到这一点?

谢谢

0 投票
2 回答
457 浏览

spring - 是否可以将“JGiven Spring”与“JGiven JUnit 5”结合使用?

不幸的是,我的方法没有自动装配 spring bean。我使用了 JGiven 的 0.17.0 版本。

以下测试失败并出现 NullPointerException,因为 HelloWorldStage 类中的 spring bean 'messageService' 为空。

摇篮:

测试类:

阶段:

春豆:

0 投票
1 回答
59 浏览

java - 在 JGiven 的测试场景中实现测试用例

提供了一个包含多行的文件,该文件由数据库中的(接受中的)系统加载。一个基于 JGiven 的简单测试场景将检查文件的行数是否与相应的表行匹配。Java 1.8 中模型实现的 maven 测试执行提供了以下内容(第一个输出):

但是,不提供用于加载的文件是一个有效的选项。所以,我们有两个测试用例,maven 测试应该提供类似(第二个输出):

我们如何结合这两个测试用例,以便根据文件的存在,我们在任何一种情况下都有一个“通过”测试,知道是否提供了文件? 或者 有没有办法创建类似于JGiven 本身的 HTML 报告 (第三个输出):

第一个输出的实现如下:

加载测试类

GivenWeHaveFile2Load 类

WhenFileAndDatabaseAreChecked 类

ThenCheckIfNoOfFileLinesMatchesNoOfTableRows 类

0 投票
1 回答
53 浏览

jgiven - 使用 JGiven 进行 Rest API 测试

我对 JGiven 很陌生,目前我有一组使用 Rest Assured 和 TestNG 框架自动化的 REST API 测试。我还在探索将 JGiven 作为一个框架来运行 API 测试,以了解它提供的人类可读的优势以及它生成的报告。Rest Assured 作为一个库,让我们可以注入 URL 并实际进行 REST 调用。我想了解我们在 JGiven 中是否有这样的能力来实际进行 REST 调用。如果是这样,我想看一个例子并了解我如何做到这一点。如果没有,有人可以建议并建议使用 JGiven 实现它的最佳方法。我一直在尝试搜索这些信息,但到目前为止一直在努力。

提前致谢。