What is the difference between steps colored yellow and red Yellow steps have

What is the difference between steps colored yellow

This preview shows page 274 - 277 out of 517 pages.

Cucumber colors steps green that pass the test. What is the difference between steps colored yellow and red? Yellow steps have not yet been implemented while red steps have been implemented but fail the test. 7.8 Enhancing RottenPotatoes As a second example of user stories and Lo-Fi UIs, suppose we want to search The Open Movie Database (TMDb) to find information about a movie we are interested in adding to RottenPotatoes. As we’ll see in Chapter 8 , TMDb has an API (application programming interface) designed to allow its information to be accessed in a Service-Oriented Architecture. In this chapter, we use Cucumber to develop two scenarios and the corresponding Lo-Fi UI sketches to show how we would like RottenPotatoes to integrate with TMDb, and we’ll get one of the scenarios to go green by temporarily “faking out” some of the code. In Chapter 8 , we’ll write the code needed to get the other scenario to go green. Getting the first couple of scenarios working can seem tedious, because you usually have to add a lot of infrastructure, but it goes much faster after that, and in fact you will even be able to re-use your step definitions to create higher-level “declarative” steps, as we will see in Section 7.9 .
Image of page 274
Image of page 275
Figure 7.7: Storyboard of UI for searching The Movie Database. The storyboard in Figure 7.7 shows how we envision the feature working. The home page of RottenPotatoes, which lists all movies, will be augmented with a search box where we can type some title keywords of a movie and a “Search” button that will search TMDb for a movie whose title contains those keywords. If the search does match—the so-called “happy path” of execution—the first movie that matches will be used to “pre-populate” the fields in the Add New Movie page that we already developed in Chapter 4 . (In a real app, you’d want to create a separate page showing all matches and letting the user pick one, but we’re deliberately keeping the example simple.) If the search doesn’t match any movies—the “sad path”—we should be returned to the home page with a message informing us of this fact. 1 Feature: User can add movie by searching for it in The Movie Database (TMDb) 2 3 As a movie fan 4 So that I can add new movies without manual tedium 5 I want to add movies by looking up their details in TMDb 6 7 Scenario: Try to add nonexistent movie (sad path) 8 9 Given I am on the RottenPotatoes home page 10 Then I should see "Search TMDb for a movie" 11 When I fill in "Search Terms" with "Movie That Does Not Exist" 12 And I press "Search TMDb" 13 Then I should be on the RottenPotatoes home page 14 And I should see "’Movie That Does Not Exist’ was not found in TMDb." Figure 7.8: A sad path scenario associated with adding a feature to search The Movie Database. Normally you’d complete the happy path first, and when you reach a failing or pending step that requires writing new code, you do so via Test Driven Development (TDD). We’ll do that in Chapter 8 by writing code that really calls TMDb and integrating it back into this scenario. For now, we’ll start with the sad path to illustrate Cucumber features and the BDD process. Figure
Image of page 276
Image of page 277

You've reached the end of your free preview.

Want to read all 517 pages?

  • Spring '19
  • Dr.Marcos

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors