SER216: Testing Lifecycle, Unit Testing, Network Programming

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

White-box testing code coverage:

-Statement Coverage -Branch coverage -Condition coverage -Path coverage

Black box testing is concerned with:

A program's inputs and outputs (I/O behavior)

What is a Test Fixture?

A test fixure is a set of known objects in which a program will test against to review its functionality.

Traditionally, when should you write a test?

After the source code is written

Which of the following belongs to White box testing method? Statement Coverage Branch coverage Path Coverage All of the above

All of the above

What is JUnit?

JUnit is a an open source unit testing framework for Java Programming language.

The goal of black-box testing is to:

Reduce number of test cases by equivalence partitioning

How do we test the dynamic model?

White-box testing

What is the opacity of Unit Testing?

Whitebox testing

If the input is valid across a range of values, what ranges should be tested during test cases?

- Below the range - Within the range - Above the range

What is the test-driven development cycle?

- add a test - run the automated test and see it fail - write some code - run the automated test and see it succeed - refactor the code

If the input is valid only if it is a member of a discrete set, what test cases should be used?

- valid discrete values - invalid discrete values

Black-box testing is NOT concerned with:

-inner workings -process the application undertakes -any other internal aspects

Unit Testing Heuristics

1. Create unit tests 2. Develop the test cases 3. Cross-check the test cases to eliminate duplicates 4. Desk check your source code 5. Create a test harness 6. Describe the test oracle 7. Execute the test cases 8. Compare the results of the test with the test oracle

What is the lifecycle of testing?

1. Unit testing 2. Integration testing 3. System testing 4. Acceptance testing

Consider the following method and test case. How much statement coverage is achieved? public int returnInput (int input, boolean condition1, boolean condition2, boolean condition3) { int x = input; int y = 0; if (condition1) x++; if (condition2) x--; if (condition3) y=x; return y; } TestCase: returnInput(x, true, true, true)

100

Consider the following method and test case. How much branch coverage is achieved? public int returnInput (int input, boolean condition1, boolean condition2, boolean condition3) { int x = input; int y = 0; if (condition1) x++; if (condition2) x--; if (condition3) y=x; return y; } TestCase: returnInput(x, true, true, true) -25 -50 -75 -100

50

Consider the following method and its path coverage tree. How many test cases are required to test returnInput method and achieve 100% path coverage? public int returnInput (int input, boolean condition1, boolean condition2, boolean condition3) { int x = input; int y = 0; if (condition1) x++; if (condition2) x--; if (condition3) y=x; return y; }

8

What is Unit Testing?

A unit test is a piece of a code (usually a method) that invokes another piece of code and checks the correctness of some assumptions afterward. If the assumptions turn out to be wrong, the unit test has failed. A "unit" is a method or function. A unit test is an automated piece of code that invokes a different method and then checks some assumptions about the logical behavior of that method or class under test. A unit test is written using a unit testing framework. It can be written easily and runs quickly. It can be executed, repeatedly, by anyone on the development team.

In XP, when should you write a test?

Before the source code is written

The two types of dynamic testing are:

Black-box & white-box

How do we test the functional model?

Black-box testing

Unit testing is usually done by

Developers

Blackbox testing is also known as

Functional testing

Blackbox strategies

Integration Functional System Acceptance Beta Regression (All but unit)

JUnit was written by

Kent Beck and Erich Gamma

How is Unit Testing different from Refactoring?

Refactoring can be done after writing several tests, or after each test. It is the act of changing a piece of code without changing its functionality. If you've ever renamed a method, you've done refactoring. If you've ever split a large method into multiple smaller method calls, you've refactored your code. It still does the same thing; it's just easier to maintain, read, debug, and change.

Whitebox testing is also known as

Structural testing

What is Test Driven Development (TDD)?

Test Driven Development is vastly different than "classic" development. You begin by writing a test that fails, then move on to creating the actual production code, and see the test pass, and continue on to either add functionality, refactor your code, or to create another failing test.

How do we achieve 100% path coverage with white box testing?

Test cases must be written for scenarios where conditions are true and false

Static Testing

Testing at compile time

Dynamic Testing

Testing at run time

White box testing

Testing methodology that looks under the covers and into the subsystem of an application

What is a Test Fixture?

Tests need to run against the background of a known set of objects. This set of objects is called a test fixture.

SUT (System Under Test)

The piece of code being tested.

White-box testing

allows tester to refer to and interact with the objects that comprise and application

Which of the following need to be assessed during unit testing?a. algorithmic performance b. coding standards c. error handling d. execution paths e. both c and d

e. both c and d

Unlike black-box testing, white-box testing allows you to

see what is happening inside the application


Set pelajaran terkait

Mental Health Ch 9 (Therapeutic Communication) - NCLEX style questions

View Set

Final Lecture Exam: micro Dr. Dan

View Set

Unit 1: Assessment: Know Yourself, Know Your Career Field

View Set