0% found this document useful (0 votes)
4 views3 pages

JUnit Testing Lab 2 Guide

The document outlines the requirements for Lab 2 of EECS2030A, due on September 18th, 2024, focusing on testing Java code using JUnit 4. Students must download provided files, generate JavaDoc documentation, and implement comprehensive test cases for a method calculating points for speeding violations. Submission consists of a single file with test cases, and grading will be based on the completeness of these cases and identification of any faults in the code.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

JUnit Testing Lab 2 Guide

The document outlines the requirements for Lab 2 of EECS2030A, due on September 18th, 2024, focusing on testing Java code using JUnit 4. Students must download provided files, generate JavaDoc documentation, and implement comprehensive test cases for a method calculating points for speeding violations. Submission consists of a single file with test cases, and grading will be based on the completeness of these cases and identification of any faults in the code.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

EECS2030A: LAB 2 Due: Sept 18th, 2024 - 11:59 pm

Max. Marks: 100

The purpose of this lab is to ensure that you

A) practice testing codes using JUnit 4.

B) are being comfortable generating automated test framework using eclipse (or any
other editor that you prefer)

1. Setup
Please download [Link] that is attached to this description.

• Open eclipse.
• Click on File and select Import.
• Select General
• Choose Existing Projects into Workspace and click Next.
• Click on Select Archive File and then Browse. Find [Link] and click Finish.
You should see two files, one is called [Link] and one [Link].

2. JavaDoc generation
The javaDoc has been written for you in [Link] file. All you need to do is to generate it as
an HTML file to make it easier for navigation. For this select lab2 package -> click Project
from main menu -> select lab2 package-> select [Link]. It will ask you for the destination
in which you want to store the documentation. Enter the path, click next, select the basic
options and then click on Finish.
If you look at the location in which you stored the documentation, you’ll see there is a file
called [Link]. Clicking on this file, shows the documentation of the project in your
browser.

3. Testing Task
For this task, we are asking you to implement a comprehensive set of test cases for the given
method in the enclosed example.
The given code is a working code that solves the problem of calculating points that are given
to the drivers, who violate the maximum speed limit. The points are given according to the
table below. Please note that the given code calculates the points only and do nothing about
other penalties.

Page 1 | 3
EECS2030C: LAB 2 Due: Sept 19th, 2024 - 11:59 pm
Max. Marks: 100

Figure 1: the picture is taken from [Link]


points/.

Your task is to write a set of JUnit test cases that comprehensively test the given code. A
comprehensive set of test cases is one that not only checks if the expected output is the same
as the actual output, as described in the specification above but also traverses all paths in the
code. If there is a conditional statement, both the true and false conditions should be tested.
For multiple conditions, all possible combinations of the conditions being true or false should
be tested. This means if the condition is "A AND B," four different test cases should be written,
unless it is not possible. The four conditions are:
– A=True, B=True
– A=True, B=False
– A=False, B=True
– A=False, B=False.

Page 2 | 3
EECS2030C: LAB 2 Due: Sept 19th, 2024 - 11:59 pm
Max. Marks: 100

4. Submit
You only need to submit one file containing your test cases. It is not important what is the
name of the file name. I strongly recommend attending the lab, as it allows you to become
familiar with how our trained TAs will grade your work. During the lab, the TA will grade
your submission and provide feedback to improve your code.
Please note that there is no implication that this code is correct. Therefore, if there is any
fault in the code, your test cases should be able to identify it.

5. Marking Schema
You are graded based on complete your test cases are. If there is any compilation error in
your code, you will not receive any grade. Also, please note that there is no guarantee that
the code is fault free. If you found any fault in the code, i.e. the test case does not pass, you
should include the case in your solution and explain why you think it is a fault.
*******************************************************************************************

Page 3 | 3

You might also like