Forum Discussion

sheelmanohar's avatar
sheelmanohar
New Contributor
2 years ago

Test Complete BDD

I am trying to write BDD scenario and trying to integrate it with a script that I had already created. 

The script starts with 

from Locators import Locators
from TestData import TestData

and then has the following statement 

def FindID():

 

I am trying to integrate this as a step definition with "Given" statement. It is giving error "Unexpected Identifier". 

Please help me. I am new to test complete and learning.

3 Replies

    • sheelmanohar's avatar
      sheelmanohar
      New Contributor

      Thankyou for your reply. I did go through that. It has simple examples and I followed the example for python (the 'def' statement inside the 'Given' step definition). I am getting error. Here is the code:

       

      Given("the user is logged in to the XXX application", function (){
      from Locators import Locators
      def FindInv_1():

      ...

      ...

      ..
      });

       

      Can you please help me? How do I fix this?

       

       

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    The coding you have provided looks like it's for JavaScript and not Python. Python coding will look something like this,

     

    @given("My app has started")
    def step_impl():
      # ...

     

    The BDD Tests topic has example codes for Python as well.