Unit tests are a level of testing in which the smallest parts of individual units/components (called units) are tested to determine their suitability for use.

Unit test cases are written and executed by developers (in general, but also in some cases) to ensure that the units work as expected. The smallest part of each component, test objects such as functions, procedures, classes, interfaces, etc.

In the case of a function, check that the function should return the expected value when passing input parameters to it. The main purpose of this test is to check that the unit is working as designed, handles errors and exceptions more sensibly, and is compatible with both forward and reverse scenarios.

Unit testing is considered a form of white-box testing. This is the lowest level of testing and is started before integration testing.

Unit test Case Guide:

  1. Unit test plans/cases should be provided separately and should not be combined with other steps. Try all possible test scenarios, including unusual and alternative processes. Once a project is under construction, developers tend to test only for success or already in coding.
  2. Software development and unit testing need to be divided into phases and delivery schedules accordingly.
  3. Unit test results need to be treated as a separate deliverable. This will help filter out some of the errors in the business process at an early stage, rather than in integration testing or system testing.
  4. Track project progress by counting test cases planned, executed, passed, and failed.
  5. Try some on-the-fly testing during development.

Unit test case List:

Input data validation:

This section contains a series of checks that can generally be applied to data entered into an application system.

  • Mandatory item tests
  • Unique field value test
  • The null test
  • The field accepts only allowed characters
  • A negative test
  • Fields are limited to field length specifications
  • Impossible value
  • Garbage value test
  • Check dependencies between fields
  • Equivalent class partitioning and boundary condition testing
  • Error and exception handling tests

Date verification:

This constitutes a set of conditions for the date field.

  • Various date formats
  • American-style date format
  • The effective date
  • Invalid date, for example
  • Months 00 and 13
  • Day does not contain 00 and 32 as its values
  • 28, 29, and 30 have been verified correctly
  • Check the impact of weekends and bank holidays
  • The link between 2000 and February 29

Time verification:

This constitutes a set of conditions for the time field

  • Various time formats, such as 12/24 hour format, AM/PM
  • Check validity time
  • Check invalid time
  • Check the impact of weekends and working holidays

Zip code verification:

This forms a set of conditions for the zip code field

  • Test the partial zip code input and check the zip code format
  • Test space/No space
  • Check if there is an option to enter the address manually

System interface:

This constitutes a set of conditions for fields transferred between multiple application systems.

  • Check that all fields/parameters on the interface are correctly executed
  • All data fields need to work according to the validation list
  • Security testing across automated interfaces
  • Checking inheritance relationships

Availability:

This constitutes a set of conditions that help verify the availability of the application system.

  • Check that the layout conforms to design standards
  • Check font, color, size, etc.
  • Test brand criteria
  • Check that the window title for each application has the application name and window name
  • Check the alignment
  • Check that the screen is resizable and minimized
  • Spell check
  • Test defaults if necessary
  • Required fields need to be highlighted with an asterisk symbol

Security:

This constitutes a set of conditions that help verify the security of the application system.

  • Password not visible
  • Access tests – Multiple levels
  • Change password
  • Error messages should not reveal any system information
  • Verify that SSL is deployed correctly
  • Check whether locking rules are applied
  • Check whether the password is saved in plain code or encrypted mode
  • Authenticate the application with valid userids and invalid userids
  • Verify applications with valid and various invalid passwords
  • Check access to the application by entering a valid URL directly. The system should ask for login details.
  • Make sure the browser doesn’t remember the password

Recording, auditing and tracking:

This consists of a set of criteria that help validate the application system’s audit records, system logs, and so on.

  • Checks whether logs are saved within a specified period of time
  • Check whether the logs contain personal data
  • Check that administrator functions are documented
  • Check whether a user lock event is recorded

Business application logic:

This constitutes a set of conditions that help validate the application logic and business processing of the application system.

  • Check that all options for available products have been explored
  • Check all upgrade and downgrade paths and options
  • Verify that upgrades and downgrades have been applied to billing, networking, self-service, etc
  • Stop/disconnect/terminate behavior
  • Equipment failure behavior
  • Check rounding of calculated amounts
  • Ensure the full scope, type/status/condition of the test account used
  • Check that currency symbols are displayed as required
  • Verify that there are no duplicate records.
  • In cases involving arithmetic, use large or very large quantities/numbers to check for overflow in the form of both displayed and actual data

Report:

This section contains a set of checks that help validate the reporting capabilities provided by the system.

  • All fields are available
  • Fields should have enough space
  • Enable scrolling and scrolling
  • Page numbers indicate report size (N out of M) and should allow access to middle/end points in the report
  • The report has been correctly exported to Excel/Word
  • Reports can be printed correctly and all data displayed correctly
  • Check that all pages in the report are accessible

Environment:

This section contains a set of checks that help verify the environmental or equipment requirements of the AUT.

  • Test with all browsers
  • Test by enabling and disabling Java scripts

Email:

This section contains a set of checks that you can use to verify E-mail functionality

  • Verify that an acknowledgement message is provided when an E-mail message is sent
  • Verify that the link provided in the email is working properly
  • Verify that the reply address is correct
  • Verify that fonts, sizes, and text alignment are correct in E-mail messages

Search criteria:

This section contains a series of checks on the application system search capabilities.

  • Verify that the scroll bar is implemented
  • Verify that alignment results are correct
  • Verify that valid results are displayed for any combination of search criteria.
  • Verify that the correct results are retrieved for AND/OR conditions
  • Validation results are displayed alphabetically or in a specified order
  • Verify that column headers are sortable

  • Solemnly declare: the article was first published in the public number “FunTester”, prohibit third parties (except Tencent cloud) reprint, published.

Technical articles selected

  • Java one line of code to print a heart
  • Linux performance monitoring software Netdata Chinese version
  • Performance Testing Framework second edition
  • How to perform performance tests on a Linux command line interface
  • Graphic HTTP brain map
  • Automatically turn the Swagger document into test code
  • Five lines of code to build a static blog
  • Probe into the Linear interface testing framework based on Java
  • Selenium 4.0 Alpha update log
  • Selenium 4.0 Alpha update practices
  • How to unify functional, automated, and performance test cases for interface testing

Selected non-technical articles

  • Why software testing as a career path?
  • Programming thinking for everyone
  • 7 Skills to become an automated test
  • How do YOU introduce automated testing in DevOps
  • Summary of Automatic Test failures on the Web
  • How do YOU introduce automated testing in DevOps
  • Testers often use excuses
  • Browser market share ranking 2019
  • API Testing Basics
  • API Automation Test Guide
  • Future QA test engineer