Currently I'm writting some integration tests in Python Lettuce. I want to create a generic step for some XML's comparision.
I know that in .feature file after step definition like
Scenario: I want to compare XML's...
...
And I check generated transaction "XYZ" contents with parameters:
...
I can add step.hashes, which would be available in step.hashes property in step definition (some_step_definitions.py bellow)
@step(u'And I check generated transaction "([^"]+)" contents with parameters:$')
def check_generated_content(step, transaction_type):
*(some xml mappings for comparision, appending dictionaries to step.hashes)*
for item in mappings:
step.hashes.append({
'key1': 'val1',
'key2': 'val2'
})
My question is: Is it possible to append headers (key1, key2) in step code (check_generated_content), that when tests are executed I have headers in test report like:
Scenario: I want to compare XML's...
...
And I check generated transaction "XYZ" contents with parameters:
| key1 | key2 |
| val1 | val2 |
...
When I dont specify
And I check generated transaction "XYZ" contents with parameters:
| key1 | val1 |
in feature file, I get in test report:
And I check generated transaction "XYZ" contents with parameters:
| | |
| | |
In conclusion.. I would like to write only
And I check generated transaction "XYZ" contents with parameters:
instead of
And I check generated transaction "XYZ" contents with parameters:
| key1 | val1 |
every time.