cli icon indicating copy to clipboard operation
cli copied to clipboard

"You have a SyntaxError in your feature file" error when using "examples:" section

Open BlockOpsAI opened this issue 4 years ago • 1 comments

Description

When I add examples in a feature, I get an error message "You have a SyntaxError in your feature file"

To Reproduce

I created this feature file:

Feature: The ECS instance will host a website

    Scenario: Test my ECS instance
    
        Given I have alicloud_instance defined
         When its name is XXX
         Then its key_name must be YYY

        Given I have alicloud_security_group defined
         When it has ingress
         Then it must have ingress
          And it must not have <proto> protocol and port <portNumber> for 0.0.0.0/0

      Examples:
        | ProtocolName | proto | portNumber |
        | HTTP      | tcp       | 80      |

I installed terraform-compliance with pip.

When I run this command:

terraform-compliance -p plan.out -f terraform-compliance-tests/

I get this error:

ERROR: You have a SyntaxError in your feature file! Please have a look into terraform-compliance and radish documentation to find out which features are supported and how you could use them: https://terraform-compliance.com  https://radish.readthedocs.io/en/stable/

It works if I remove the examples: section and if I change this line into:

          And it must not have tcp protocol and port 80 for 0.0.0.0/0

BlockOpsAI avatar Nov 23 '21 09:11 BlockOpsAI

This is easy to overlook. You need to change:

 Scenario:

to

 Scenario Outline:

See here: https://radish.readthedocs.io/en/stable/tutorial.html#scenario-outline

patrickmoore-nc avatar Jul 12 '22 21:07 patrickmoore-nc