Test SuitesTest classesTest classes for the current assignmentTest suitesExample test suite (slightly edited)Running the test suiteThe EndTest SuitesRecommendations for current assignmentTest classesA unit test is a test of an individual classBy convention, we name test classes after the class that is being testedFor example, if we have a CodeMachine class, we would have a CodeMachineTest class for testing itInterfaces have no actual methods to be testedAbstract classes may have non-abstract methods that can be tested (and abstract ones that can’t)If a project has multiple classes, it makes sense to have a test class for eachTest classes for the current assignmentHere are the classes you need:SecretCode2 (GUI class—not readily testable)CodeMachine (abstract)SimpleCodeMachineArrayCodeMachinePigLatinMachineHere are the test classes I recommend:CodeMachineTestSimpleCodeMachineTestArrayCodeMachineTestPigLatinMachineTestTest suitesA test suite is a class that contains calls to unit test classes (and sometimes other test suites)This is sometimes more convenient than running your unit tests one at a timeNaturally, Eclipse will help you create a test suiteCreate your unit test classesFile New… Other… Java JUnit JUnit Test SuiteClick the Next button to choose which unit tests to include in the suiteIf you add test classes later, you can hand-edit this suiteLike the JUnit test classes, it’s just ordinary javaExample test suite (slightly edited)import junit.framework.Test;import junit.framework.TestSuite;public class AllTests { public static Test suite() { TestSuite suite = new TestSuite("Test for default package"); suite.addTestSuite(CodeMachineTest.class); suite.addTestSuite(ArrayCodeMachineTest.class); suite.addTestSuite(SimpleCodeMachineTest.class); suite.addTestSuite(PigLatinMachineTest.class); return suite; }}Running the test suiteRun the test suite just like any other unit test:Run Run As JUnit TestResults are very similar to those for a simple JUnit testThe
View Full Document