Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tags Pre-processor to filter Feature files and scenarios based on free-hand expressions #103

Open
qarampage opened this issue Aug 17, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@qarampage
Copy link

qarampage commented Aug 17, 2023

Hi @hrcorval @anibalinn

I am using your behavex package extensively in the automation framework. It is quite impressive and I am also having a few suggestions that I have posted in the issue tracker and waiting for other new features to get implemented from the tracker.

However, to support filtering out the feature files and scenarios based on given tags expression like below, I have created an bdd-tags-processor module. I was wondering if you could have a look at it and integrate that within behavex.
I am using this on top of behaveX call to have the right set of scenarios to be executed by behavex

Given expression: { ~@web and @browser and @checkout and ~@norun and ( @regression or @sanity )}
Result: --> NoRuns: ['@web', '@norun'], Ands: ['@browser', '@checkout'], Ors: ['@regression', '@sanity']

Given expression: { @web and @regression and @norun and ( @test1 or @test2 )}
Result: --> NoRuns: [], Ands: ['@web', '@regression', '@norun'], Ors: ['@test1', '@test2']

I have the main() function with adequate examples and how to use.

@hrcorval
Copy link
Owner

Hi @qarampage, I like this feature a lot. Do you have the implementation to review it and analyze extending the BehaveX library?
Thanks!

@hrcorval hrcorval added the enhancement New feature or request label Jun 28, 2024
@qarampage
Copy link
Author

qarampage commented Jul 1, 2024

Thanks @hrcorval ,
Sure, you can review it here https://pypi.org/project/bdd-tags-processor/
I have detailed examples there and you can also try it out

@qarampage
Copy link
Author

hi @hrcorval,
how's everything going on your side !
just want to know if you tried the bdd-tags-processor module ?

@qarampage
Copy link
Author

hi @hrcorval
could you please let me know if you have reviewed and would like to integrate this with your framework ?

@hrcorval
Copy link
Owner

Hi @qarampage, sorry for late reply. We have been setting our priorities on fixed and major changes needed in the library. I did a review of your module and I liked it a lot. We would like to consider it as part of BehaveX.
At the moment, I don't have enough bandwith to adapt our current implementation, but any hints that simplify the adoption will be really helpful to accelerate time.
Thanks a lot for considering adding this improvement to the solution :)

@qarampage
Copy link
Author

qarampage commented Nov 23, 2024

Thanks @hrcorval for considering it. Here are the steps for a jump start

# To Install the package I have uploaded on pypi
pip3 install bdd-tags-processor

# Import the following into the file where you identify and filter out the scenarios to execute
from bdd_tags_processor.bdd_tags_expression_processor import filter_feature_and_scenarios

# After you have installed the bdd_tags_processor, you can goto line 137, I have added adequate samples. that will give 
you a view how to create the expressions to filter out the required scenarios. All the output scenarios have @final in the 
end as part of their tags, so we only have to then refer the output folder and 1 tag called @final for our code.
Processor takes care of reading the user expression,  parsing , extracting and outputting the scenarios.

# it will tell how many scenarios it extracted based on the tags that were provided 
total_scenarios = filter_feature_and_scenarios(feature_dir, 'features/final', tags)

if total_scenarios > 0:           # if we have at least 1 scenario then we execute them
        _run_feature(args, stage_name, platform_name, is_remote, is_highlight, browser)

_run_features() is our function where we are calling your behaveX to execute tests 

While I was working with Thang Le in his project (BDDDevicesAutomation), I created this BDD Tags Processor there.
you can get more info from https://github.com/lqthang2204/BDDDevicesAutomation/blob/main/project_runner.py.
I have also communicated to Thang Le, the owner of "BDDDevicesAutomation" repo. he will be able to help you out with any queries if I am not around.

@hrcorval
Copy link
Owner

Hi @qarampage, thanks for the detailed information, I'll be giving a try to the proposed solution as soon as we are done with release 4.0.9. Managing tags with boolean expressions will make our executions simpler, so this is part of our scope, more probably for the following release :)
I'll keep you posted on that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants