jeudi 26 mars 2020

Feature with tag still being run when configured not to

I have a main feature file where I have included a "setup" feature file that should add some test data. This setup feature file has an annotation that I have called @ignore. However, following the instructions in this Can't be enable to @ignore annotation for the features SO answer, but I am still seeing the setup feature file being run outside of the main test feature.

Main feature file, unsubscribe_user.feature:

Feature: Unsubscribe User

  Background:
    * def props = read('properties/user-properties.json')
    * url urlBase
    * configure headers = props.headers
    * def authoriZation = call read('classpath:basic-auth.js')  { username: 'admin', password: 'admin' }
    * def testDataSetup = call read('classpath:com/meanwhileinhell/app/karate/feature/mockserver/testDataSetup.feature') { data1: #(props.data1), data2: #(props.data2) }

  Scenario: Unsubscribe user
   ...
   ...

testDataSetup.feature file

@ignore
Feature: Add data to REST Mock Server

  Background:
    * url mockServerUrlBase

  Scenario: Add data
    * print 'Adding test data'
    Given path 'mapping'
    And request { data1: '#(data1)', data2: '#(data2)' }
    When method post
    Then status 201

Now from my Java runner class, I have added @KarateOptions(tags = "~@ignore").

import org.junit.runner.RunWith;

import com.intuit.karate.KarateOptions;
import com.intuit.karate.junit4.Karate;

import cucumber.api.CucumberOptions;

@RunWith(Karate.class)
@CucumberOptions(features = "classpath:com/meanwhileinhell/app/karate/feature/unsubscribe_user.feature")
@KarateOptions(tags = "~@ignore")
public class KarateTestUnSubscribeUserRunner {
}

However, I can still see my print statement in my setup class being called, and two POSTs being performed. I have also tried running my suite with the following cmd options, but again, still see the feature file run twice.

./gradlew clean test -Dkarate.env=local -Dkarate.options="--tags ~@ignore" --debug

I am following this wrong somewhere? I am using Karate version 0.9.0.

Aucun commentaire:

Enregistrer un commentaire