Java Testing

profile4n9r58y2u
homework1.pdf

1) Answer the following questions for each method or method signature

below. You may assume that these functions do not access or modify any

memory not allocated within the function itself (i.e., global or

class-level data).

I. int foo(boolean a, boolean b, boolean c);

A). How many test cases are required to exhaustively test this function?

B). Is it possible to perform an functionality-based partitioning given

the information above? You do not need to provide a partitioning

II. int biz(boolean a, boolean b, boolean c){

if(a==b){ return 1; }

if(b==c){ return 1; }

return 0; }

a). How many test cases are required to exhaustively test this function?

b). Is it possible to perform an interface-based partitioning given the

information above? You do not need to provide a partitioning

III. int bar(int a){

int k = 1; while(k<a){

k+=k }

} a) How many test cases are required to exhaustively test this function?

You may assume a 32-bit `int` data type and an accurate approximation

will receive full credit.

b) Give one possible functionality-based partitioning for the code above.

2). Consider the following function signature String[] findFilesandFoldersInDirectory (

String directoryName, String filePartialName) throws FileNotFoundException;

This method takes as input a directory name and a partial string

representing part of a file or folder. It finds out all the folders and

files within the given directoryName whose names contain filePartialNa

me by recursively searching all subdirectories of directoryName . A

FileNotFoundException is thrown only if directoryName is not a valid

directory.

Design a random testing scheme for the method function. Provide either

a verbal explanation of your scheme (250 words or less) or pseudocode