0% found this document useful (0 votes)
63 views7 pages

Worksheet 2.11 Unit Testing

Unit testing is a type of software testing where individual units or components are tested to validate they work as expected. Unit tests isolate sections of code and use dummy objects to test parts that aren't integrated. They help find bugs early, save costs, help developers understand code, and serve as documentation. While some developers think integration tests are enough, unit tests actually increase development speed by catching errors sooner. The advantages of unit testing include examining tests to understand APIs, refactoring code while ensuring correctness, and testing parts independently. However, unit tests cannot detect all errors or issues with integration or systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views7 pages

Worksheet 2.11 Unit Testing

Unit testing is a type of software testing where individual units or components are tested to validate they work as expected. Unit tests isolate sections of code and use dummy objects to test parts that aren't integrated. They help find bugs early, save costs, help developers understand code, and serve as documentation. While some developers think integration tests are enough, unit tests actually increase development speed by catching errors sooner. The advantages of unit testing include examining tests to understand APIs, refactoring code while ensuring correctness, and testing parts independently. However, unit tests cannot detect all errors or issues with integration or systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

CYCLE 2 – SESSION 11

WORKSHEETS
Unit tests
Worksheet 2. 11.1

Vocabulary

Performed

isolate

mock

arrange

Bugs

trap

trace

to refactor
Worksheet 2. 11.2

Complete the crossword puzzle.


Worksheet 2. 11.3
Read the text below, in the text you will see that there are spaces for all
subtitles. Read each section and choose the best subtitle from the list below.
This activity will help you identify the key idea of each section.

1. Why unit tests?


2. Advantage of unit tests
3. What are unit tests?
4. Disadvantages of unit tests
5. Myth of unit tests

Unit Test Basics

1. What are unit tests?


__________

UNIT TESTING is a type of software test where individual units or components of a software
are tested. The purpose is to validate that each unit of the software code works as
expected. Unit tests are performed during the development (coding phase) of an
application by developers. Unit tests isolate a section of code and verify its correctness. A unit
can be a function, method, procedure, module, or individual object. It is important to know
that unit tests rely on dummy objects to test sections of code that are not yet part of an entire
application. Dummy objects fill in the missing parts of the program.

2. Why unit tests?


________________________

Unit tests are important for many reasons. First, unit tests help correct bugs early in the
development cycle and save costs. Second, it helps developers understand the test code base
and allows them to make changes quickly. Finally, good unit tests serve as project
documentation. In general, if the right unit tests are done in early development, you end up
saving time and money.
3. Myth of unit tests
_________________________

Some developers say: It takes time, and I'm always busy. My code is rock solid! I don't need
unit tests.

Developers think that integration tests will detect all errors and will not run the unit test. Once
the drives are integrated, very simple errors take a long time to be tracked and corrected.
Therefore, the truth is that unit tests increase the speed of development.

4. Advantage of unit testing


____________________

There are many positives about unit testing. First, developers can examine unit tests to
gain a basic understanding of the unit API. Second, unit tests allow the developer to
refactor the code at a later date and ensure that the module continues to function
correctly. Finally, because of the modular nature of unit testing, we can test parts of the
project without waiting for others to complete.

5. Disadvantages of unit tests


____________________

However, there are also some negative aspects. Unit tests cannot detect all errors in a
program. It is not possible to evaluate all execution paths even in the most trivial
programs. In addition, unit tests, by their very nature, focus on a unit of code. As a result,
you cannot detect integration errors or broad system-level errors.
Worksheet 2. 11.4
Answer the following questions:

1. What can be "one unit"?


• components of a software

2. How can unit tests help developers?


• get a basic understanding of the unit API
• they can test parts of the project without waiting for others to complete

3. Why do some developers never perform unit tests?


• They prefer to perform integration tests thinking that they will detect all faults

4. What are the limitations of unit tests?


• it cannot detect integration errors or broad system-level errors.

Worksheet 2. 11.5

Fill in the followingself-assessment section.

1. I understand what Unit Testing is.

Yes Maybe No

2. I understand what the Main Idea and Support Ideas strategy consists of.

Yes Maybe No

3. The Main Idea and Support Ideas strategy helps me understand the text better.
Yes Maybe No

You might also like