-
Notifications
You must be signed in to change notification settings - Fork 42
Should work for cucumber scenario outlines #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name := "cucumber-test" | ||
|
||
organization := "com.waioeka.sbt" | ||
|
||
version := "0.0.4" | ||
|
||
scalaVersion := "2.12.2" | ||
|
||
libraryDependencies ++= Seq ( | ||
"org.scalatest" %% "scalatest" % "3.0.1" % "test", | ||
"io.cucumber" % "cucumber-core" % "2.0.0" % "test", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a transitive dependency of |
||
"io.cucumber" %% "cucumber-scala" % "2.0.0" % "test", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a rather old version. Latest is 4.7.1 https://search.maven.org/search?q=g:%22io.cucumber%22%20AND%20a:%22cucumber-scala_2.12%22 |
||
"io.cucumber" % "cucumber-jvm" % "2.0.0" % "test", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a pom dependency and not required. |
||
"io.cucumber" % "cucumber-junit" % "2.0.0" % "test", | ||
"com.novocode" % "junit-interface" % sys.props("project.version") % "test") | ||
|
||
def before() : Unit = { println("beforeAll") } | ||
def after() : Unit = { println("afterAll") } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@my-tag | ||
Feature: Multiplication | ||
In order to avoid making mistakes | ||
As a dummy | ||
I want to multiply numbers | ||
|
||
Scenario Outline: Multiply two variables | ||
Given a variable x with value <x> | ||
And a variable y with value <y> | ||
When I multiply x * y | ||
Then I get <z> | ||
Examples: | ||
| x | y | z | | ||
| 1 | 1 | 1 | | ||
| 2 | 3 | 1 | | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (c) 2015, Michael Lewis | ||
* All rights reserved. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems problematic. If we're doing Lightbend CLA the copy right needs to transfer to Lightbend. |
||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
package com.waioeka.sbt | ||
|
||
import cucumber.api.scala.{ScalaDsl, EN} | ||
import org.scalatest.Matchers | ||
|
||
|
||
/** | ||
* AddAndMultiplySteps | ||
* | ||
*/ | ||
class MultiplicationSteps extends ScalaDsl with EN with Matchers { | ||
var x : Int = 0 | ||
var y : Int = 0 | ||
var z : Int = 0 | ||
|
||
|
||
Given("""^a variable x with value (\d+)$""") { (arg0: Int) => | ||
x = arg0 | ||
} | ||
|
||
Given("""^a variable y with value (\d+)$""") { (arg0: Int) => | ||
y = arg0 | ||
} | ||
|
||
When("""^I multiply x \* y$""") { () => | ||
z = x * y | ||
} | ||
|
||
Then("""^I get (\d+)$""") { (arg0: Int) => | ||
z should be (arg0) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package cucumber | ||
|
||
import cucumber.api.CucumberOptions | ||
import cucumber.api.junit.Cucumber | ||
import org.junit.runner.RunWith | ||
|
||
@RunWith(classOf[Cucumber]) | ||
@CucumberOptions( | ||
features = Array("classpath:features"), | ||
glue = Array("com.waioeka.sbt"), | ||
strict = true, | ||
) | ||
class CucumberApplicationSpec | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# run the cucumber tests and see them fail | ||
-> test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reported
now goes unused.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AbstractEvent
should probably exposeDescription
, andreported
should use the description's identity to track whether the event has been posted or not.