SYSC 2004 Lecture Notes - Lecture 9: Test Fixture, Junit, Bluej
Document Summary
Midterm will cover chapters 1-6, first 6 labs, first 2 assignments. Chapter 9, well-behaved objects, section 9. 4, test automation. For more info, go to the junit web site: http://www. junit. org. Regression testing framework written by kent beck and erich gamma. Inspired the xunit family of testing tools for several languages (e. g. , c, python, ) Can be used with any java development environment. Names of test cases must begin with test. Test case consists of: code to create objects used in the test (test fixture) code to invoke methods on objects code to compare expected results with actual results. Example: verify that the starting square of a new board object is square 1 public void testcreateboard() Square loc = board. startingsquare(); assertequals(1, loc. number()); assertequals() triggers a failure if its first argument (the expected result) isn"t equal to its second argument (the actual result) For test case to pass, board(), startingsquare(), and number() must be implemented. More tests needed (see boardtest in monopoly-v1, monopoly-v2)