reportportal / agent-java-cucumber

Cucumber JVM version [1.0.0; 2.0.0) adapter
Apache License 2.0
26 stars 16 forks source link

AMBIGUOUS_TEST_ITEM_STATUS error if tag excluded in execution, but Feature file has only Scenarios with this tag #21

Closed SiarheiDubovik closed 6 years ago

SiarheiDubovik commented 6 years ago

In Cucumber we can exclude some tags from execution. Example:

-Dcucumber.options="--tags ~@excludedTag"

In case if feature files has only scenarios, which marked by this tag:

Feature: Feature1

  Background:
    Given step1
    And step2
    When step3

  @excludedTag
  Scenario: Scenario1
    And step4
    Then step5
...

we receive situation when Test Item will be start in beforeFeature method

protected void beforeFeature(Feature feature) {
    ...
        if (null == root) {
            currentFeatureId = RP.get().startTestItem(rq);
        } else {
                       currentFeatureId = RP.get().startTestItem(root, rq);
        }

    }

but then execution will immediately goes to after feature method and we will try to finish empty Test Item

  protected void afterFeature() {
        Utils.finishTestItem(RP.get(), currentFeatureId);
        currentFeatureId = null;
    }

As result I got following message:

Error Message: Test item status is ambiguous. There is no status provided from request and there are no descendants to check statistics for test item id '5b617cba8a7f7107c4a5d56c' Error Type: AMBIGUOUS_TEST_ITEM_STATUS

DzmitryHumianiuk commented 6 years ago

@SiarheiDubovik do you have ideas for workaround?

SiarheiDubovik commented 6 years ago

@DzmitryHumianiuk So, at the current moment we just exclude all Feature instead of Scenario.

Example:

@excludedTag
Feature: Feature1

  Background:
    Given step1
    And step2
    When step3

  Scenario: Scenario1
    And step4
    Then step5

But I think it will be better if this situation will be covered in the Agent's code

DzmitryHumianiuk commented 6 years ago

@SiarheiDubovik can you send a pull request in a while?

SiarheiDubovik commented 6 years ago

@DzmitryHumianiuk I have no resolution right now, because feature object cannot provide exact number of enabled Scenarios. So I will try to define some Solution for this

DzmitryHumianiuk commented 6 years ago

@SiarheiDubovik this one consider is fixed?

SiarheiDubovik commented 6 years ago

@DzmitryHumianiuk Yes, I verified this on my project and issue is not reproducing now