Java Bootcamp – Workbooks and Challenges
)}

Shopping Cart – Part 1

Test-Driven Development: write tests before writing code.

Unit testing results in modular code. Modular code is:

  • easy to test.
  • immune to bugs.
  • easy to understand.
  • scalable.

Setup

Screen Shot 2021-07-17 at 11.57.29 PM.png

Test Cases


Inside requirements.txt, identify meaningful test cases:

  • adding an item if not already added
    • [identify test case 1]
    • [identify test case 2]
  • removing an item
    • [identify test case 3]
    • [identify state exception test case]
  • checkout
    • [identify test case 5]
    • [identify test case 6]
    • [identify test case 7]
    • [identify state exception test case]

Should I test the getters/setters/constructors?

No. They don't offer meaningful logic that's worth unit testing.

Good Luck!


Feedback Summary
4.8
38 students
5

92%
4

3%
3

0%
2

0%
1

5%
Written Reviews
There are no written reviews yet.