Comprehensive testing patterns for Spring Boot applications covering unit, slice, integration, and container-based tests.
Works with
Covers four test types with performance targets: unit tests (< 50ms), slice tests (< 100ms), integration tests (< 500ms), and full context tests with Testcontainers
Includes patterns for Mockito-based unit testing, JPA/MVC slice testing with focused Spring contexts, and REST API testing with MockMvc and WebTestClient
Demonstrates Spring Boot 3.5+ @S
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionspring-boot-test-patternsExecute the skills CLI command in your project's root directory to begin installation:
Fetches spring-boot-test-patterns from giuseppe-trisciuoglio/developer-kit and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate spring-boot-test-patterns. Access via /spring-boot-test-patterns in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
194
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
194
stars
Comprehensive guidance for writing robust test suites for Spring Boot applications using JUnit 5, Mockito, Testcontainers, and performance-optimized slice testing patterns.
@WebMvcTest or MockMvc@ServiceConnection for container management in Spring Boot 3.5+| Test Type | Annotation | Target Time | Use Case |
|---|---|---|---|
| Unit Tests | @ExtendWith(MockitoExtension.class) |
< 50ms | Business logic without Spring context |
| Repository Tests | @DataJpaTest |
< 100ms | Database operations with minimal context |
| Controller Tests | @WebMvcTest / @WebFluxTest |
< 100ms | REST API layer testing |
| Integration Tests | @SpringBootTest |
< 500ms | Full application context with containers |
| Testcontainers | @ServiceConnection / @Testcontainers |
Varies | Real database/message broker containers |
Spring Boot Test:
@SpringBootTest — Full application context (use sparingly)@DataJpaTest — JPA components only (repositories, entities)@WebMvcTest — MVC layer only (controllers, @ControllerAdvice)@WebFluxTest — WebFlux layer only (reactive controllers)@JsonTest — JSON serialization components onlyTestcontainers:
@ServiceConnection — Wire Testcontainer to Spring Boot (3.5+)@DynamicPropertySource — Register dynamic properties at runtime@Testcontainers — Enable Testcontainers lifecycle managementTest business logic with mocked dependencies:
@ExtendWith(MockitoExtension.class)
class UserServiceTest {
@Mock
private UserRepository userRepository;
@InjectMocks
private UserService userService;
@Test
void shouldFindUserByIdWhenExists() {
when(userRepository.findById(1L)).thenReturn(Optional.of(user));
Optional<User> result = userService.findById(1L);
assertThat(result).isPresent();
verify(userRepository).findById(1L);
}
}
See unit-testing.md for advanced patterns.
Use focused test slices for specific layers:
@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@TestContainerConfig
class UserRepositoryIntegrationTest {
@Autowired
private UserRepository userRepository;
@Test
void shouldSaveAndRetrieveUser() {
User saved = userRepository.save(user);
assertThat(userRepository.findByEmail("[email protected]")).isPresent();
}
}
See slice-testing.md for all slice patterns.
Test controllers with MockMvc:
@WebMvcTest(UserController.class)
class UserControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
private UserService userService;
@Test
void shouldGetUserById() throws Exception {
mockMvc.perform(get("/api/users/1"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.email").value("[email protected]"));
}
}
@ServiceConnectionConfigure containers with Spring Boot 3.5+:
@TestConfiguration
public class TestContainerConfig {
@Bean
@ServiceConnection
public PostgreSQLContainer<?> postgresContainer() {
return new PostgreSQLContainer<>("postgres:16-alpine");
}
}
Apply with @Import(TestContainerConfig.class) on test classes.
See testcontainers-setup.md for detailed configuration.
Include required testing dependencies:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>1.19.0</version>
<scope>test</scope>
</dependency>
See test-dependencies.md for complete dependency list.
Set up GitHub Actions for automated testing:
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
docker:
image: docker:20-dind
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
- name: Run tests
run: ./mvnw test
See ci-cd-configuration.md for full CI/CD patterns.
After implementing tests, verify:
docker ps (look for testcontainer images)@ServiceConnection@SpringBootTest
@Import(TestContainerConfig.class)
class OrderServiceIntegrationTest {
@Autowired
private OrderService orderService;
@Autowired
private UserRepository userRepository;
@Test
void shouldCreateOrderForExistingUserPrerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
giuseppe-trisciuoglio/developer-kit
giuseppe-trisciuoglio/developer-kit
github/awesome-copilot
giuseppe-trisciuoglio/developer-kit
giuseppe-trisciuoglio/developer-kit
giuseppe-trisciuoglio/developer-kit
spring-boot-test-patterns is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
spring-boot-test-patterns reduced setup friction for our internal harness; good balance of opinion and flexibility.
spring-boot-test-patterns fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
I recommend spring-boot-test-patterns for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
Registry listing for spring-boot-test-patterns matched our evaluation — installs cleanly and behaves as described in the markdown.
I recommend spring-boot-test-patterns for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
spring-boot-test-patterns is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
spring-boot-test-patterns fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
Useful defaults in spring-boot-test-patterns — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
Registry listing for spring-boot-test-patterns matched our evaluation — installs cleanly and behaves as described in the markdown.
showing 1-10 of 53