Software Testing
Software testing is the process of evaluating a software product to ensure that it meets its specifications and is free of defects. There are many types of software testing, including unit testing, integration testing, and acceptance testing.
Example of unit test using JUnit in Java:
public class MathUtilsTest {
@Test
public void testAdd() {
MathUtils mathUtils = new MathUtils();
int result = mathUtils.add(1, 2);
assertEquals(3, result);
}
@Test
public void testSubtract() {
MathUtils mathUtils = new MathUtils();
int result = mathUtils.subtract(2, 1);
assertEquals(1, result);
}
}
No comments:
Post a Comment