testingbddspecflowgherkinatdd

ATDD, Gherkin, Specflow approach, blackbox testing issue


I am trying to get some experience in developing outside in with ATDD and now i got my first roadblock.

The application is a simple desktop application (wpf) which should be able to search the filesystem for duplicates.

The first feature i want to implement is to customize the directories which should be searched. But i dont know how i should test that feature end to end.

Would it be a good automated approach to create a test directory with 2 files (duplicates), then select that directory over the user interface then start the search and validate that the result are the 2 created files ?

I would be testing a lot more then simply the feature to specifiy the search directories.

Feature: CustomizeSearchDirectories

In order to speed up and better control the search

As a customer

I want to customize the directories which will be searched

thanks for feedback that can reduce my confusion


Solution

  • In BDD, or ATDD if you want, you don’t have to test everything end-to-end. It is perfectly fine to use a system somehow and then spy on it and see that the expected thing has happened.

    In your case, “customize the directories which should be searched”, I would consider specifying the directories and make sure I can verify that they have been specified properly. This does not necessarily mean using a user interface.

    Scenario: customize the directories which should be searched
      Given Thomas wants to search two directories
      When he selects ./tmp and ./home/thomas
      Then should ./tmp and ./home/thomas be selected
    

    This example specifies what I want, which directories to search and finally a verification that it is exactly these directories that will be searched. It doesn’t specify if there is a file system involved, it doesn’t specify any UI details. Those thing can, and should, be pushed down the stack to some helper methods the steps uses later.

    This means that you can verify the core logic, selecting two directories, or you can verify the interaction with the system from the user interface.

    The first thing I would do is to verify the core logic. If I need, I might verify from the UI later when it exists.