I am trying to understand how Gauge handles concurrent execution of tests and how it manages state. However, I don't get it how gauge_clear_state_level
is supposed to work. I have created two small examples in Javascript and also Typescript and for both I don't see any effect.
In my default.properties
it is set as follows:
...
gauge_clear_state_level = scenario
...
This is my test specification:
# Example specification A
## Example scenario A1
* foo "A1"
* bar "A1"
* foo "A1"
## Example scenario A2
* bar "A2"
* foo "A2"
* bar "A2"
The implementation in Typescript looks like this:
import { Step } from "gauge-ts";
export default class StepImplementation {
private fooCounter: number = 0;
private barCounter: number = 0;
@Step("foo <x>")
public async foo(x: string) {
await delay(1000);
this.fooCounter++;
console.log("foo " + x + " (" + this.fooCounter + ")")
}
@Step("bar <x>")
public async bar(x: string) {
await delay(1000);
this.barCounter++;
console.log("bar " + x + " (" + this.barCounter + ")")
}
}
// https://stackoverflow.com/a/37764963
function delay(ms: number) {
return new Promise( resolve => setTimeout(resolve, ms) );
}
When I run the specification, the output is:
Running tool: gauge.cmd run c:\....\specs\exampleA.spec --simple-console --hide-suggestion
"Windows support is not tested yet. There might be some issues."
# Example specification A
## Example scenario A1
foo A1 (1)
bar A1 (1)
foo A1 (2)
## Example scenario A2
bar A2 (2)
foo A2 (3)
bar A2 (3)
Successfully generated html-report to => c:\....\reports\html-report\index.html
Specifications: 1 executed 1 passed 0 failed 0 skipped
Scenarios: 2 executed 2 passed 0 failed 0 skipped
Total time taken: 6.424s
Success: Tests passed.
What I would have expected is that both counters are reset after each scenario but the output above shows that this is not the case.
Any ideas or suggestions anyone?