软件测试代写 | CSIT 5100 (Fall 2020) Assignment 1 Object-Oriented Programming and Testing

这个作业是在JUnit 5下练习面向对象程序的单元测试
CSIT 5100 (Fall 2020) Assignment 1
Object-Oriented Programming and Testing

2.1 Quick Start
 We will use Java SDK 14 and Eclipse IDE (2020-06) for grading. You can download the latest Eclipse IDE for
Java developers (2020-06) from . By default, it is bundled with JUnit 5
and EclEmma. Please install Java SDK 14 before installing Eclipse.
 You can follow the instructions below to import the source code into
an Eclipse project.
o Click “Finish” to import the HMS project.
 Test cases and the test suite should be put into the “test” folder under
the default package. We will run JUnit Test against the “test” folder
when grading your submission as shown in the diagram above. Test cases in other folders will not be
graded. We only count the statement and branch coverage of code in the “src” folder of HMS. You should
not make any changes to the src folder. You may confine the coverage measurement to the “src” folder by
configuring the Coverage configurations under “Coverage As -> Coverage Configurations…”.
 To construct a JUnit test case, you can choose menu File  New  JUnit Test Case. Besides invoking the
methods under test and writing assertions, you should also properly implement the routine methods such as
“setup()” and “teardown()” when necessary. Please note that the statements covered by a test case that
only contains meaningless assertions such as “assertTrue(true)” will not be counted. We include a test
example for your reference in the appendix.
 HMS is a GUI program involving a number of GUI widgets and corresponding
action handlers. In case you may be confused about how to write JUnit test for
GUI widget, we provide an example test case in project. It may give you some
hints on how to invoke the registered handlers of a GUI widget. Please refer to
“GUITest.java” in test folder to learn more details.
 To ease grading, please add all your test cases to test suite “AllTests” to
automatically run all your test cases. To register you test case in the test suite,
you should add the test case’s Java class name with “.class” to the
“@SelectClasses” annotation. For example, if you want to register test case
“ExampleTest”, you should specify the annotation in “AllTests.java” as follows.
 EclEmma should be bundled with Eclipse; otherwise, you can directly search “EclEmma” in Eclipse
Marketplace. You may use other code coverage tools, but the grading will be based on the coverage results
provided by EclEmma. For the usage of EclEmma, please refer to its online user guide
@RunWith(JUnitPlatform.class)
@SelectClasses({
ExampleTest.class
// , include additional test classes, each in a new line
})
public class AllTests {
}
1. Launching in Coverage Mode
2. Using the Coverage View
2.2 Submission Requirement
 Stage 1. By the end of this stage, your test suite should achieve at least 50% statement coverage and 10%
branch coverage of the src folder. You need to submit your test cases at Canvas by the deadline. No late or
incorrect submission will be accepted.
 Stage 2. You can further improve the coverage of your test suite in this stage. After completion, you need to
submit the improved test suite with a brief report. In the report, you should clearly present:
1. A few sentences describing the basic structure of the system under test.
2. The statement coverage your test suite achieved.
3. How you construct the test cases to achieve high coverage with affordable effort. If you applied some
technique to automate the test generation process, please also state the basic idea of your technique.
For example, you may randomly generate a large number of test cases for a method, and add the test
case that increases coverage into the test suite.
4. The infeasible program statements, if any. It is generally impossible to find all. Just try your best.