Unit Testing Quiz

5 questions Pass: 70% +25 pts (50 with Pro)

Quiz covering Debugging and Testing

What you'll be asked

  1. What is the primary purpose of a unit test in software development?
  2. In the context of unit testing, what is a 'mock' object used for?
  3. Which of the following best describes the 'Arrange-Act-Assert' (AAA) pattern?
  4. Why is it considered a best practice to keep unit tests independent of each other?
  5. You are writing a unit test for a function that calculates a discount. The function throws an error if the input price is negative. How should you test this specific scenario?

Answers and explanations come after you submit.