By the end of this chapter, you will be able to:
These skills will help you ensure desktop applications work reliably and meet user needs, making you a valuable part of any software development team.
Compiled by: Stephen Mbugua
Testing desktop applications is a crucial phase in software development that ensures the product meets user expectations and performs reliably in real-world environments. In Kenya, where software solutions often support critical sectors such as healthcare, banking, and education, thorough testing safeguards against costly failures and enhances user satisfaction. This chapter explores how software developers can identify appropriate testing types and prepare effective test plans tailored to project requirements and organizational standards.
A desktop application can fail in many different ways: a calculation can be wrong, a screen can confuse its users, a private record can be exposed, or the program can run too slowly on an older computer. No single test finds all of these faults, so testing is divided into types, and each type targets one quality of the application, such as correct functions, security or ease of use. Identifying the testing types correctly, and then choosing the ones that match the users' needs and the project's risks, is the foundation of delivering a dependable product. The code examples in this topic use C# with the NUnit testing framework.
Testing types can be told apart in two ways. Some differ in scope, from one small piece of code up to the whole application, and others differ in the quality they check, such as security or speed. Functional tests ask whether the application does what it is supposed to do, while non-functional tests ask how well it does it.
| Testing type | What is tested | Who usually carries it out |
|---|---|---|
| Unit test | One method or class on its own | The developer who wrote it |
| Integration test | Two or more parts working together | Developers or testers |
| Usability test | How easily real users complete tasks | Testers observing representative users |
| System testing | The whole application against its requirements | A test team |
| Security test | Protection of data and access | Testers with security skills |
| Performance test | Speed, capacity and resource use | Testers using timing and monitoring tools |
| Compatibility test | Behaviour on different computers and settings | Testers |
Acceptance testing is carried out by the end users or the client to confirm that the system meets their needs before it is handed over. Example: before accepting a booking program, a small hotel's reception staff run through their own real situations, such as a walk-in guest, a booking change and a late check-out, and sign off only when every situation works. It differs from system testing because the people judging the result are the ones who will use the application every day.
A unit test checks the smallest testable part of the application, normally a single method, on its own, apart from the form, the database and the other classes. Because each unit is checked separately, a failing test points straight to the code that is wrong. Developers write unit tests as they write the code, and a testing framework such as NUnit, xUnit or MSTest runs all of them in seconds.
Good unit tests have these qualities:
Example: a kiosk till program has a method that works out the change due. The method refuses a payment that is smaller than the amount due.
using System;
public class TillCalculator
{
public decimal ChangeDue(decimal amountDue, decimal amountPaid)
{
if (amountPaid < amountDue)
{
throw new ArgumentException("Amount paid is less than the amount due.");
}
return amountPaid - amountDue;
}
}
The three tests below cover a typical case, a boundary case and an invalid case:
using System;
using NUnit.Framework;
[TestFixture]
public class TillCalculatorTests
{
[Test]
public void ChangeDue_PaidMoreThanDue_ReturnsDifference()
{
var till = new TillCalculator();
decimal change = till.ChangeDue(1000m, 1500m);
Assert.That(change, Is.EqualTo(500m));
}
[Test]
public void ChangeDue_PaidExactAmount_ReturnsZero()
{
var till = new TillCalculator();
Assert.That(till.ChangeDue(750m, 750m), Is.EqualTo(0m));
}
[Test]
public void ChangeDue_PaidLessThanDue_ThrowsException()
{
var till = new TillCalculator();
Assert.Throws<ArgumentException>(() => till.ChangeDue(1000m, 800m));
}
}
The first test expects 1500 − 1000 = 500, the second expects 750 − 750 = 0, and the third expects the exception, because 800 is less than 1000.
An integration test checks that separate parts of the application work correctly together. Parts that each pass their unit tests can still fail when joined, for example because one part sends a date in a different format from the one the other expects. Integration tests therefore concentrate on the connection points, such as the form passing data to the business logic, the business logic saving to the database, and the application calling an outside service.
Faults that integration tests typically find:
The parts can be combined in different ways. Big-bang integration joins everything at once, which is quick but makes a failure hard to trace. Top-down integration starts with the main screens and replaces missing lower parts with stubs, which are simple stand-ins. Bottom-up integration starts with the lowest parts, such as data access, and uses drivers, which are small programs that call them, until the screens are added. Joining parts step by step finds the faulty connection faster.
Example: a parcel desk program is tested by registering a parcel through the service class and reading it back from a separate test database, never the live one.
using NUnit.Framework;
[TestFixture]
public class ParcelIntegrationTests
{
private readonly string testDatabasePath = "parcels_test.db";
[Test]
public void RegisteredParcel_CanBeReadBack()
{
var repository = new ParcelRepository(testDatabasePath);
var service = new ParcelService(repository);
service.Register("PK-0001", "Depot 2");
Parcel found = repository.Find("PK-0001");
Assert.That(found, Is.Not.Null);
Assert.That(found.Destination, Is.EqualTo("Depot 2"));
}
}
ParcelRepository, ParcelService and Parcel are the program's own classes, and the test passes only when both classes agree on how a parcel is saved and read.
A usability test checks how easily real users can learn and use the application to do their work. A program can be correct in every calculation and still be slow to use or confusing, so this test puts representative users in front of the application and watches them. The test measures the experience of the user and not the correctness of the code.
A usability test is carried out in these steps:
Things the test looks at include clear labels on controls, a sensible tab order, error messages that tell the user what to do, consistent layout from screen to screen, and whether the work can be done from the keyboard as well as the mouse. Feedback on early sketches and prototypes is covered under User testing and feedback incorporation, while this test is run on the working application.
System testing checks the complete, integrated application against the requirements it was built to meet. It is run in a test environment that matches the real one as closely as possible, and it follows whole business processes from start to finish. It starts only when the unit and integration tests have passed and the build is stable.
Example: for a hotel front-desk program the system test follows one guest from start to finish: create a booking, check the guest in, add a meal charge, check the guest out, print the invoice and see the stay in the daily report. Each test case is linked to a numbered requirement, so the team can show that every requirement has been tested.
System testing covers:
Defects found are logged with the steps that cause them, fixed by the developers and then tested again.
A security test checks that the application protects its data and allows only authorised people to use it. Applications that keep personal or money records must be able to resist careless use and deliberate attack, and the Data Protection Act, 2019 expects personal data to be protected. A security test tries to break the protections before an attacker does.
Areas covered by a security test:
Example: a payroll program for a workshop is tested by typing ' OR '1'='1 into the username box. A well-built program treats it as an ordinary, unknown name and refuses the login. This is because the query uses parameters and does not join the typed text into the query string:
using var command = connection.CreateCommand();
command.CommandText = "SELECT Id, PasswordHash FROM Users WHERE Username = $username";
command.Parameters.AddWithValue("$username", txtUsername.Text);
// never build the query by joining text: "... WHERE Username = '" + txtUsername.Text + "'"
Here connection is an open SQLite connection and txtUsername is the username text box on the login form. The program then compares the hash of the entered password with the stored PasswordHash.
A performance test measures how fast the application responds and how much of the computer's resources it uses under different workloads. An application that is correct but takes a minute to open a list will not be used. The speed that counts is agreed with the client in the requirements, for example that a stock list opens within a stated number of seconds on the shop's computer.
What a performance test measures:
Performance tests are run in several forms. A load test uses the normal expected amount of data or users, a stress test pushes the application beyond that to see where and how it fails, and an endurance test keeps the application running for a long time to find memory that is slowly used up and never released.
Example: a hardware shop's stock program is tested with a stock table filled with a large number of test records. The time to load the list is measured by code:
var timer = System.Diagnostics.Stopwatch.StartNew();
LoadStockList();
timer.Stop();
System.Diagnostics.Debug.WriteLine($"Stock list loaded in {timer.ElapsedMilliseconds} ms");
The result is compared with the target in the requirements. The test is repeated on the slowest computer the client uses, because a result from a fast developer machine does not show what the user will experience.
A compatibility test checks that the application works correctly in the different environments in which users may run it. The developer's own computer is only one of these, and a program that works there can fail on another computer with a different setup. The environments are listed in the requirements and each one is tested.
What a compatibility test checks:
Example: a tailoring workshop still uses two older computers, so the order program is installed on those two computers and on the newest office computer, and the same set of order, print and report tasks is repeated on each.
No project has time to run every possible test at full depth, so the developer chooses testing types that match what the users need and what could go wrong. The user requirements show which qualities matter most, and the risks of the project show how deep each test must go. Detailed planning of the chosen tests is done later under Preparing Test Plan.
Example for a courier desk parcel-tracking program:
| Requirement | Risk | Testing types chosen |
|---|---|---|
| Parcel charges are calculated correctly | High, because a wrong charge loses money | Unit tests, then system testing |
| Staff log in with their own accounts | High, because records could be exposed | Security test |
| A counter clerk can register a parcel in a few steps | Medium | Usability test |
| The list of parcels opens quickly at busy times | Medium | Performance test |
| The program runs on the office's older computers | Medium | Compatibility test |
Create a free account to open more of this chapter.
Free: practical guides, quick cards, workplace scenarios and more.
Create a free accountThis chapter explores the comprehensive process of testing desktop applications, beginning with the identification of various testing types such as unit, integration, usability, system, security, performance, and compatibility tests. It emphasizes the importance of selecting appropriate testing types based on specific user requirements to ensure the application meets its intended purpose. The preparation of a detailed test plan is covered next, highlighting key components including objectives, scope, and resources, alongside best practices for aligning the plan with organizational work procedures. The chapter then discusses methods for executing tests, comparing manual and automated approaches, and the necessity of tracking progress and issues throughout the testing phase. Finally, it addresses the preparation of a test report, outlining essential elements such as findings and recommendations, and stresses best practices for accurate and professional documentation of results in accordance with work procedures. Together, these topics provide a structured framework for effective desktop application testing.
Type: Individual
| Tools & Equipment | Materials |
|---|---|
| Computer installed with Visual Studio 2019 | Sample Desktop Application Source Code |
| Rewritable Compact Disc (CD-RW) |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Computer installed with Visual Studio 2019 | 1 Pc per Candidate |
| 2 | Sample Desktop Application Source Code | 1 Copy per Candidate |
| 3 | Rewritable Compact Disc (CD-RW) | 1 Pc per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Identification of Testing Types | |||
| Opened Visual Studio and loaded the sample desktop application project (Award 2 marks for correctly loading the project) | 2 | ||
| Listed and named at least five different testing types (e.g., Unit Testing, Integration Testing, System Testing, Acceptance Testing, Regression Testing) (Award 1 mark for each correctly identified testing type, max 5 marks) | 5 | ||
| Sub-Total | 7 | ||
| TASK 2: Classification and Explanation of Testing Activities | |||
| Explained the purpose and scope of each identified testing type (Award 1 mark for each correct explanation linked to a testing type) | 5 | ||
| Demonstrated practical examples for at least three testing types within Visual Studio (e.g., created unit tests, ran integration tests, performed system testing on the application) (Award up to 3 marks per practical example, max 8 marks) | 8 | ||
| Saved screenshots of test results and compiled them into a folder on the computer (Award 3 marks for correctly saving and organizing screenshots) | 3 | ||
| Sub-Total | 16 | ||
| TASK 3: Summary and Documentation | |||
| Prepared a brief document summarizing testing types and their activities with practical examples (Award 4 marks for completeness and clarity) | 4 | ||
| Burned the document and screenshots to the provided CD-RW (Award 3 marks for successful burning without errors) | 3 | ||
| Sub-Total | 7 | ||
| PRODUCT CHECKLIST | |||
| Complete list and classification of testing types with accurate explanations (Award 5 marks for accuracy and completeness) | 5 | ||
| Practical demonstration of testing activities with valid test cases and results (Award 7 marks for correct and working practical examples) | 7 | ||
| Organized documentation and backup on CD-RW (Award 5 marks for well-organized documentation and successful backup) | 5 | ||
| Sub-Total | 17 | ||
| GRAND TOTAL | 47 | ||
Type: Individual
| Tools & Equipment | Materials |
|---|---|
| Computer installed with Visual Studio 2019 or later | Project files containing the Student Registration Module source code |
| Rewritable Compact Disc (CD-RW) |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Computer installed with Visual Studio 2019 or later | 1 Pc per Candidate |
| 2 | Project files containing the Student Registration Module source code | 1 Set per Candidate |
| 3 | Rewritable Compact Disc (CD-RW) | 1 Pc per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Setup Unit Testing Environment | |||
| Opened Visual Studio and loaded the Student Registration Module project (Award 2 marks) | 2 | ||
| Created a new Unit Test project linked to the Student Registration Module (Award 3 marks) | 3 | ||
| Added necessary references for unit testing framework (e.g. MSTest, NUnit) (Award 2 marks) | 2 | ||
| Sub-Total | 7 | ||
| TASK 2: Write Unit Tests for Input Validation | |||
| Wrote test cases to verify that Name field is not empty (Award 3 marks) | 3 | ||
| Wrote test cases to validate Email field format using regular expressions (Award 4 marks) | 4 | ||
| Wrote test cases to ensure Phone Number field contains exactly 10 digits (Award 3 marks) | 3 | ||
| Included test cases to verify that appropriate error messages are triggered on invalid inputs (Award 3 marks) | 3 | ||
| Sub-Total | 13 | ||
| TASK 3: Execute and Document Unit Test Results | |||
| Executed all written unit tests and recorded results (Award 3 marks) | 3 | ||
| Captured at least 3 screenshots showing successful and failed test cases (Award 4 marks) | 4 | ||
| Saved screenshots and test report in a folder on the computer for printing (Award 3 marks) | 3 | ||
| Sub-Total | 10 | ||
| PRODUCT CHECKLIST | |||
| Unit test project correctly created and linked to the Student Registration Module (Award 5 marks) | 5 | ||
| Comprehensive unit test cases covering all validation rules for Name, Email, and Phone Number fields (Award 7 marks) | 7 | ||
| Accurate documentation of test execution results with screenshots (Award 5 marks) | 5 | ||
| Sub-Total | 17 | ||
| GRAND TOTAL | 47 | ||
At the start of this chapter we promised you would be able to:
Tick each one you can genuinely do.
So, are you there yet?
You're competent when you can confidently do 50% or more of what this chapter promised.
Sign in to record how you're doing.