How do we handle minor permutations of BDD scripts?

I love BDD's approach to development, but I ran into the problem of how far to go. This comment from ThoughtWorks recent Radar pauses me:

“The advent of behavior-based models (BDDs) such as Cucumber, combined with browser automation tools such as Selenium, have contributed to the widespread use of browser-level acceptance testing. Unfortunately, this has spurred most testing, where the cost to run the tests is the most Instead, we should test at the appropriate level as close as possible to the code so that the tests can be performed with maximum efficiency. Level tests at the browser level should be icing cake and supported acceptance and unit tests, performed at the appropriate levels. "

So here is my script (pun intended):

I have a basic CRUD application with business requirements for filtering the displayed data based on criteria that the end user can select. For convenience of discussion, let me say that this application is for the energy company, and I show the current energy use per month for each client. The user of this application can narrow the data by selecting one client, several clients, clients or "All clients". The data displayed will vary depending on what they choose.

For the interested party to the product, they really represent 4 separate scenarios. However, from the point of view of the developer, they are almost identical, with the only difference being that the parameter is transferred to the database. Thus, the question arises: does the permutation of each permutation exceed the costs of its operation and maintenance?

I think the principles of BDD are likely to say yes, because the message of the expected behavior is more explicit, but I'm not sure. This, of course, makes me feel overkill. Scenarios are likely to have many copies with a few changes.

My tendency is to cover this functionality with one scenario that captures the core business value ("when I select a client, I see energy usage data"), and then covers other permutations with a set of non-UI-based integration that Confirm that the service / request returns the correct data. It is not right? What is the best answer to make sure these scenarios are covered without giving up on the benefits of BDD?

+6
source share
2 answers

My rule for BDD is that developers should easily get scripts from any of the behaviors described, and if they cannot, illustrate scripted behaviors.

BDD is most useful when it describes things that are complex; either by transferring expert knowledge to developers, or by narrowing the behavior until uncertainty is detected. In a CRUD application with basic filters, the behavior is very easy to understand.

What you are describing is probably best described by Dan North's “Gingerbread Cake” pattern: take a recipe for something else, but with one aspect of behavior different from another (or in this case with one additional, understandable aspect of behavior ) It also uses copy-paste a bit, and I suspect in particular for such behavior.

So your tendency is perfectly correct. If you automate, I would probably automate just one example, and let unit tests and integration cover the rest.

I also want to know why this project is being pursued. This should be something interesting, otherwise it will not happen. Find it, and it is probably a great place to start a discussion of scenarios.

+4
source

If you use refactoring scripts, usually by extracting small tables from duplicate scripts, the cost of maintenance probably won't hurt you at all. However, this does not solve the runtime cost problem.

In such a situation, I would probably suggest automating both the simplest scenario (without clients) and the most complex (many clients matching the filter, but not all), and leave other permutations to more targeted testers. I would turn on the “no customers” business just because people tend to perceive this horribly wrong, as sometimes because of a program crash. (You did not run the seed data of the script ?!)

0
source

Source: https://habr.com/ru/post/926133/


All Articles