0% found this document useful (0 votes)
94 views

SWT Lab 3 Unit Testing

Unit testing is a software development process where individual units or components of a software application are tested to determine if they are fit for use. The goals of unit testing are to isolate written code to test their correctness, and to catch errors early in the development cycle. This document discusses unit testing in the software development life cycle (SDLC), including that it has been used since early programming, is done by developers and testers, and helps create robust and high-quality code. Common unit testing techniques are also outlined such as white box, black box, and grey box testing. Benefits of unit testing include improved code quality, easier debugging, and lower costs. The document concludes with recommendations for best practices in writing good unit tests.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views

SWT Lab 3 Unit Testing

Unit testing is a software development process where individual units or components of a software application are tested to determine if they are fit for use. The goals of unit testing are to isolate written code to test their correctness, and to catch errors early in the development cycle. This document discusses unit testing in the software development life cycle (SDLC), including that it has been used since early programming, is done by developers and testers, and helps create robust and high-quality code. Common unit testing techniques are also outlined such as white box, black box, and grey box testing. Benefits of unit testing include improved code quality, easier debugging, and lower costs. The document concludes with recommendations for best practices in writing good unit tests.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

LAB3: UNIT

TESTING
Unit Testing In Software
Development Life Cycle (SDLC)
• Unit Testing is not a new concept. It’s been there
since the early days of programming.
• Unit tests to improve code quality by verifying
every unit of the code used to implement functional
requirements.
• Test drove development (TDD) or test-first
development.
• Done by developers and sometimes White box
testers
Unit Testing In SDLC
Unit Testing In SDLC
• Unit Testing is used to design robust software components that
help maintain code and eliminate the issues in code units.
• Finding and fixing defects in the early stage of the software
development cycle.
• It is an related part of the agile software development process.
• If we set this as a standard process, many defects would be
caught in the early development cycle, saving much testing time.
Notes:
• Many developers hate to write unit tests. They either ignore or
write bad unit test cases due to tight scheduled or lack of
seriousness (yea they write empty unit tests, so 100% of them
pass successfully.
• It’s important to write good unit tests or don’t write them at all.
Unit Testing Methods
• It can be performed in 2 ways :
1.Manual Testing
2.Automated Testing
Techniques Within Unit Testing
• White box testing
• the tester knows the internal structure of the software including
the code
• The tester can test it against the design and the requirements
• white box testing is also known as transparent testing.
Techniques Within Unit Testing
• Black box testing
• the tester does not know the internal structures either the
code of the software
Techniques Within Unit Testing
• Grey box testing
• The grey box is considered as a combination of black
box and white box testing techniques (Semi-
transparent technique testing).
• The testers are only partially aware of the internal
structure, functions, and designs along with the
requirements
Benefits Of Unit Testing
1. The process becomes agile
2. Code quality improves
3. Detects bugs early
4. Easier changes and simplified integrations
5. Documentation availability
6. Easy debugging process
7. Lower cost
8. Code completeness can be demonstrated using unit tests
9. Saves development time
10.Code coverage can be measured
How to write good Unit Tests?
• A Unit test should be written to verify a single unit of code
and not the integration.
• Small and isolated Unit tests with clear naming would make
it very easy to write and maintain.
• Changing another part of the software should not affect the
Unit test if those are isolated and written for a specific unit
of code.
• It should run quickly
• A Unit test should be reusable
Lab 3
• Nhóm: sử dụng nhóm đã đăng ký.
• Nội dung: Lựa chọn một công cụ ở slide 12 để nghiên cứu và thực hiện
UT.
• Báo cáo: (sử dụng template UT Test case kèm theo bài post)
• UT Test case
• Báo cáo Test
• Cơ cấu chấm điểm
• Không có bài :0 điểm.
• <500 LOC :1-4 điểm.
• 500- 1000 LOC :5 điểm.
• 1001-1500 LOC :6 điểm.
• 1501-2000 LOC :7 điểm.
• >2000 LOC :8 điểm.
• Độ khó của bài UT :0-2 điểm
Popular Unit Testing Tools

Guide (Vietnamese)
Giới thiệu JUnit - GP Coder (Lập trình Java)

You might also like