0

I'm doing a little PoC of system tests with python-behave. I wrote a couple of tests, but I wonder how to scale it:

I have a few scenarios I wrote in Gherkin and implemented in python-behave, and I was wondering: In case there are many testers working on the same project, and the testers want to use the same phrases, so that there won't be code duplication in the python-behave files. How could they go about it?

for instance (please ignore the content of the tests as I wasn't giving it much thought)

Tester 1 writes:

  Scenario: Simple Google search
    Given a web browser is on the Google page
    When the search phrase "panda" is entered
    Then results for "panda" are shown

Somebody implemented each of the steps in the test in python-behave.

Tester 2 writes:

  Scenario: Advanced Google search
    Given there is a web-browser on a Google page
    When the search phrase "panda" is written
    Then results for "panda" are presented
    And the related results include "Panda Express"
    But the related results do not include "pandemonium"

Notice that the "Given", "When" and "Then" of the two tests are identical in their logic. Is there a simple way for Tester 2 to know that a similar phrases were already written (and implemented)? Is there a way to search in a "phrase bank" or something of that sort in order to avoid code duplication?

nerez
  • 437
  • 4
  • 18
  • You could document the steps that you have written - showing which files they are implemented in, a description of what the steps do, and make it searchable - check out these [python documentation tools](https://wiki.python.org/moin/DocumentationTools). This would be the simplest way to do this - whereby getting your colleagues to document their steps and use the documentation will be the hardest part – KyleFairns Apr 06 '18 at 10:46

1 Answers1

0

I've had the same problem of step proliferation. I solved it at the point of creation of the step by using Behave Pro. Behave Pro is a plugin to Jira. Each ticket I file in Jira has a section, added by Behave Pro, where I specify the requirements for the ticket in Gherkin.

Behave Pro solves the problem sort of like query-completion works on Google. As I start to type my step, it searches my existing steps. If it finds one similar to what I've typed, it proposes it.

I think there's a lot more that can be done in a system like Behave Pro. There is a lot of Natural Language Processing that could help. But that's for a really large set of Gherkin scenarios.

Michael Osofsky
  • 11,429
  • 16
  • 68
  • 113