Worksheet: J7 | CS 2113 Software Engineering - Spring 2023

Worksheet: J7

Worksheets are self-guided activities that reinforce lectures. They are not graded for accuracy, only for completion. Worksheets are due by Sunday night before the next lecture.

Note

Attempt to answer these questions before running the code. This will improve your ability to analyize and reason about code without an IDE or compiler. This skill we be helpful on the exams.

This worksheet combines topics from the Software Testing lecture as well as today’s lecture.

Questions

  1. What is fault localization?

    Reveal Solution

  2. What are three benefits of Test Driven Development (TDD)?

    Reveal Solution

  3. Given the example of requirements for generating a password:

    • It must have at least one number.
    • It must have at least one uppercase letter.
    • It must have at least one lowercase letter.
    • It must not contain the website gmail anywhere. (For example if we were generating a password for gmail accounts)
    • It can only be made up of letters, numbers, and the underscore.

    What are the input domain paritions for this exercise?

    Reveal Solution

  4. Complete the truth table below to show what inputs we need to achieve active clause coverage for the following conditional:

    if ( ( (a > b) or G ) and (x < y) )
    
    a > b G x < y predicate outcome clause responsible

    Reveal Solution

  5. Consider the control flow graph below. What are all the paths (using node numbers) that would achieve full path coverage as a test criteria? Is this a finite set?

    flow

    Reveal Solution

  6. What benefit does mutation testing offer over other testing methods discussed in class?

    Reveal Solution

  7. Convert your DriverJava1_sample.java file from the previous lecture into a Junit test file with the following elements:

    • a single unit test for every input class (give it the name of that input partition)

    Assume that the method under test is called checkCode that takes a string as an argument and returns a boolean value whether or not the input was a valid code.

    Reveal Solution