Is there a way to use multiple Step Definition in a single feature file?

22 Views Asked by At

Hello Python/Pycharm Community!

I'm currently working on a project. My issue is this, I have 1 feature file and 2 step definition. I can link my step def to the feature file by using this line

scenarios('../../features/subfolder/scenario.feature')

I tried adding the same line on the second feature file however when I execute it, i had this error

ERROR step_defs/test_verify_activity_panel.py - FileNotFoundError: [Errno 2] No such file or directory: 'D:\\features\\subfolder\\scenario.feature'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!================================================================================== 100 deselected, 103warnings, 1 error in 1.49s =

In my understanding, I cannot use the same feature file on multiple-step def. Is there a way to make the other one global? like I don't need to specify which feature file it will be used for?

this is my feature file

Feature: Login into the application

Background: Invoke WPF application
Given User invokes the application

@QATR-1
Scenario Outline: QATR-1 : story 1
Then User clicks on <application> module
Then User clicks module
Then User navigate into the module #<-- this is from step def 1

Examples:
|application|
|test app|


@QATR-2
Scenario Outline: QATR-2 : story 1
Then User clicks on <application> module
Then User clicks module
Then User filter an employee #<-- this is from step def 2

Examples:
|application|
|test app|

Apologies if I might not be able to really explains the details but please do let me know if anyone needs more details. Thank you in advance!

0

There are 0 best solutions below