![]() |
Computer Science Department |
Objectives: |
This lab reinforces the use of JUnit which was introduced in prior labs. |
Background: |
The Document class is partially completed. You will need to complete it and test it to insure that it is fully functional. |
Key Terms: |
JUnit - a Java add on that provides a testing harness for testing individual components of a system. |
Materials: |
Prior to the lab, you should code the Document class. Document.java And NoSuchLineException is found here: NoSuchLineException.java Two files for testing are here: tst1.txt & tst2.txt And a document to build your test cases before your JUnit testing: TestCases.rtf |
Acknowledgment |
From test material developed by Nathan Sprague. Lab created by Nancy Harris |
Set up your program environment, including mounting your n-drive on your local machine and building an appropriate folder on the n-drive to accumulate your program material.
If you have not already done so, code your solution to the Document.java class. Each method is described in detail inside of the code.
Looking at the Document class, you will need to test 5 methods. For each method, what are the different document types (or lines) that you will need to test the methods properly. For example, tst1.txt (the file provided above) contains 2 paragraphs and 9 lines total. There is one empty line and all the rest contain words. Think about each method that you will want to test and the different ranges of values that you will want to test.Fill in the TestCases.rtf for tests that you might run. Start with a list of the test input files and which Document object you will build from it in setup. Then as you develope each test, decide which of the objects you will use to test that method thoroughly.
Create a JUnit test file for testing Document.java. In the setup method, create Document objects to use for testing as described in Part 2.
Start with one method and after test.
Then add in the additional method tests. Don't try to test it all at once.
Updated 02/19/2012 (nlh)