CS代写 | Sample Bottom Up Testing

本次澳洲代写主要为马尔科夫链相关的test

Test Cases

 

The test case can be developed using Junit tests in Java. While writing the test cases, please ensure that you achieve complete code coverage with respect to the class – setting and accessing all the variables, testing all the methods in the object and testing all the object state (if applicable in your project).

 

Please provide the steps (documentations) of running your test cases.

 

Few test cases can be given as:

 

The File:

This file contains test cases to test all the methods in the …. class located in the ….java file

 

  • The test can validate that executing the indexOf(ImageItem file) method on a given item index which exists in the list should return a file name itself.

 

@Test

public void testIndexOfFileThatDoesExists(){

//setting the pathName to a string that does exist;

ImageItem image = makeImageItemObject(2, 2);

assertEquals(“IndexOf the image file that exists in the list should ” +

“return the file name itself”, 2, fileInfoQueue.indexOf(image));

}

 

  • The test can validate that executing the indexOf(ImageItem file) method on a given item index which does not exists in the list should return –1.

@Test

public void testIndexOfFileThatDoesNotExists(){

//setting the pathName to a string that doesn’t exist;

ImageItem image = makeImageItemObject(2, 30);

assertEquals(“The fileInfoQueue shouldn’t find the image file in the list. Thus, ” +

“return -1”, -1, fileInfoQueue.indexOf(image));

}

 

  • The test can validate that executing the indexOf(ImageItem file) method on am empty list should return –1.

@Test

public void testIndexOfFileOnEmptyList(){

FileInfoQueue test = new FileInfoQueue();

assertEquals(“ImageItem list has 0 files”, 0, test.getList().size());

//create an empty file

FileInfo file = new FileInfo();

ImageItem itemTest = new ImageItem(file, 12, 12);

assertEquals(“Finding an indexOf file in an empty ImageItem list should ” +

“return -1”, -1, test.indexOf(itemTest));

}

 

  • The test can validate that executing the empty() method on an empty list return true.

 

@Test

public void testListIsEmpty() {

FileInfoQueue test = new FileInfoQueue();

//the list should be empty

assertEquals(“ImageItem list should be empty”, true, test.empty());

}

 

  • The test can validates that executing the empty() method on non-empty list return false.

@Test

public void testListIsNotEmpty() {

//the list should contain 10 image files

assertEquals(“ImageItem list contains the image files”, false,

fileInfoQueue.empty());

}

 

 

Test Outcomes

An image that shows the outcomes of all the JUnit test cases used to test all your methods presented above can be presented.