Forum Discussion

hannecroonen's avatar
hannecroonen
Contributor
4 years ago

BDD: read information given in feature file

Hi everyone;

 

Small question:

 

I am writing tests for our program and in every Feature File I write pre-conditions necessary before running the tests.

These pre-conditions are just written as information for the people reading the tests so it is not really a restriction to TestComplete.

Now I was wondering if there was any way to make TestComplete read these pre-conditions before running the feature file so I can also print them in the Log Messages?

 

My example:

Feature: Adding a field 

    Any user should be able to add a field
    If errors occur, corresponding messages should be shown

    Precondition:
    IE0001 completed

    Background:
        Given the project centre is open

Meaning the actual first test to run is the Background one

The pre-condition is just written in text but I'd like to read that in the 'beforeFeature' function used in BDD to print it in the Logs.

 

Anyone that can help?

  • Never mind, I found it already ğŸ˜… 

    When I was typing this it suddenly came to mind you can read the description of any Feature File with feature.Description.

    If I just split that description on pre-condition I can log that to the Messages.

     

  • Never mind, I found it already ğŸ˜… 

    When I was typing this it suddenly came to mind you can read the description of any Feature File with feature.Description.

    If I just split that description on pre-condition I can log that to the Messages.