mkutz/spock-manual-extension

语言: Groovy

git: https://github.com/mkutz/spock-manual-extension

扩展Spock框架中的手动测试计划(
Extension for manual test plans in the Spock framework (
README.md (中文)

Spock手动扩展

Build Status Coverage Status
Maven Central

使用Spock框架定义手动测试用例规范的扩展。

执行标记为@Manual的规范时,测试将被设置为“忽略”,并且块注释将被写入测试计划文件。

鉴于此规范

package de.assertagile.spockframework.extensions.demonstration

import de.assertagile.spockframework.extensions.Manual
import spock.lang.Issue
import spock.lang.Specification
import spock.lang.Title

@Manual
@Title("My manual spec is manual")
@Issue("STY-4711")
class MyManualSpec extends Specification {

    @Issue("http://assertagile.de/issues/BUG-42")
    def "this is a manual tested feature description"() {
        given: "the user is logged in"
        when: "the user clicks the logout button"
        then: "the user is at the start page"
        and: "the login button is visible"
    }

    @Issue(["http://assertagile.de/issues/STY-4712", "http://assertagile.de/issues/BUG-666", "http://issues.com/4711"])
    def "this is a manual tested feature description with additional information"() {
        given: "the user is not logged in"
        when: "the user enters unknown credentials"
        then: "the user stayed at the start page"
        and: "the login button is visible"
    }
}

和以下SpockManualConfig.groovy文件:

import de.assertagile.spockframework.extensions.MarkDownTestPlanBuilder

Locale locale = Locale.ENGLISH
String issueTrackerBaseUrl = "http://assertagile.de/issues"
boolean markManualTestsAsExcluded = true

testPlanBuilders = [
    new MarkDownTestPlanBuilder("target/test_plan.md", issueTrackerBaseUrl, locale),
    new CsvTestPlanBuilder("target/test_plan.csv", issueTrackerBaseUrl, locale)
]

在IDE中执行规范或通过mvn测试时,您将在以下位置找到以下测试计划 目标/ test_plan.md:

#Manual Test Plan

##My manual spec is manual
[STY-4711](http://assertagile.de/issues/STY-4711)

###this is a manual tested feature description
[BUG-42](http://assertagile.de/issues/BUG-42)

- *Given* the user is logged in
- *When* the user clicks the logout button
- *Then* the user is at the start page
- *And* the login button is visible


###this is a manual tested feature description with additional information
[STY-4712](http://assertagile.de/issues/STY-4712), [BUG-666](http://assertagile.de/issues/BUG-666), [http://issues.com/4711](http://issues.com/4711)

- *Given* the user is not logged in
- *When* the user enters unknown credentials
- *Then* the user stayed at the start page
- *And* the login button is visible

还有一个在target / test_plan.csv

"specification";"feature";"steps";"issues"
"My manual spec is manual";"this is a manual tested feature description";"Given the user is logged in
When the user clicks the logout button
Then the user is at the start page
And the login button is visible";"STY-4711 (http://assertagile.de/issues/STY-4711)
BUG-42 (http://assertagile.de/issues/BUG-42)"
"My manual spec is manual";"this is a manual tested feature description with additional information";"Given the user is not logged in
When the user enters unknown credentials
Then the user stayed at the start page
And the login button is visible";"STY-4711 (http://assertagile.de/issues/STY-4711)
STY-4712 (http://assertagile.de/issues/STY-4712), BUG-666 (http://assertagile.de/issues/BUG-666), http://issues.com/4711 (http://issues.com/4711)"

用法

要使用此扩展,您需要在项目测试资源路径中创建一个Groovy配置脚本 SpockManualConfig.groovy。 在默认的Maven项目中,文件应位于src / test / resources中。 要生成测试计划,您需要至少配置一个TestPlanBuilder。

延期

目前只有MarkDownTestPlanBuilder和CsvTestPlanBuilder,但您可以随时创建更多。只需扩展TestPlanBuilder 并将其添加到您的SpockManualConfig.groovy

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

Spock Manual Extension

Build Status Coverage Status
Maven Central

Extension to define manual test case specification using the Spock framwork.

When executing a Specification marked @Manual the test will be set "ignored" and the block comments will be written to a test plan file.

Example

Given this Specification

package de.assertagile.spockframework.extensions.demonstration

import de.assertagile.spockframework.extensions.Manual
import spock.lang.Issue
import spock.lang.Specification
import spock.lang.Title

@Manual
@Title("My manual spec is manual")
@Issue("STY-4711")
class MyManualSpec extends Specification {

    @Issue("http://assertagile.de/issues/BUG-42")
    def "this is a manual tested feature description"() {
        given: "the user is logged in"
        when: "the user clicks the logout button"
        then: "the user is at the start page"
        and: "the login button is visible"
    }

    @Issue(["http://assertagile.de/issues/STY-4712", "http://assertagile.de/issues/BUG-666", "http://issues.com/4711"])
    def "this is a manual tested feature description with additional information"() {
        given: "the user is not logged in"
        when: "the user enters unknown credentials"
        then: "the user stayed at the start page"
        and: "the login button is visible"
    }
}

and the following SpockManualConfig.groovy file:

import de.assertagile.spockframework.extensions.MarkDownTestPlanBuilder

Locale locale = Locale.ENGLISH
String issueTrackerBaseUrl = "http://assertagile.de/issues"
boolean markManualTestsAsExcluded = true

testPlanBuilders = [
    new MarkDownTestPlanBuilder("target/test_plan.md", issueTrackerBaseUrl, locale),
    new CsvTestPlanBuilder("target/test_plan.csv", issueTrackerBaseUrl, locale)
]

When executing the Specification in your IDE or via mvn test you will find the following test plan at
target/test_plan.md:

#Manual Test Plan

##My manual spec is manual
[STY-4711](http://assertagile.de/issues/STY-4711)

###this is a manual tested feature description
[BUG-42](http://assertagile.de/issues/BUG-42)

- *Given* the user is logged in
- *When* the user clicks the logout button
- *Then* the user is at the start page
- *And* the login button is visible


###this is a manual tested feature description with additional information
[STY-4712](http://assertagile.de/issues/STY-4712), [BUG-666](http://assertagile.de/issues/BUG-666), [http://issues.com/4711](http://issues.com/4711)

- *Given* the user is not logged in
- *When* the user enters unknown credentials
- *Then* the user stayed at the start page
- *And* the login button is visible

and one more at target/test_plan.csv

"specification";"feature";"steps";"issues"
"My manual spec is manual";"this is a manual tested feature description";"Given the user is logged in
When the user clicks the logout button
Then the user is at the start page
And the login button is visible";"STY-4711 (http://assertagile.de/issues/STY-4711)
BUG-42 (http://assertagile.de/issues/BUG-42)"
"My manual spec is manual";"this is a manual tested feature description with additional information";"Given the user is not logged in
When the user enters unknown credentials
Then the user stayed at the start page
And the login button is visible";"STY-4711 (http://assertagile.de/issues/STY-4711)
STY-4712 (http://assertagile.de/issues/STY-4712), BUG-666 (http://assertagile.de/issues/BUG-666), http://issues.com/4711 (http://issues.com/4711)"

Usage

To use this extension you need to create a Groovy config script in you projects test resources path named
SpockManualConfig.groovy.
In default Maven projects the file should be located in src/test/resources.
In order to generate a test plan, you need to configure at least one TestPlanBuilder.

Extension

Currently there is only MarkDownTestPlanBuilder and CsvTestPlanBuilder, but you can always create more. Just extend TestPlanBuilder
and add it to your SpockManualConfig.groovy