Junior
What types of software testing do you know?
sobes.tech AI
Answer from AI
- Unit testing: Testing individual components or modules of a program in isolation.
- Integration testing: Testing the interaction between multiple modules.
- System testing: Testing the entire system as a whole, verifying compliance with functional and non-functional requirements.
- Acceptance testing: Verification by end-users or clients to ensure it meets their expectations.
Additionally:
- Functional testing: Verifying the system's compliance with functional requirements.
- Non-functional testing: Checking non-functional aspects such as performance, security, usability.
- Regression testing: Ensuring that code changes do not break existing functionality.
- Load testing: Determining system performance under specific loads.
- Stress testing: Testing the system under extreme load conditions.
- Security testing: Identifying vulnerabilities in the system.
- Usability testing: Assessing the ease and intuitiveness of system use by end-users.
In my work, I often use:
// Example of a unit test with JUnit
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class MyServiceTest {
@Test
void testAdd() {
MyService service = new MyService();
assertEquals(5, service.add(2, 3));
}
}
// Example of an integration test with Spring Boot
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.ResponseEntity;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class MyControllerIntegrationTest {
@Autowired
private TestRestTemplate restTemplate;
@Test
void testHelloEndpoint() {
ResponseEntity<String> response = restTemplate.getForEntity("/hello", String.class);
assertThat(response.getBody()).isEqualTo("Hello, World!");
}
}