Types of Testing in Agile
What is the difference between unit testing, integration testing, and user interface testing?
Every test has its own level and place in the Agile team’s Definition of Done (DoD). The DoD is the exit criteria which exists at multiple levels like User Story level, Sprint Level and Release Level.
Unit testing:
- Unit testing is the basic building block of Extreme Programming (XP). Unit tests are written to verify that our functions, methods or classes work as expected. The desired set of inputs is given to a unit of code to check if it returns proper values as per the design.
- Unit testing exist at a User story level DoD and Unit test cases must be written for every User Story.
- Unit tests are written and bundled along with the code repository and checked in into the respective folder.
- The build also compile the validity of unit test cases before getting executed.
- All unit tests should be code reviewed before checked in into the repository
- It is not a good idea to release code with unit tests,
- It is always important to check if the code has 100% coverage of unit tests.
- Tools like SONAR may help developers to understand the unit test code coverage, along with cycomatic code complexity.
- Unit Tests is also useful to handle exceptions in a try, catch block.
- Tools like JUNIT can be used for writing unit test cases.
- Unit tests also minimizes the technical debt remaining in the design and the code
Example of Unit Test Case:
// In Java, We write unit test case first to add two numbers;
public class TestSum {
public void testSumPositiveNumbersOneAndOne() {
Sumer sumer = new SumerImpl();
assert(sumer.add(1, 1) == 2);
}
//Write the corresponding interfaces in method and define a class within in it.
interface Sumer {
int sum(int a, int b);
}
class SumerImpl implements Sumer {
int sum(int a, int b) {
return a + b;
}
}
Integration testing:
- Integration testing is a process when two or more software components or units are integrated, the combined testing that is done to verify the interaction between them to expose defects which deviate from the application desired functionality.
- This testing may exist as a part of Sprint level or Release level of DoD and it depends on the product hierarchy.
- The components are tested as a single group or organized in an iterative manner.
- All functional requirements tested, including both positive and negative tests, with the number of tests based on size, complexity, and risks
- All interfaces between units must be tested so that defects do not slip through
- All quality risks covered according to the agreed extent of testing
- No unresolved major defects (prioritized according to risk and importance)
- All defects found are logged and reported with priority assigned to it.
- All regression tests automated, where possible, with all automated tests stored in a common repository
- There are 4 main integration test approaches are followed as per ISTQB; Big Bang approach, Top Down approach, Bottom Up approach and Sandwich Hybrid approach
User Interface Testing:
- User Interface Testing confirms the correctness of the application’s user interface and it will point out any valid deviations as per the UX coding standards.
- This testing may exist as a part of Sprint level of DoD
- It involves testing the UI and comparing the result with the expected output and its ability to replicate the same accuracy several times, by providing various inputs and checking the output.
- This testing handles various events related to mouse, Key strokes, toolbars, drop downs, menu bars, images, validation controls etc to check if they react as per the specification or not.
- This test can even check for object states and date fields in various numeric formats.
- This testing also checks the data integrity, usability and reliability of the output.
- This testing can be performed both manually and automatically depending on technology being used.
- This testing can be tested manually based on the application knowledge and domain knowledge of the tester.
- This testing can be done automatically by using various tools based on the capture and replay of user actions. Examples of commercial automation tools available in the market are Selenium, Robert Framework, AutoHotKey etc.