nnja nnja - 2 years ago 133
Python Question

Modular structure for behave tests

Right now I have the following directory of test features:


As the test steps for BehaveTest1 and BehaveTest2 are common, I'd like to implement a common module that could be called by both test cases when they need to. At the moment I have made a common/ directory inside the Tests/ folder and import it (inside the test_steps.py files for each test feature) by:

import sys, os
import common

But I do not want to mess with the path so I was wondering if there are any better ways to do this with the structure of behave test features?

Answer Source

The most flexible way to do this for me was to create a folder of my classes inside my steps folder:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download