Java Code Examples for gherkin.formatter.model.Tag#getName()

The following examples show how to use gherkin.formatter.model.Tag#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GherkinKeyWordProvider.java    From xframium-java with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void scenario(Scenario xTest) {
	currentSection = Section.SCENARIOS;
       String tagNames = null;
       if ( xTest.getTags() != null && !xTest.getTags().isEmpty() )
       {
           tagNames = "";
           for ( Tag tagName : xTest.getTags() )
               tagNames = tagNames + tagName.getName() + ",";
           
           tagNames = tagNames.substring( 0, tagNames.length() - 1 );
       }
       
       this.currentScenario = new KeyWordTest( xTest.getName(), true, null, null, false, null, null, 0, xTest.getDescription(), tagNames, null, null, null, 0, null, null, null, null, 0, 0, TRACE.OFF.name() );

       for ( KeyWordStep xStep : backgroundSteps )
           this.currentScenario.addStep( xStep );
       
       log.info( "Adding " + xTest.getName() );
       scenarioList.add( currentScenario );
	
}
 
Example 2
Source File: GherkinKeyWordProvider.java    From xframium-java with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void scenarioOutline(ScenarioOutline xTest) {
	currentSection = Section.OUTLINE;
       String tagNames = null;
       if ( xTest.getTags() != null && !xTest.getTags().isEmpty() )
       {
           tagNames = "";
           for ( Tag tagName : xTest.getTags() )
               tagNames = tagNames + tagName.getName() + ",";
           
           tagNames = tagNames.substring( 0, tagNames.length() - 1 );
       }
       
       this.currentScenario = new KeyWordTest( xTest.getName(), true, null, xTest.getName(), false, null, null, 0, xTest.getDescription(), tagNames, null, null, null, 0, null, null, null, null, 0, 0, TRACE.OFF.name() );

       for ( KeyWordStep xStep : backgroundSteps )
           this.currentScenario.addStep( xStep );
       
       log.info( "Adding " + xTest.getName() );
       scenarioList.add( currentScenario );
	
}
 
Example 3
Source File: XMLFormatter.java    From xframium-java with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void scenario( Scenario xTest )
{
    currentSection = Section.SCENARIOS;
    String tagNames = null;
    if ( xTest.getTags() != null && !xTest.getTags().isEmpty() )
    {
        tagNames = "";
        for ( Tag tagName : xTest.getTags() )
            tagNames = tagNames + tagName.getName() + ",";
        
        tagNames = tagNames.substring( 0, tagNames.length() - 1 );
    }
    
    this.currentScenario = new KeyWordTest( xTest.getName(), true, null, null, false, null, null, 0, xTest.getDescription(), tagNames, null, null, configProperties, 0, null, null, null, null, 0, 0, TRACE.OFF.name() );

    for ( KeyWordStep xStep : backgroundSteps )
        this.currentScenario.addStep( xStep );
    scenarioList.add( currentScenario );
}
 
Example 4
Source File: XMLFormatter.java    From xframium-java with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void scenarioOutline( ScenarioOutline xTest )
{
    
    currentSection = Section.OUTLINE;
    String tagNames = null;
    if ( xTest.getTags() != null && !xTest.getTags().isEmpty() )
    {
        tagNames = "";
        for ( Tag tagName : xTest.getTags() )
            tagNames = tagNames + tagName.getName() + ",";
        
        tagNames = tagNames.substring( 0, tagNames.length() - 1 );
    }
    
    this.currentScenario = new KeyWordTest( xTest.getName(), true, null, xTest.getName(), false, null, null, 0, xTest.getDescription(), tagNames, null, null, configProperties, 0, null, null, null, null, 0, 0, TRACE.OFF.name() );

    for ( KeyWordStep xStep : backgroundSteps )
        this.currentScenario.addStep( xStep );

    scenarioList.add( currentScenario );
}
 
Example 5
Source File: LabelBuilder.java    From allure-java with Apache License 2.0 4 votes vote down vote up
LabelBuilder(final Feature feature, final Scenario scenario, final Deque<Tag> tags) {
    final TagParser tagParser = new TagParser(feature, scenario);

    getScenarioLabels().add(createFeatureLabel(feature.getName()));
    getScenarioLabels().add(createStoryLabel(scenario.getName()));

    while (tags.peek() != null) {
        final Tag tag = tags.remove();

        final String tagString = tag.getName();

        if (tagString.contains(COMPOSITE_TAG_DELIMITER)) {

            final String[] tagParts = tagString.split(COMPOSITE_TAG_DELIMITER, 2);
            if (tagParts.length < 2 || Objects.isNull(tagParts[1]) || tagParts[1].isEmpty()) {
                // skip empty tags, e.g. '@tmsLink=', to avoid formatter errors
                continue;
            }

            final String tagKey = tagParts[0].toUpperCase();
            final String tagValue = tagParts[1];

            // Handle composite named links
            if (tagKey.startsWith(PLAIN_LINK + ".")) {
                tryHandleNamedLink(tagString);
                continue;
            }

            switch (tagKey) {
                case SEVERITY:
                    getScenarioLabels().add(createSeverityLabel(tagValue.toLowerCase()));
                    break;
                case TMS_LINK:
                    getScenarioLinks().add(ResultsUtils.createTmsLink(tagValue));
                    break;
                case ISSUE_LINK:
                    getScenarioLinks().add(ResultsUtils.createIssueLink(tagValue));
                    break;
                case PLAIN_LINK:
                    getScenarioLinks().add(ResultsUtils.createLink(null, tagValue, tagValue, null));
                    break;
                default:
                    LOGGER.warn("Composite tag {} is not supported. adding it as RAW", tagKey);
                    getScenarioLabels().add(getTagLabel(tag));
                    break;
            }
        } else if (tagParser.isPureSeverityTag(tag)) {
            getScenarioLabels().add(createSeverityLabel(tagString.substring(1)));
        } else if (!tagParser.isResultTag(tag)) {
            getScenarioLabels().add(getTagLabel(tag));
        }
    }

    getScenarioLabels().addAll(Arrays.asList(
            createHostLabel(),
            createThreadLabel(),
            createPackageLabel(feature.getName()),
            createSuiteLabel(feature.getName()),
            createTestClassLabel(scenario.getName()),
            createFrameworkLabel("cucumberjvm"),
            createLanguageLabel("java")
    ));

}