Activity: Get started with JUnit
(no submission)
Purpose:
- Practice analyzing and designing tests for a program's source code
- Verify that your testing environment is set up properly
- Get started with JUnit
- Get ready to work on assignments, prepare for quizzes and the final exam
Require: Java 8 (or higher), JUnit (you are recommended to use the latest version, JUnit 5).
If you have not set up your testing environment, please refer to
the Schedule page for details on JUnit 5.
Additional resources:
You may find class discussions on RIPR model,
test automation, and characteristics of good tests
helpful when designing and automating your tests.
Instruction:
You may work alone or with another student in this course.
Consider ArrayOperations.java.
- Develop at least 5 JUnit tests to evaluate
the ArrayOperations.numZero() method.
- Follow the characteristics of good tests:
each test verifies one fact (a specific purpose allows traceability).
- At least one of your tests must detect the fault in the subject under test
— that is, your test case causes the failure to propagate,
and your test oracle reveals the failure.
- You may create a new JUnit test file or
add your JUnit tests to the
ArrayOperationsNumZeroTest.java template.
Reminder:
You are writing tests to check against ArrayOperations.java.
Thus, do not modify the program under test.