软件测试代写 | COMP2100/6442 Lab 3 – Software Testing

本次澳洲代写是JUnit软件测试的一个Lab

Introduction

In this lab we will be using the JUnit testing framework to create blackbox and
whitebox tests

Quick note:

For the black box testing section, you will be testing
based off the requirements written for the program. Try
not to look at the code until you are truly stuck. See how
many of the ‘incorrect’ programs you can identify.
Perhaps even finding the only correct one.

Note that looking at the code might not help much, as we
designed it to be difficult to read. The idea is that you
learn to build test cases based on the requirements.

Agenda

Task 1: Black Box Testing (2 marks)
Using blackbox testing, identify which is the correct MarkCalculator class. There
is only 1 correct MarkCalculator.

Task 2: (Non-assessable, but mandatory)

Task 2.1: Statement Complete
Using white box testing, achieve statement complete for a method.

Task 2.2: Branch Complete
Using white box testing, achieve branch complete for a method.

Task 2.3: Path Complete
Using white box testing, achieve path complete for a method.

Task 1: Black Box Testing – Description

There are 16 different mark calculator classes within task 1. Without looking at
their implementation you will need to write tests within MarkCalculatorTest.java
to identify which of the classes is correct.

Which is ‘correct’ is defined as the one
which follows all the requirements laid out
in MarkCalculator.java and in the next
slide.

Task 1: Black Box Testing – MarkCalculator Requirements

The ‘MarkCalculator’ interface uses the method ‘calculateMark’ to return a student’s overall grade given 6 inputs:
(1) A lab mark between 0 and 10; (2) Assignment 1 and (3) Assignment 2 marks between 0 and 10; (4) FinalExam mark between 0
and 100; (5) Whether the student attended the final exam (boolean); (6) Whether all assessment items are redeemable on the final
exam (boolean).

All input ranges mentioned above are inclusive and adhere to the following:
If any of these inputs are not within the expected range then a ComponentOutOfRangeException is thrown.
If a student does not attend the final exam than they will receive a grade of NCN and a final mark of null.
If all assessment items are redeemable on the final exam, the returned mark and grade will be whichever is greater: their
final grade accounting for all course assessments or their final exam mark.
With regards to value of assessment items:

A lab mark is worth 10% of the final grade and is marked out of 10.
The assignments are worth 15% each of the final grade and marked out of 10.
The final exam is worth 60% and marked out of 100.
These marks are combined EXACTLY and then rounded to produce an integer out of 100. Once done, a grade is determined using
the following (inclusive) ranges:

0 ~ 44 : N
45 ~ 49 : PX
50 ~ 59 : P
60 ~ 69 : C
70 ~ 79 : D
80 ~ 100 : HD

Task 1: Black Box Testing – Clarification

If you are confused about what you can look at, here is a list:
– ComponentOutOfRangeException.java
– Grade.java
– MarkCalculator.java (not MarkCalculator<number>.java)
– MarkGrade.java
– MarkCalculatorTest.java
You will be writing your test cases inside: MarkCalculatorTest.java. Notice that you
do not have to make an instance of each class within each of your tests, this has
already been automated for you.
Please try and at first write test cases without looking at the implementations.