[SOLVED] Software Testing -Assignment 1

30.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (2 votes)

In this assignment, you will practice activities covering the concepts taken in the course so far, through two main tasks as follows:

 

Task 1

 

Below is one faulty program. It includes test inputs that result in failure. Answer the following questions about this program.

 

Program: 

public int findLast (int[] x, int y) {

// Effects: if x==null throw NullPointerException

// else return the index of the last element in x that equals y

// If no such element exists, return -1

for (int i =x.lenght-1; i > 0; i–)

{ if (x[i] == y)

{ return i;

}

} return -1;

}

 

// test x=[2,3,5] y=2

// expected output =0

 

 

  1. Explain what is wrong with the given code. Describe the fault precisely by proposing a modification to the code.
  2. If possible, give a test case that does not execute the fault. If not, briefly explain why not.
  3. If possible, give a test case that executes the fault, but does not result in an error state. If not, briefly explain why not.
  4. If possible give a test case that results in an error, but not a failure. If not, briefly explain why not. Hint: Don’t forget about the program counter.
  5. For the given test case, describe the first error state. Be sure to describe the complete state Task 1 deliverables:
  6. A report showing a detailed answer for each step from (a) to (e). This report can be a word document, or a set of compressed scanned pictures.

 

Task 2

 

Objectives

  • Studying implementation of an open source project.
  • Using Input space-partitioning & boundary-analysis techniques to design test cases.
  • Learn unit testing and code coverage.

 

 

Software Testing – Winter 2021

Description

  • In this task, you will study the open source code of javamathlibrary.
  • There is no JavaDoc for this code, but the code is commented in the same style, so you should read carefully and try to grasp as much as you can. Furthermore, you may refer to the JavaDocs of the parent classes from the Java SDK.
  • You are to study the following classes (de.tilman_neumann.util.StringUtil and de.tilman_neumann.util. Multiset_HashMapImpl)
  • Once you study those APIs implementations/documentations, you are required to use input space partitioning along with boundary values analysis to design unit tests for their methods.

 

Task 2 deliverables:

  1. A report of all the test cases you have developed for the classes mentioned above, with full reasoning of the partitions, the boundary values, and the chosen coverage criteria with complete explanation. In the written report, you should discuss how you are designing the test cases. This report can be a word document, or a set of compressed scanned pictures.
  2. A testing package, with a test class for each class mentioned above (please follow java coding/naming standards).

 

Things to consider for task 2

  • You can use JUnit or TestNG or any other java unit testing library if you please.
  • Failing reasons for each unit test case should specifically be one reason.
  • You should add your test package/classes to the included project.
  • Make the test design document as detailed as possible.
Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.