kosent

An acceptance testing library

License

License

GroupId

GroupId

com.oneeyedmen
ArtifactId

ArtifactId

konsent
Last Version

Last Version

1.0.6
Release Date

Release Date

Type

Type

jar
Description

Description

kosent
An acceptance testing library
Project URL

Project URL

https://github.com/dmcg/konsent
Source Code Management

Source Code Management

https://github.com/dmcg/konsent

Download konsent

How to add to project

<!-- https://jarcasting.com/artifacts/com.oneeyedmen/konsent/ -->
<dependency>
    <groupId>com.oneeyedmen</groupId>
    <artifactId>konsent</artifactId>
    <version>1.0.6</version>
</dependency>
// https://jarcasting.com/artifacts/com.oneeyedmen/konsent/
implementation 'com.oneeyedmen:konsent:1.0.6'
// https://jarcasting.com/artifacts/com.oneeyedmen/konsent/
implementation ("com.oneeyedmen:konsent:1.0.6")
'com.oneeyedmen:konsent:jar:1.0.6'
<dependency org="com.oneeyedmen" name="konsent" rev="1.0.6">
  <artifact name="konsent" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.oneeyedmen', module='konsent', version='1.0.6')
)
libraryDependencies += "com.oneeyedmen" % "konsent" % "1.0.6"
[com.oneeyedmen/konsent "1.0.6"]

Dependencies

compile (4)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jre8 jar 1.1.51
com.natpryce : hamkrest jar 1.4.2.0
com.oneeyedmen : okeydoke jar 1.1.0
junit : junit jar 4.12

provided (1)

Group / Artifact Type Version
org.seleniumhq.selenium : selenium-java jar 2.53.0

test (1)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-test jar 1.1.51

Project Modules

There are no modules declared in this project.

Konsent

An acceptance testing library for Kotlin.

KonsentExampleTests shows how to write a test.

@RunWith(Konsent::class)
@Preamble(
    "As a developer named Duncan",
    "I want to know that example.com is up and running")
class KonsentExampleTests : ChromeAcceptanceTest() {

    val duncan = actorNamed("Duncan")

    @Scenario(1) fun `Example_dot_com loads`() {
        Given(duncan).loadsThePageAt("http://example.com")
        Then(duncan) {
            shouldSee(thePageLocation, pathContains("example.com"))
            shouldSee(thePageTitle, equalTo("Example Domain"))
            shouldSee(thePageContent, containsALink("More information...", "http://www.iana.org/domains/example"))
        }
    }

    @Scenario(2, "Following a link from example.com") fun cant_have_dots_in_quoted_method_names() {
        Given(duncan).loadsThePageAt("http://example.com")
        When(duncan).followsTheLink("More information...", "http://www.iana.org/domains/example")
        Then(duncan).shouldSee(thePageLocation, equalTo(URI("http://www.iana.org/domains/reserved")))
    }

    @Scenario(3) fun `Dispensing with the given when then`() {
        duncan.he.loadsThePageAt("http://example.com")
        duncan.he.followsTheLink("More information...", "http://www.iana.org/domains/example")
        duncan.he.shouldSee(thePageLocation, equalTo(URI("http://www.iana.org/domains/reserved")))
    }
}

This writes an approved file

Feature: Konsent Example Tests
    As a developer named Duncan
    I want to know that example.com is up and running

    Scenario: Example_dot_com loads
        Given Duncan loads the page at "http://example.com"
        Then he sees the page location "location contains "example.com"
        and the page title is equal to "Example Domain"
        and the page content contains a link [More information...](http://www.iana.org/domains/example)

    Scenario: Following a link from example.com
        Given Duncan loads the page at "http://example.com"
        When he follows the link [More information...](http://www.iana.org/domains/example)
        Then he sees the page location is equal to http://www.iana.org/domains/reserved

    Scenario: Dispensing with the given when then
        Duncan loads the page at "http://example.com"
        he follows the link [More information...](http://www.iana.org/domains/example)
        he sees the page location is equal to http://www.iana.org/domains/reserved

Konsent is available at Maven central.

Versions

Version
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
0.3.0
0.2.0
0.1.0