Software Testing Midterm Questions

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

This CMMI level has a characteristic of using quantified data for making decisions. It also analyzes and improves processes based on data

5

In JUnit, which annotation indicates that a method should run before the entire test

@BeforeClass

Before the whole class once

@BeforeClass Public static void setUpOnce{ system.out.println("Hello"); }

In JUnit, which annotation indicates a method to be a test case?

@Test

readfile example

@Test public void testReadFile() throws Exception{ File file = new File("./message.txt"); List<String> lines = FileUtils.readLines(file, StandardCharsets.UTF_8); System.out.println(lines); }

This type of testing is end-to-end testing done by the users

Acceptance

Unchecked exceptions: CodingBat

Arithmetic exceptions: Checked

In the AAA style of Unit testing. AAA stands for

Arrange - _Act__- Assert

The conjuction effect makes you

Ascribe a higher likelihood to combination events rather than to either single event

Test most expensive

Assert.assertEquals("Bugatti", ds.getInventory().getSize().getMostExpensive());

A defect in code manifests as a

Bug

You execute a test script and the actual behavior is not what you expected, to resolve the dissonance you decide to modify the script to match the software behavior. What are you succumbing to?

Cognitive dissonance

___ refers to the tendency to search for or interpret information in a way that confirms ones's beliefs or hypotheses

Confirmation bias

In JUnit, to compare floating point values, the ____ refers to the maximum difference between expected and actual for which both numbers are still considered equal.

Delta

Verification is

Ensuring that the product is built correctly

Validation is

Ensuring that the right product is built

Testing in and of itself improves quality of the software.

False

The later a defect is found the more inexpensive it is to fix it

False

This is a latent error in the software waiting to be manifest through specific usage scenarios

Fault

Always (,) for Assert.assertEquals(expected,actual)

For double value, add delta value like 0.01 Assert.assertEquals("495677", ds.getInventory().getAverage(), 1);

Public void testLoadfromWeb(){ Create dealership : Dealership ds = new Dealership(); Grab url and paste Ds.loadInventoryFromWeb(paste url); Assert the inv into loading Assert.assertEquals(9, ds.getInventory().getSize());

How to load from web

When a developer marks a bug as "no repro", what does that mean?

It means the bug is not reproducible and some clarification is needed

Which of the following does NOT lead to the resolution of a dissonance?

Punish the person who gave you the dissonant belief (shoot the messenger)

Software testing pertains to___

Quality control

__ is about defining and assessing the adequacy of software

Software quality assurance

Define software testing.

Testing is the process of executing a program with the intent of finding errors

public final void writeObject(Object x) throws IOException

The above method serializes an Object and sends it to the output stream.

Notice that for a class to be serialized successfully, two conditions must be met −

The class must implement the java.io.Serializable interface. All of the fields in the class must be serializable. If a field is not serializable, it must be marked transient.

public final Object readObject() throws IOException, ClassNotFoundException

This method retrieves the next Object out of the stream and deserializes it.

Enforcing coding standards is an example of a SQA practice

True

In JUnit, the pattern is: assertEquals(expected, actual)

True

The goal of QA is to improve development and test processes so that defects do not arise when the product is being developed

True

serialization example

import java.io.*; public class SerializeDemo { public static void main(String [] args) { Employee e = new Employee(); e.name = "Reyan Ali"; e.address = "Phokka Kuan, Ambehta Peer"; e.SSN = 11122333; e.number = 101; try { FileOutputStream fileOut = new FileOutputStream("/tmp/employee.ser"); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(e); out.close(); fileOut.close(); System.out.printf("Serialized data is saved in /tmp/employee.ser"); } catch (IOException i) { i.printStackTrace(); } } }

exception ex

public class VehicleTooCheapException extends Exception { private int price; public void setPrice(int price) throws VehicleTooCheapException { if(price < 50000){ System.out.println("Vehicle is priced too low"); throw new VehicleTooCheapException(); } this.price = price; } }

exception example

public class VehicleTooOldException extends Exception { private int modelYear; public void modelYearIs(int modelYear) throws VehicleTooOldException { if (modelYear < 2010) { System.out.println("This vehicle is way too old! (nah not really)"); throw new VehicleTooOldException(); } this.modelYear = modelYear; }


Kaugnay na mga set ng pag-aaral

15 accents diacrítics en català

View Set

Base Pay Administration and Pay for Performance - GR4/C4

View Set

Constant of proportionality Unit1

View Set

50 CHAPTER Care of Patients with Musculoskeletal Problems, MUSKOSLETAL, Lewis Ch. 63 Musculoskeletal Problems, Chapter 63: Musculoskeletal Problems Lewis: Medical-Surgical Nursing, 10th Edition, Musculoskeletal NCLEX style questions, Lewis Ch 64 Musc...

View Set

Smartbook: Chapter 4 Completing the Accounting Cycle

View Set

AP Psychology - Social Psychology (Chapter 16)

View Set