Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature descriptions are optional #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions features/allure_formatter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ Feature: Allure Formatter
As a features developer
I want, allure to collect all feature & scenarios tags

@tag_scenario @BUG:7654 @tag_ignore
Scenario: Scenario annotation
Given scenario has annotation
When it passed
Then annotation is collected
"""
And a file named "features/World2.feature" with:
"""
@tag_feature @severity:blocker @JIRA:PROD-4444
Feature: Descriptionless feature

@tag_scenario @BUG:7654 @tag_ignore
Scenario: Scenario annotation
Given scenario has annotation
Expand Down Expand Up @@ -93,6 +104,31 @@ Feature: Allure Formatter
<label name="testId" value="7654"/>
</labels>
</test-case>
<test-case start="-IGNORE-VALUE-" stop="-IGNORE-VALUE-" status="passed">
<name>Descriptionless feature | Scenario annotation</name>
<title><![CDATA[Scenario annotation]]></title>
<steps>
<step start="-IGNORE-VALUE-" stop="-IGNORE-VALUE-" status="passed">
<name><![CDATA[scenario has annotation]]></name>
<title><![CDATA[Given scenario has annotation]]></title>
</step>
<step start="-IGNORE-VALUE-" stop="-IGNORE-VALUE-" status="passed">
<name><![CDATA[it passed]]></name>
<title><![CDATA[When it passed]]></title>
</step>
<step start="-IGNORE-VALUE-" stop="-IGNORE-VALUE-" status="passed">
<name><![CDATA[annotation is collected]]></name>
<title><![CDATA[Then annotation is collected]]></title>
</step>
</steps>
<labels>
<label name="severity" value="blocker"/>
<label name="story" value="tag_feature"/>
<label name="story" value="tag_scenario"/>
<label name="issue" value="PROD-4444"/>
<label name="testId" value="7654"/>
</labels>
</test-case>
</test-cases>
</alr:test-suite>
"""
11 changes: 7 additions & 4 deletions src/Allure/Behat/Formatter/AllureFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,13 @@ protected function prepareOutputDirectory($outputDirectory)
protected function parseFeatureAnnotations(FeatureNode $featureNode)
{
$this->scopeAnnotation = $featureNode->getTags();
$description = new Description();
$description->type = DescriptionType::TEXT;
$description->value = $featureNode->getDescription();
return [$this->scopeAnnotation, $description];
if ($featureNode->getDescription()) {
$description = new Description();
$description->type = DescriptionType::TEXT;
$description->value = $featureNode->getDescription();
return [$this->scopeAnnotation, $description];
}
return [$this->scopeAnnotation];
}

protected function parseScenarioAnnotations(ScenarioInterface $scenarioNode)
Expand Down