Skip to content

Commit 191b383

Browse files
committed
removed behavior alias
1 parent 4d8f5f8 commit 191b383

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+343
-380
lines changed

CHANGELOG

+6-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ m d, yyyy
1010
- `gwen.rp.heartbeat` renamed to `gwen.rp.heartbeat.enabled`
1111
- Changed settings defaults:
1212
- `gwen.associative.meta = true` instead of `false`
13-
- `gwen.behavior.rules = strict` instead of `lenient`
13+
- `gwen.behaviour.rules = strict` instead of `lenient`
1414
- `gwen.feature.mode = declarative` instead of `imperative`
1515
- `gwen.report.suppress.meta = true` instead of `false`
1616
- `gwen.auto.discover.data.csv = false` instead of `true`
17+
- Removed settings alias
18+
- `gwen.behavior.rules` in favor of `gwen.behaviour.rules`
1719
- New settings
1820
- Configurable output directory
1921
- `gwen.output.dir` (default = target)
@@ -277,8 +279,8 @@ March 11, 2020
277279
2.25.0
278280
======
279281
March 8, 2020
280-
- Introduce behavior rules setting to enforce good Gherkin style
281-
- `gwen.behavior.rules=strict|lenient`
282+
- Introduce behaviour rules setting to enforce good Gherkin style
283+
- `gwen.behaviour.rules=strict|lenient`
282284
- `strict`: The following rules are enforced in feature files with violations reported as errors:
283285
- Steps in scenarios and backgrounds must satisfy *Given-When-Then* order
284286
- *Given* steps must set context
@@ -897,7 +899,7 @@ Feb 29, 2016, 8:50 PM GMT+11 (AEDT)
897899
interval can be set through the `gwen.rampup.interval.seconds` setting
898900
This setting is only applicable for parallel execution mode. If it is
899901
not set or is set to zero, then no staggering will occur (as per default
900-
behavior).
902+
behaviour).
901903
- Added new `gwen.report.suppress.meta` setting for controlling whether or
902904
not meta reports should be generated with HTML reports (default value is
903905
false). If you have a lot of meta, suppressing the meta reports can

README.md

-39
Original file line numberDiff line numberDiff line change
@@ -17,50 +17,11 @@ Visit the [Gwen home page](https://gweninterpreter.org) for our user documentati
1717
- [Latest release](https://github.com/gwen-interpreter/gwen/releases/latest)
1818
- [Change log](CHANGELOG)
1919

20-
### What's New?
21-
22-
- [Doc Strings as Parameters](https://github.com/gwen-interpreter/gwen/wiki/Doc-Strings/_edit#doc-strings-as-parameters)
23-
- [Report Portal integration](https://github.com/gwen-interpreter/gwen/wiki/Report-Portal-Integration) for centralised reporting and real-time analytics.
24-
- [Masked Settings](https://github.com/gwen-interpreter/gwen/wiki/Runtime-Settings#masked-settings) to make all your private and sensitive settings appear as `●●●●●` in all Gwen logs, reports, errors and console outputs
25-
2620
System Requirements
2721
-------------------
2822

2923
- Java 8 (version 1.8) or higher
3024

31-
Key Features
32-
------------
33-
34-
- Integrated [Gherkin](https://cucumber.io/docs/reference) parser from Cucubmer
35-
- [Runtime settings](https://github.com/gwen-interpreter/gwen/wiki/Runtime-Settings)
36-
- [Evaluation engines](https://github.com/gwen-interpreter/gwen/wiki/Evaluation-Engines)
37-
- [Evaluation reports](https://github.com/gwen-interpreter/gwen/wiki/Evaluation-Reports)
38-
- [Command line interface](https://github.com/gwen-interpreter/gwen/wiki/Command-Line-Interface)
39-
- [REPL console](https://github.com/gwen-interpreter/gwen/wiki/REPL-Console)
40-
- [Serial execution](https://github.com/gwen-interpreter/gwen/wiki/Execution-Modes#serial-execution)
41-
- [Parallel execution](https://github.com/gwen-interpreter/gwen/wiki/Execution-Modes#parallel-execution) for features or scenarios
42-
- [Dry run execution and validation](https://github.com/gwen-interpreter/gwen/wiki/Execution-Modes#dry-run-validation)
43-
- [Data driven execution](https://github.com/gwen-interpreter/gwen/wiki/Execution-Modes#data-driven-execution)
44-
- [Meta features](https://github.com/gwen-interpreter/gwen/wiki/Meta-Features)
45-
- [Composable step definitions](https://github.com/gwen-interpreter/gwen/wiki/Meta-Features#composable-step-definitions)
46-
- [Runtime settings](https://github.com/gwen-interpreter/gwen/wiki/Runtime-Settings)
47-
- [User settings](https://github.com/gwen-interpreter/gwen/wiki/User-Settings)
48-
- [String interpolation](https://github.com/gwen-interpreter/gwen/wiki/String-Interpolation)
49-
- [SQL data bindings](https://github.com/gwen-interpreter/gwen/wiki/SQL-Data-Bindings)
50-
- [Implicit attributes](https://github.com/gwen-interpreter/gwen/wiki/Implicit-Attributes)
51-
- [Template matching](https://github.com/gwen-interpreter/gwen/wiki/Template-Matching)
52-
- Hard, soft, and sustained [Assertion modes](https://github.com/gwen-interpreter/gwen/wiki/Assertion-Modes)
53-
- [Synchronized StepDef execution](https://github.com/gwen-interpreter/gwen/wiki/Synchronized-StepDefs)
54-
- Hard, soft, and sustained [Assertion modes](https://github.com/gwen-interpreter/gwen/wiki/Assertion-Modes)
55-
- Supports full Gherkin syntax including [example mapping](https://cucumber.io/blog/2015/12/08/example-mapping-introduction)
56-
- [State levels](https://github.com/gwen-interpreter/gwen/wiki/State-Levels) and [parallel execution](https://github.com/gwen-interpreter/gwen/wiki/Execution-Modes#parallel-scenario-execution) for scenarios in additon to features
57-
- [Declarative feature mode](https://github.com/gwen-interpreter/gwen/wiki/Runtime-Settings#gwenfeaturemode) to force all imperative steps to meta and promote cleaner features.
58-
- [Associative meta](https://github.com/gwen-interpreter/gwen/wiki/Runtime-Settings#gwenassociativemeta)
59-
- [Behavior rules](https://github.com/gwen-interpreter/gwen/wiki/Runtime-Settings#gwenbehaviorrules) to help enforce good Gherkin style
60-
- [Dialects](https://github.com/gwen-interpreter/gwen/wiki/Runtime-Settings#gwenfeaturedialect) for [Gherkin's spoken languages](https://cucumber.io/docs/gherkin/reference/#spoken-languages)
61-
- Configurable [maximum number of threads](https://github.com/gwen-interpreter/gwen/wiki/Runtime-Settings#gwenparallelmaxthreads) for parallel execution
62-
- Simplified [data table iteration with @ForEach](https://github.com/gwen-interpreter/gwen/wiki/Data-Tables#simplified-foreach)
63-
6425
License
6526
-------
6627

src/main/resources/gwen.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ gwen {
2424
meta = true
2525
}
2626
}
27-
behavior {
27+
behaviour {
2828
rules = "strict" # strict|lenient
2929
}
3030
cli { # Default CLI options

src/main/scala/gwen/core/GwenErrors.scala

+10-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
package gwen.core
2222

23-
import gwen.core.behavior.BehaviorType
23+
import gwen.core.behaviour.BehaviourType
2424
import gwen.core.node.SourceRef
2525
import gwen.core.node.gherkin._
2626

@@ -76,9 +76,9 @@ object Errors {
7676
def invalidSettingError(name: String, value: String, msg: String) = throw new InvalidSettingException(name, value, msg)
7777
def imperativeStepError(step: Step) = throw new ImperativeStepException(step)
7878
def imperativeStepDefError(stepDef: Scenario) = throw new ImperativeStepDefException(stepDef)
79-
def improperBehaviorError(node: GherkinNode) = throw new ImproperBehaviorException(node)
80-
def unexpectedBehaviorError(step: Step, expected: BehaviorType, actual: BehaviorType) = throw new UnexpectedBehaviorException(step, expected, actual)
81-
def undefinedStepDefBehaviorError(stepDef: Scenario) = throw new UndefinedStepDefBehaviorException(stepDef)
79+
def improperBehaviourError(node: GherkinNode) = throw new ImproperBehaviourException(node)
80+
def unexpectedBehaviourError(step: Step, expected: BehaviourType, actual: BehaviourType) = throw new UnexpectedBehaviourException(step, expected, actual)
81+
def undefinedStepDefBehaviourError(stepDef: Scenario) = throw new UndefinedStepDefBehaviourException(stepDef)
8282
def keywordDialectError(language: String, keyword: String) = throw new KeywordDialectException(language, keyword)
8383
def metaDialectError(language: String, specFile: File) = throw new MetaDialectException(language, specFile)
8484
def fileAttachError(file: File, msg: String) = throw new FileAttachException(file, msg)
@@ -208,16 +208,16 @@ object Errors {
208208
class ImperativeStepDefException(stepDef: Scenario) extends GwenException(s"Declarative feature violation: StepDef declaration not permitted in feature${at(stepDef.sourceRef)}")
209209

210210
/** Thrown in strict rules mode when Given-When-Then order is not satisfied in a scenario or background */
211-
class ImproperBehaviorException(node: GherkinNode)
211+
class ImproperBehaviourException(node: GherkinNode)
212212
extends GwenException(s"Strict behaviour violation: Given-When-Then order not satisfied by steps in ${node.nodeType.toString}${at(node.sourceRef)}")
213213

214-
/** Thrown in strict rules mode when a step' behavior type does not match its Given, When, or Then position. */
215-
class UnexpectedBehaviorException(step: Step, expected: BehaviorType, actual: BehaviorType)
216-
extends GwenException(s"Strict behaviour violation: $actual behavior not permitted where ${expected.toString.toLowerCase} is expected (StepDef has @$actual tag${at(step.stepDef.flatMap(_.behaviorTag.flatMap(_.sourceRef)))})")
214+
/** Thrown in strict rules mode when a step' behaviour type does not match its Given, When, or Then position. */
215+
class UnexpectedBehaviourException(step: Step, expected: BehaviourType, actual: BehaviourType)
216+
extends GwenException(s"Strict behaviour violation: $actual behaviour not permitted where ${expected.toString.toLowerCase} is expected (StepDef has @$actual tag${at(step.stepDef.flatMap(_.behaviourTag.flatMap(_.sourceRef)))})")
217217

218218
/** Thrown in strict rules mode when a step def does not declare a Given, When or Then tag. */
219-
class UndefinedStepDefBehaviorException(stepDef: Scenario)
220-
extends GwenException(s"Strict behaviour violation: Missing @Context, @Action, or @Assertion behavior annotation on StepDef${at(stepDef.sourceRef)}")
219+
class UndefinedStepDefBehaviourException(stepDef: Scenario)
220+
extends GwenException(s"Strict behaviour violation: Missing @Context, @Action, or @Assertion behaviour annotation on StepDef${at(stepDef.sourceRef)}")
221221

222222
/** Thrown when a keyword is unknown for a given language dialect. */
223223
class KeywordDialectException(language: String, keyword: String) extends GwenException(s"Unsupported or unknown keyword: $keyword (language=$language)")

src/main/scala/gwen/core/GwenSettings.scala

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package gwen.core
1818

19-
import gwen.core.behavior.BehaviorMode
20-
import gwen.core.behavior.FeatureMode
19+
import gwen.core.behaviour.BehaviourMode
20+
import gwen.core.behaviour.FeatureMode
2121
import gwen.core.state.StateLevel
2222

2323
import scala.util.Try
@@ -39,7 +39,7 @@ object GwenSettings {
3939
`gwen.associative.meta`
4040
`gwen.auto.discover.data.csv`
4141
`gwen.auto.discover.meta`
42-
`gwen.behavior.rules`
42+
`gwen.behaviour.rules`
4343
`gwen.feature.dialect`
4444
`gwen.feature.failfast.enabled`
4545
`gwen.feature.failfast.exit`
@@ -186,15 +186,15 @@ object GwenSettings {
186186
}
187187

188188
/**
189-
* Provides access to the `gwen.behavior.rules` setting used to determine whether strict,
189+
* Provides access to the `gwen.behaviour.rules` setting used to determine whether strict,
190190
* or lenient rules around Given-When-Then usage should be enforced in features (default value is
191191
* `strict`). When strict, scenarios and backgrounds must contain Given-When-Then ordered steps
192192
* and Given steps set context, When steps must perform actions, and Then or But steps must perform
193-
* assertions. When `leneient` no behavioral rules are enforced. Note that `gwen.behaviour.rules` is
193+
* assertions. When `leneient` no behavioural rules are enforced. Note that `gwen.behaviour.rules` is
194194
* an alias for this setting.
195195
*/
196-
def `gwen.behavior.rules`: BehaviorMode = {
197-
BehaviorMode.valueOf(Settings.getOpt("gwen.behavior.rules").getOrElse(Settings.get("gwen.behaviour.rules")))
196+
def `gwen.behaviour.rules`: BehaviourMode = {
197+
BehaviourMode.valueOf(Settings.getOpt("gwen.behaviour.rules").getOrElse(Settings.get("gwen.behaviour.rules")))
198198
}
199199

200200
/**

src/main/scala/gwen/core/behavior/BehaviorMode.scala src/main/scala/gwen/core/behaviour/BehaviourMode.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
package gwen.core.behavior
17+
package gwen.core.behaviour
1818

1919
import gwen.core.GwenSettings
2020

21-
enum BehaviorMode:
21+
enum BehaviourMode:
2222
case strict, lenient
2323

24-
object BehaviorMode {
25-
def isStrict = GwenSettings.`gwen.behavior.rules` == strict
26-
def isLenient = GwenSettings.`gwen.behavior.rules` == lenient
24+
object BehaviourMode {
25+
def isStrict = GwenSettings.`gwen.behaviour.rules` == strict
26+
def isLenient = GwenSettings.`gwen.behaviour.rules` == lenient
2727
}

src/main/scala/gwen/core/behavior/BehaviorRules.scala src/main/scala/gwen/core/behaviour/BehaviourRules.scala

+26-26
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,33 @@
1414
* limitations under the License.
1515
*/
1616

17-
package gwen.core.behavior
17+
package gwen.core.behaviour
1818

1919
import gwen.core._
2020
import gwen.core.node.gherkin._
2121
import gwen.core.state.Environment
2222

2323
/**
24-
* Enfores certain rules depending on `gwen.feature.mode` and `gwen.behavior.rules` settings.
24+
* Enfores certain rules depending on `gwen.feature.mode` and `gwen.behaviour.rules` settings.
2525
*/
26-
trait BehaviorRules {
26+
trait BehaviourRules {
2727

2828
/**
29-
* Checks that a background satisfies behavior rules before evaluation.
29+
* Checks that a background satisfies behaviour rules before evaluation.
3030
*
3131
* @param background the background to check
3232
* @param specType the spec type currently being evaluated
3333
*/
3434
def checkBackgroundRules(background: Background, specType: SpecType): Unit = {
35-
if (BehaviorMode.isStrict && specType.isFeature) {
36-
if (!isProperBehavior(background.steps)) {
37-
Errors.improperBehaviorError(background)
35+
if (BehaviourMode.isStrict && specType.isFeature) {
36+
if (!isProperBehaviour(background.steps)) {
37+
Errors.improperBehaviourError(background)
3838
}
3939
}
4040
}
4141

4242
/**
43-
* Checks that a scenario or stepdef satisfies behavior rules before evaluation.
43+
* Checks that a scenario or stepdef satisfies behaviour rules before evaluation.
4444
*
4545
* @param scenario the scenario to check
4646
* @param specType the spec type currently being evaluated
@@ -50,9 +50,9 @@ trait BehaviorRules {
5050
if (FeatureMode.isDeclarative && scenario.isStepDef) {
5151
Errors.imperativeStepDefError(scenario)
5252
}
53-
if (BehaviorMode.isStrict && !(FeatureMode.isImperative && scenario.isStepDef)) {
54-
if (!isProperBehavior(scenario.steps)) {
55-
Errors.improperBehaviorError(scenario)
53+
if (BehaviourMode.isStrict && !(FeatureMode.isImperative && scenario.isStepDef)) {
54+
if (!isProperBehaviour(scenario.steps)) {
55+
Errors.improperBehaviourError(scenario)
5656
}
5757
}
5858
}
@@ -66,14 +66,14 @@ trait BehaviorRules {
6666
*/
6767
def checkStepDefRules(step: Step, env: Environment): Unit = {
6868
if (env.specType.isFeature && env.isEvaluatingTopLevelStep) {
69-
if (BehaviorMode.isStrict) {
69+
if (BehaviourMode.isStrict) {
7070
step.stepDef foreach { stepDef =>
7171
if (!stepDef.isSynthetic) {
72-
stepDef.behaviorTag match {
73-
case Some(behaviorTag) =>
74-
checkStepRules(step, BehaviorType.valueOf(behaviorTag.name), env)
72+
stepDef.behaviourTag match {
73+
case Some(behaviourTag) =>
74+
checkStepRules(step, BehaviourType.valueOf(behaviourTag.name), env)
7575
case _ =>
76-
Errors.undefinedStepDefBehaviorError(stepDef)
76+
Errors.undefinedStepDefBehaviourError(stepDef)
7777
}
7878
}
7979
}
@@ -85,30 +85,30 @@ trait BehaviorRules {
8585
* Checks that a step called in a feature satisfies behavoiur rules at evaluation.
8686
*
8787
* @param step the step to check
88-
* @param actualBehavior the actual behavior type of the step
88+
* @param actualBehaviour the actual behaviour type of the step
8989
* @param env the environment context
9090
*/
91-
def checkStepRules(step: Step, actualBehavior: BehaviorType, env: Environment): Unit = {
91+
def checkStepRules(step: Step, actualBehaviour: BehaviourType, env: Environment): Unit = {
9292
if (env.specType.isFeature && env.isEvaluatingTopLevelStep) {
9393
if (FeatureMode.isDeclarative && step.stepDef.isEmpty) {
9494
Errors.imperativeStepError(step)
9595
}
96-
if (BehaviorMode.isStrict) {
97-
env.currentBehavior foreach { expectedBehavior =>
98-
if (actualBehavior != expectedBehavior) {
99-
Errors.unexpectedBehaviorError(step, expectedBehavior, actualBehavior)
96+
if (BehaviourMode.isStrict) {
97+
env.currentBehaviour foreach { expectedBehaviour =>
98+
if (actualBehaviour != expectedBehaviour) {
99+
Errors.unexpectedBehaviourError(step, expectedBehaviour, actualBehaviour)
100100
} else if (!StepKeyword.isAnd(step.keyword)) {
101-
val stepBehavior = BehaviorType.of(step.keyword)
102-
if (stepBehavior != expectedBehavior) {
103-
Errors.unexpectedBehaviorError(step, expectedBehavior, stepBehavior)
101+
val stepBehaviour = BehaviourType.of(step.keyword)
102+
if (stepBehaviour != expectedBehaviour) {
103+
Errors.unexpectedBehaviourError(step, expectedBehaviour, stepBehaviour)
104104
}
105105
}
106106
}
107107
}
108108
}
109109
}
110110

111-
private def isProperBehavior(steps: List[Step]): Boolean = {
111+
private def isProperBehaviour(steps: List[Step]): Boolean = {
112112
val order = steps.map(_.keyword).filter(k => !StepKeyword.isAnd(k)).map { keyword =>
113113
StepKeyword.valueOf(keyword).toString
114114
}

src/main/scala/gwen/core/behavior/BehaviorType.scala src/main/scala/gwen/core/behaviour/BehaviourType.scala

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
* limitations under the License.
1515
*/
1616

17-
package gwen.core.behavior
17+
package gwen.core.behaviour
1818

1919
import gwen.core.node.gherkin.StepKeyword
2020

21-
enum BehaviorType:
21+
enum BehaviourType:
2222
case Context, Action, Assertion
2323

24-
object BehaviorType {
25-
def of(stepKeyword: String): BehaviorType = {
26-
if (StepKeyword.isGiven(stepKeyword)) BehaviorType.Context
27-
else if (StepKeyword.isWhen(stepKeyword)) BehaviorType.Action
28-
else BehaviorType.Assertion
24+
object BehaviourType {
25+
def of(stepKeyword: String): BehaviourType = {
26+
if (StepKeyword.isGiven(stepKeyword)) BehaviourType.Context
27+
else if (StepKeyword.isWhen(stepKeyword)) BehaviourType.Action
28+
else BehaviourType.Assertion
2929
}
3030

3131
}

src/main/scala/gwen/core/behavior/FeatureMode.scala src/main/scala/gwen/core/behaviour/FeatureMode.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package gwen.core.behavior
17+
package gwen.core.behaviour
1818

1919
import gwen.core.GwenSettings
2020

src/main/scala/gwen/core/eval/GwenREPL.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package gwen.core.eval
1818

1919
import gwen.core._
20-
import gwen.core.behavior.FeatureMode
20+
import gwen.core.behaviour.FeatureMode
2121
import gwen.core.node.gherkin.Dialect
2222
import gwen.core.node.gherkin.GherkinKeyword
2323
import gwen.core.node.gherkin.StepKeyword

src/main/scala/gwen/core/eval/engine/StepEngine.scala

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import gwen.core._
2020
import gwen.core.Errors
2121
import gwen.core.eval.EvalContext
2222
import gwen.core.eval.EvalEngine
23-
import gwen.core.behavior.BehaviorType
23+
import gwen.core.behaviour.BehaviourType
2424
import gwen.core.eval.lambda.CompositeStep
2525
import gwen.core.eval.lambda.composite.ForEachTableRecord
2626
import gwen.core.eval.lambda.composite.ForEachTableRecordAnnotated
@@ -63,19 +63,19 @@ trait StepEngine[T <: EvalContext] {
6363
* Evaluates a list of steps.
6464
*/
6565
def evaluateSteps(parent: GwenNode, steps: List[Step], ctx: T): List[Step] = {
66-
var behaviorCount = 0
66+
var behaviourCount = 0
6767
try {
6868
steps.foldLeft(List[Step]()) {
6969
(acc: List[Step], step: Step) =>
7070
if (!StepKeyword.isAnd(step.keyword)) {
71-
ctx.addBehavior(BehaviorType.of(step.keyword))
72-
behaviorCount = behaviorCount + 1
71+
ctx.addBehaviour(BehaviourType.of(step.keyword))
72+
behaviourCount = behaviourCount + 1
7373
}
7474
evaluateOrTransitionStep(parent, step, acc, ctx) :: acc
7575
} reverse
7676
} finally {
77-
0 until behaviorCount foreach { _ =>
78-
ctx.popBehavior()
77+
0 until behaviourCount foreach { _ =>
78+
ctx.popBehaviour()
7979
}
8080
}
8181
}

0 commit comments

Comments
 (0)