Skip to content

Gauge – Before spec running for every row in csv with -DinParallel=true

I’ve a spec which has

table: data/csv/a.csv
Tags: tag1

Where csv file has 49 cases and there is only 1 scenario in spec

Before spec in a StemImplementation looks like below

    @BeforeSpec(tags = {"tag1","tag2"},tagAggregation = Operator.OR)
    public static void preSpec() {
    }

When i run spec in parallel, it is running before spec 49 times. It should be run as many thread i’ve.

gauge -v

Gauge version: 1.1.1 Plugins
html-report (4.0.12) 
java (0.7.3) 
json-report (0.3.3) 
xml-report (0.2.3)

Answer

There is an experimental feature on gauge – Table driven scenario. Where table can be defined at scenario level and then beforespec and afterspec will run only once. Complete spec will run in one go.

In parallel mode, all specs will run in parallel instead of scenario. This is what people mostly want

More details here https://docs.gauge.org/writing-specifications.html?os=linux&language=javascript&ide=vscode#table-driven-scenario

There are open issues with this approach.