¿Dónde probar los enlaces en las características del pepino?

Assume that I arranged my cucumber features in files like that:

features/
├── add_project.feature
├── list_projects.feature

In my application on the page where I can list all projects I also have a link that points to the page where I can create a new project. I want to test that link with the following scenario:

Scenario: Link to create page is visible
    Given I am logged in as a staff member
    When I go to the projects page
    Then I should see a link to the create a project page

Now my dilemma: Where do I put this scenario?

  • Put the scenario into list_projects.feature.
    • + The link is on the list projects page
    • - When I am interested in the list projects feature I don't want to read about how I am adding projects
  • Put the scenario into add_projects.feature.
    • + When I read the description of this feature I am also interested how users are going to get to that feature
    • + If I have multiple links to that functionality they all are gathered in one place
    • - The basic 1-on-1 mapping of feature and controller is broken, to me it feels that this is intruding another test's responsibility
  • Put the scenario somewhere else altogether.
    • I have no idea where :-)

I am sure people have faced this problem before and I want to establish a guideline for the application, right now both styles can be found which makes it harder to maintain. Any input how you did it and why?

preguntado el 27 de agosto de 11 a las 17:08

1 Respuestas

I would include that behaviour in the add_projects.feature

Although Cucumber's built-in generators seem to encourage the mapping of one feature per controller, this often isn't the best way to arrange things so don't worry about breaking that convention.

Respondido 29 ago 11, 00:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.