Junior — Middle
How was testing carried out in your last project?
sobes.tech AI
Answer from AI
In my latest Java project, testing was carried out at several levels:
-
Unit testing — using JUnit to write tests for individual classes and methods to verify business logic correctness.
-
Integration testing — using Spring Test to check component interactions and database operations in a test environment.
-
Functional testing — automating UI tests with Selenium to verify user scenarios.
-
Continuous integration — tests were run automatically on each commit via Jenkins, allowing for quick error detection.
Example of a simple JUnit test:
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class CalculatorTest {
@Test
void testAdd() {
Calculator calc = new Calculator();
assertEquals(5, calc.add(2, 3));
}
}