Francislainy Campos
Francislainy Campos

Reputation: 4164

Scenario.getSourceTagNames not including tags under examples section of a scenario outline

I'm looping through scenario.getSourceTagNames() within the @after tearDown method but the tags within my example section are not being shown as part of this list. I see this question has been asked a few times here but I'm afraid the solutions I found haven't been able to fix my issue so far (answers usually suggest updating the cucumber-jvm version). These are my pom configs.

  <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-jvm</artifactId>
        <version>5.4.2</version>
        <type>pom</type>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-jvm-deps</artifactId>
        <version>1.0.5</version>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>gherkin</artifactId>
        <version>2.12.2</version>
    </dependency>

Upvotes: 1

Views: 391

Answers (2)

Francislainy Campos
Francislainy Campos

Reputation: 4164

Issue to do with dependencies on the pom file as per @marit suggestion.

This is what I have now under my pom file in case it may be helpful to someone else.

<dependencies>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.5</version>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-jvm</artifactId>
        <version>5.4.2</version>
        <type>pom</type>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>5.4.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-core</artifactId>
        <version>5.4.2</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>5.4.2</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>gherkin</artifactId>
        <version>10.0.0</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-picocontainer</artifactId>
        <version>5.4.2</version>
    </dependency>

</dependencies>

Upvotes: 1

Marit
Marit

Reputation: 3056

It looks like you are on the latest (or very recent) Cucumber version. However, try using <artifactId>cucumber-java</artifactId> (cucumber-java instead of cucumber-jvm).

Also, remove the following dependencies to avoid clashes / problems, as they are transitive dependencies of cucumber:

    <dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-jvm-deps</artifactId>
    <version>1.0.5</version>
</dependency>

<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>gherkin</artifactId>
    <version>2.12.2</version>
</dependency>

Upvotes: 2

Related Questions