Forum Discussion

jonathon's avatar
jonathon
Contributor
6 years ago

Python BDD modules

Hi   Just getting started with TestComplete and BDD. I'm experienced with Python BDD (Behave) with Selenium. Just a little unsure how to work with python modules. I can't seem to import my classes ...
  • jonathon's avatar
    6 years ago

    Ok, I managed it like this:

     

    import login as login_object

     

    login = login_object.Login.get_instance()

     

     

    My Class is like this though:

     

    class Login:
        instance = None
    
        @classmethod
        def get_instance(cls):
            if cls.instance is None:
                cls.instance = Login()
            return cls.instance

    login = Login.get_instance()

     

    So looks a bit ugly, but does work. But if anyone has a better solution that would be cool