Junior — Middle
Can you name popular libraries used for automated code testing?
sobes.tech AI
Answer from AI
Popular libraries for automated testing in Java:
- JUnit — standard framework for unit testing.
- TestNG — extended framework with support for parameterization and parallel execution.
- Mockito — library for creating mock objects and simulating dependency behavior.
- AssertJ — library with a convenient and readable API for assertions.
- Selenium — for automating web interface testing.
Example of a simple test with JUnit 5:
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class CalculatorTest {
@Test
void addition() {
assertEquals(4, 2 + 2);
}
}