Unit Testing

This quiz covers unit testing concept, object class testing, weather station example, state sequences, automated unit tests (setup/call/assertion), mock objects

download Export
search_insights Statistics
stylus_note White Board
Quran
calculate Calculator
dictionary Dictionary
fullscreen Full Screen
QUESTION OF

volume_mute Read quiz aloud
Views #: 188
Questions #: 12
Time: 10 minutes
Pass Score: 80.0%
Style
Mode

Three Stages of Development Testing

1 pts
volume_mute
To complete the line match
  1. Click on an item in the first group
  2. Click on an item in the second group
  3. To delete a match, double click on a line

Stage

Component testing
System testing
Unit testing

Focus

Testing component interactions in a partial or complete system
Testing the functionality of objects or methods individually
Testing component interfaces that provide access to component functions

Development testing includes three stages. Match each stage to its correct focus.

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Unit Testing Scope

1 pts
volume_mute

What is the primary subject of unit testing?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Testing Object Classes Comprehensively

1 pts
volume_mute

When testing object classes, which of the following should be covered to achieve comprehensive testing? Select all that apply.

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Weather Station Object - Unit Testing

1 pts
volume_mute

Consider a WeatherStation object with a single constant attribute (identifier) and methods including reportWeather(), reportStatus(), powerSave(), remoteControl(), reconfigure(), restart(), and shutdown().

WeatherStation identifier reportWeather() reportStatus() powerSave(instruments) restart(instruments) shutdown(instruments)

Why must the restart() method be executed before testing the shutdown() method?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Inheritance and Object Class Testing

1 pts
volume_mute

Why does inheritance or generalization make object class testing more complicated?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


State Sequence Testing for Weather Station

1 pts
volume_mute

Using a state model, testers identify sequences of state transitions to test. Which of the following are valid state transition sequences for the weather station that should be tested? Select all that apply.

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Three Parts of an Automated Test

1 pts
volume_mute
Please drag and drop the options to sort them

An automated unit test has three standard parts. Arrange them in the correct order.

Assertion part - compare the result of the call with the expected result
Call part - call the object or method to be tested
Setup part - initialize the system with the test case inputs and expected outputs
note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Automated Test Assertion Outcome

1 pts
volume_mute

In an automated unit test, what happens when the assertion evaluates to false?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Purpose of Mock Objects

1 pts
volume_mute

What is the primary purpose of using mock objects in unit testing?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Mock Object Example - Database

1 pts
volume_mute

A development team is unit testing a class that calls a database to retrieve customer records. The database setup takes 30 seconds each test run. They decide to use a mock object. What would the mock object database typically contain?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Mock Objects for Rare Events

1 pts
volume_mute

Beyond replacing slow dependencies, mock objects can also be used for another purpose in unit testing. What is this additional use?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Unit Testing and Debugging Relationship

1 pts
volume_mute

Complete the statement about the relationship between development testing and debugging: "Development testing is primarily a (1) process and is usually interleaved with (2) - the process of locating problems with the code and changing the program to fix these problems."

Please drag and drop the selected option in the right place or type it instead
code review
validation testing
debugging
defect testing
note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation