Search code examples
bddqaf

Is it possible to enforce tagging rules with QAF BDD, if yes how can i do it?


With QAF BDD we can provide the tags as Key and value pair, is it possible to ensure the values that can be provided in the feature file are within the defined set for example:

@testType:smoke

here the testType should take only values smoke or regression, and if sombody provides a value other than that, for instance, functional or does a spelling mistake it should throw error and should not take that scenario for execution.


Solution

  • Yes, you can enforce meta-data by providing meta-data rules. You can set one or more meta-data rule using metadata.rules property which expects list of meta-data rules. Below example shows how you can restrict testType to smoke or regression.

     metadata.rules=[{"key":"testType","values"["smoke","regression"],"required":false}]
    
    

    Above rule will fail if testType exist and have value other than smoke or regression. If you want to make testType mandatory for each scenario, you can set required to true.