olexale / bdd_widget_test

A BDD-style widget testing library
MIT License
101 stars 30 forks source link

Config common steps folder instead of all steps [Question] #70

Closed venkata-reddy-dev closed 8 months ago

venkata-reddy-dev commented 8 months ago

I want to configure predefined steps folder path as line no 13 instead of line no 14 to 16

Screenshot 2024-03-23 at 2 28 56 PM

venkata-reddy-dev commented 8 months ago

I feel, it's really not developer friendly to update build.yml file for each re-usable step configuration.

olexale commented 8 months ago

Hello! Thanks for raising the ticket.

This mechanism was not intended to be used for local steps with relative paths. If you follow the README, for external steps, you need to specify the package name. That was made for users to be intentional when they share (provide external step) or import (use existing step) anything from another package via bdd_options config.

It might be annoying to add common steps at the beginning of the project, but soon the list becomes stable as the majority of the steps will be feature-specific. If that's not true for your project and you expect the majority of steps to be shared between features, consider specifying the stepFolderName instead.

How many common steps that are private for the package do you expect to have in your project?

venkata-reddy-dev commented 8 months ago

@olexale Thanks for quick replay. and by the way this is a great package to write tests.

As per my understanding, stepFolderName setting is per package and for all the .feature tests fallow that.

But in my case i have a folder where all the re-usable steps are placed. i just want to configure directory path of re-usable steps instead of each step path in build.yaml

My usecase :

I am writing the bdd test cases per screen, not per feature

Lets say I have 30 screens. I am creating 30 .feature files and 1 folder for each.

For each screen I have below steps

venkata-reddy-dev commented 8 months ago

As per this doc, it is configuration for step folder name right, not for re-usable steps config.

Screenshot 2024-03-23 at 10 01 18 PM

olexale commented 8 months ago

stepFolderName will not only change the name, it may also make all feature files inside the package use a single directory, so you will get the steps reusability you requested. Inside this folder, you may create subfolders to prevent it from becoming a mess.

If that solution is not acceptable, my question is the same: how many common steps that are private for the package do you expect to have in your project? So far it looks like you have two common steps (which I believe should be combined into a single one). That sounds not that bad if you had to write a single line in the config.

venkata-reddy-dev commented 8 months ago

@olexale i get it now, Thanks.

For my project mostly 5 to 6 common steps. not more than this.