1
h07
CS48 W20
Name:
(as it would appear on official course roster)
Umail address: @umail.ucsb.edu section
4pm, 5pm, 6pm
Optional: name you wish to be called
if different from name above.
Optional: name of "homework buddy"
(leaving this blank signifies "I worked alone"

h07: More on Testing and BDD

ready? assigned due points
true Mon 02/03 02:00PM Wed 02/05 02:00PM

You may collaborate on this homework with AT MOST one person, an optional "homework buddy".

MAY ONLY BE TURNED IN IN THE LECTURE/LAB LISTED ABOVE AS THE DUE DATE,
OR IF APPLICABLE, SUBMITTED ON GRADESCOPE. There is NO MAKEUP for missed assignments;
in place of that, we drop the three lowest scores (if you have zeros, those are the three lowest scores.)


https://ucsb-cs48.github.io/w19/hwk/h07/

For this homework, please read these articles. Don’t be alarmed that there are three of them; each is short.

  1. (15 pts) Please fill in the information at the top of this homework sheet, including your name and umail address. Put the time your discussion section starts (4pm, 5pm, 6pm) in the space indicated (the one you are registered for—even if you usually attend a different one.) If the other two items apply, please fill them in as well. Please do this every single time you submit homework for this class.
  2. Michael Lynch notes that some of the “good practices” that we follow when writing production code end up being bad practices when writing unit tests, or other test code. One of these is the DRY principle.

    1. (10 pts) Explain the DRY principle,

    2. (10 pts) Explain why it is sometimes better, in test code, to violate it instead of following it.

  3. In Kent C Dodds’s article on the Testing Trophy, he describes a range from static checks, to unit tests, to integration tests, to end-to-end tests.

    1. (5 pts) Which is these is the quickest to run?

      static unit integration end-to-end
    2. (5 pts) Which most simulates the actions of a real human user of your application?

      static unit integration end-to-end
  4. When discussing integration tests, Kent describes "mocking", and says that he generally mocks network requests, and components responsible for animation.
    1. (10 pts) In the context of integration testing, what is mocking? (You may have to do your own research on this).
    2. (10 pts) There are mocking frameworks/libraries for each of the languages we are using in CS48 this quarter (C#/Unity, JavaScript and Python). Write the name of the language yoru team is using, and then write the name of a mocking framework for that language, and a URL for the main site documenting that framework:

      Language/Framework my team is using  
      Name of Mocking framework for that language  
      URL of main site for that framework  
  5. Naidele Manjunath and Olivier de Meulder, software engineers for the New York Times, explain how user stories and acceptance criteria are used in the development of their systems. Naidele and Olivier describe a role known as the Product Owner. As we have discussed, Product Owner is a very important role in traditional Agile teams. Read about that role on the NYTimes team, and you may also want to consult: https://www.agilealliance.org/glossary/product-owner.

    Now consider who your target “customers”/”users” are for your CS48 team’s application. Consider a strategy by which someone on your CS48 team could play the role of product owner. Decide whether that should be a fixed role for the remainder of the course, or a rotating role. Then briefly explain your strategy.

    For full credit, include

    • (5 pts) An explanation of who your customers/users are
    • (5 pts) What the product owner on your team will do (i.e. how they interact with the rest of the team)
    • (5 pts) Whether the role should be fixed or shifting throughout the course and why you made that choice.
  6. (10 pts) Naidele and Olivier describe using the Mocha and Cucumber libraries with JavaScript. While Mocha is specific to JavaScript/Node.js, Cucumber can be used with C++, Java, Python, C#, Ruby and a number of other languages.

    How is the NYTimes team using Cucumber?

  7. (10 pts) Naidele and Olivier describe four tangible benefits from BDD. Imagine that your team is able to replicate their success with BDD. Consider which of the four benefits you think would apply most to your own CS48 project. Explain the benefit in your own words, and explain how you could tell whether it was making a difference in the success of your project.