E34: Experience testing UH Degree Data

In E30: Experience creating standards-compliant UH degree data, you developed seven functions to manipulate UH degree data.

In this experience, we will use Jasmine to design tests for just one of those functions: totalDegrees. As part of testing, we will make this function more robust.

Prerequisites

Prior to starting this WOD, please:

The WOD

Ready? Let’s begin:

  1. Start your timer.

  2. Create a branch of your uhdegreedata repo called “totaldegrees-testing-1”. All your work for this WOD will be done in that branch.

  3. Add the standard .jshintrc file to the project. Configure IntelliJ to use this file. Fix JSHint violations, if any.

  4. Download the Jasmine 2.3.4 standalone distribution if you don’t have a copy already.

    • Copy the lib/ and spec/ directories and the SpecRunner.html file into your project.
    • Delete spec/SpecHelper.js, and rename PlayerSpec.js to TotalDegreesSpec.js.
    • Edit SpecRunner.html to load underscore, uhdata.js, uhdatafunctions.js, and TotalDegreesSpec.js.
  5. Design tests for the totalDegrees function. In addition to testing that totalDegrees returns the correct value for correctly specified sample data, test to make sure that totalDegrees throws a descriptive error when: (a) a record is missing the AWARDS field, and (b) an AWARDS field contains a non-integer value. If Jasmine reports “Error: Actual is not a Function”, see this StackOverFlow answer.

  6. Now that you’ve designed these tests, run them and observe that they fail! Go back and modify the implementation of totalDegrees to make the tests pass.

  7. Congratulations! You’ve just experienced a simple version of Test Driven Development.

  8. When the tests pass and JSHint runs without problems, commit your branch to GitHub.

  9. Check that your branch is on GitHub.

  10. Stop your timer and record your time. Be sure to record it, because you will need your WOD time data when you write your technical essay.

Rx: < 25 min Av: 25-30 min Sd: 30-40 min DNF: 40+ min

Demonstration

Once you’ve finished trying the WOD for the first time, watch me do it:

Standard WOD Caveats

You’ll learn significantly less from watching me solve the WOD if you haven’t attempted the WOD yourself first.

While it’s an achievement to finish the WOD no matter how long it takes, you might experience “diminishing returns” if you work longer than the DNF time. Thus, it is usually strategic to stop working at the DNF time and watch my solution.

After watching my solution, I recommend that you repeat the WOD if you have not achieved at least Av performance. If so, be sure to:

Feel free to keep trying until you make Rx if that’s of interest to you.

Submission Instructions

To be completed by the time and date indicated on the Schedule page.