Przejdź do treści
Biblioteka skilli
Programowanie · Testowanie

java-spring-boot-testing

/java-spring-boot-testing

Prowadzi przez testowanie w Spring Boot: testy jednostkowe z Mockito, testy kontrolerów (MockMVC, @WebMvcTest, WebTestClient), repozytoria JPA, Testcontainers, Spring Cloud Contract i testy obciążeniowe.

Licencja
MIT
Ostatnia zmiana repozytorium
31.08.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
8
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 31.08.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Prowadzi przez testowanie w Spring Boot: testy jednostkowe z Mockito, testy kontrolerów (MockMVC, @WebMvcTest, WebTestClient), repozytoria JPA, Testcontainers, Spring Cloud Contract i testy obciążeniowe.

Oryginalny opis (EN)

Complete guide to testing in Spring Boot — unit tests with Mockito, controller tests (MockMVC standalone, @WebMvcTest, MockMvcTester, @SpringBootTest, WebTestClient), JPA repository tests, Testcontainers, Spring Cloud Contract, and stress testing. Use when writing or reviewing any Spring Boot test.

Jak działa

  1. When to Use This Skill
  2. Reference Guide
  3. Testing Best Practices
Sekcje z nagłówków SKILL.md, w oryginale · 40 linii, 281 słów
Podgląd SKILL.md
---
name: java-spring-boot-testing
description: 'Complete guide to testing in Spring Boot — unit tests with Mockito, controller tests (MockMVC standalone, @WebMvcTest, MockMvcTester, @SpringBootTest, WebTestClient), JPA repository tests, Testcontainers, Spring Cloud Contract, and stress testing. Use when writing or reviewing any Spring Boot test.'
metadata:
  scope: testing
  version: "1.0.0"
---

# Spring Boot Testing

Guide to testing strategies and examples for Spring Boot applications.

## When to Use This Skill

- Write unit tests for services and components (JUnit 5 + Mockito)
- Write controller tests: unit (standalone MockMVC) or integration (@WebMvcTest, @SpringBootTest)
- Test JPA repositories with `@DataJpaTest`
- Use Testcontainers for real database integration tests
- Implement Consumer Driven Contracts with Spring Cloud Contract
- Diagnose or simulate thread pool starvation
- Benchmark performance with JMH

## Reference Guide

| Topic | Reference | Load When |
|-------|-----------|-----------|
| Controller Tests | `references/controller-tests.md` | MockMVC standalone, @WebMvcTest, MockMvcTester, @SpringBootTest + MockMvc/TestRestTemplate, WebFluxTest + WebTestClient |
| Unit Testing | `references/unit-testing.md` | Service/component tests with Mockito, parameterized tests, test data builders |
| JPA Tests | `references/data-jpa-test.md` | @DataJpaTest, TestEntityManager, H2, real database, rollback, ordered tests |
| Testcontainers | `references/testcontainers.md` | PostgreSQL container, DynamicPropertySource, AbstractIntegrationTest |
| Test Configuration | `references/test-configuration.md` | application-test.yml, @TestConfiguration, TestDataFactory |
| Contract Testing | `references/contract-testing.md` | Spring Cloud Contract, Consumer Driven Contracts, WireMock stubs |
| Stress Testing | `references/stress-testing.md` | Thread pool starvation with JMeter, JMH micro-benchmarks |

## Testing Best Practices

- Follow the **AAA pattern** (Arrange, Act, Assert)
- Use `@DisplayName` for descriptive test names
- Mock external dependencies in unit tests; use Testcontainers for real DB
- Achieve **85%+ code coverage**
- Test both happy path and edge/error cases
- Use `@Transactional` for automatic test data cleanup
- Keep unit tests and integration tests in separate source sets or naming conventions
- Use parameterized tests to cover multiple input scenarios
- Test security rules (`@WithMockUser`) and input validation
- Keep tests fast and independent — avoid shared mutable state
Pliki w paczce (8)
  • SKILL.md 2 KB
  • references/contract-testing.md 1 KB
  • references/controller-tests.md 14 KB
  • references/data-jpa-test.md 4 KB
  • references/stress-testing.md 1 KB
  • references/test-configuration.md 2 KB
  • references/testcontainers.md 2 KB
  • references/unit-testing.md 3 KB

Wersje

W bazie nie ma innych skilli o nazwie java-spring-boot-testing.

Migawka bazy z 28.10.2026 · wersja paczki eac4553d7940 (skrót SHA-256 całej paczki)

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100spring-boot-test
    Wprowadza w testowanie Spring Boot: @SpringBootTest, testy slice, MockMvc, mockowanie @MockBean, konfigurację testów i narzędzia pomocnicze.
  • 100testing-patterns
    Pomaga pisać testy dla aplikacji Spring Boot z JUnit 5, Mockito, MockMvc i Testcontainers, w tym przypadki negatywne.
  • 100spring-boot
    Wspiera tworzenie w Spring Boot 4 REST API, warstwy JPA, bezpieczeństwa, testów i usług chmurowych.
  • 100spring-boot-test-patterns
    Podaje wzorce testowania aplikacji Spring Boot: testy jednostkowe, integracyjne, slice i kontenerowe z JUnit 5, Mockito i Testcontainers oraz optymalizacja wydajności testów.
  • 100springboot-tdd
    Prowadzi testy sterowane zachowaniem w Spring Boot z JUnit 5, Mockito, MockMvc, Testcontainers i JaCoCo.
  • 100junit
    Pomaga pisać testy w JUnit 5 z Mockito: testy jednostkowe, mockowanie i integrację z testami Spring Boot.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.