test-migration

Migrates test suites to target frameworks while maintaining or improving test coverage.

1|1|Updated May 16, 2026
One-click install
npx skills add https://github.com/vanduc2514/hackathon-lablab-ibm-bob --skill test-migration-vanduc2514
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-migration
Source: https://github.com/vanduc2514/hackathon-lablab-ibm-bob/tree/main/.bob/skills/test-migration
Command: npx skills add https://github.com/vanduc2514/hackathon-lablab-ibm-bob --skill test-migration-vanduc2514

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Migrating test suites between frameworks (such as JUnit 4 to JUnit 5 or Spring Boot 2.7 to 3.2) requires tedious manual updates to dependencies, annotations, assertions, and mocking patterns, with the constant risk of losing test coverage or introducing flaky tests. ## Core Features & Use Cases - Test Framework Migration: Updates test dependencies, annotations, and assertion styles to the target framework's conventions. - Mocking Pattern Updates: Migrates mocking approaches such as MockitoJUnitRunner to MockitoExtension. - Coverage Verification: Compares before/after coverage metrics and enforces coverage thresholds with JaCoCo. - Use Case: When upgrading a Spring Boot 2.7 application to Spring Boot 3.2, use this Skill to migrate all 127 unit tests and 45 integration tests to JUnit 5, add Testcontainers-based integration tests, and produce an execution_test_migration.md report documenting the results. ## Quick Start Migrate my existing JUnit 4 test suite to JUnit 5 and generate a test migration report with coverage comparison.

Frequently Asked Questions about test-migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate tests from JUnit 4 to JUnit 5?▼

JUnit 4 to JUnit 5 migration involves replacing @Before with @BeforeEach, @RunWith with @ExtendWith, and Assert.* with Assertions.*. Tests using @Test(expected=...) should be rewritten with assertThrows(), and the junit-jupiter dependency replaces the legacy junit artifact.

How to update Spring Boot tests when upgrading from 2.7 to 3.2?▼

Spring Boot 3.2 tests use JUnit 5 natively, so remove @RunWith(SpringRunner.class) and the junit4 imports. Keep @SpringBootTest with TestRestTemplate, and update imports to org.junit.jupiter.api packages.

Does Mockito work with JUnit 5?▼

Yes, Mockito works with JUnit 5 through the mockito-junit-jupiter dependency. Replace @RunWith(MockitoJUnitRunner.class) with @ExtendWith(MockitoExtension.class) while keeping @Mock and @InjectMocks annotations unchanged.

How do I write integration tests with a real database using Testcontainers?▼

Annotate the test class with @Testcontainers and declare a static PostgreSQLContainer with @Container. Use @DynamicPropertySource to inject the container's JDBC URL, username, and password into Spring's datasource properties.

What should I do when migrated tests fail or become flaky?▼

Fix failing tests rather than disabling them, since skipped tests hide real regressions. Common fixes include resolving timing dependencies, removing hardcoded assumptions, and updating framework-specific behavior to match the target framework.

How do I verify test coverage did not decrease after migration?▼

Run mvn clean test jacoco:report to generate coverage reports and compare line and branch coverage before and after migration. Configure JaCoCo rules with a minimum covered ratio, such as 0.80, to enforce coverage thresholds in the build.