Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
demo:
- spring-boot-3.4-maven
- spring-boot-3.5-maven
- spring-boot-4.0-maven
# - spring-boot-3.5-maven-failsafe-parallel
# - spring-boot-3.5-maven-junit-parallel

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ $RECYCLE.BIN/
PROMPTS.md
VIDEO.md
SCRIPT.md

MARKETING.md

### JS ###
coverage/
Expand Down
5 changes: 5 additions & 0 deletions demo/spring-boot-3.5-maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.show-sql=false
# H2 Console (for development)
spring.h2.console.enabled=true

management.server.port=9090
19 changes: 19 additions & 0 deletions demo/spring-boot-4.0-maven/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.10/apache-maven-3.9.10-bin.zip
68 changes: 68 additions & 0 deletions demo/spring-boot-4.0-maven/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Spring Test Insight Demo

This demo project showcases the Spring Test Insight Extension in action.

## Overview

This is a simple Spring Boot application with:

- REST API for user management
- JPA/Hibernate with H2 in-memory database
- Comprehensive test suite demonstrating Spring Test context caching

## Running the Tests

First, install the Spring Test Insight Extension to your local Maven repository:

```bash
cd ../spring-test-profiler-extension
./mvnw clean install
```

Then run the demo tests:

```bash
cd ../demo
mvn clean test
```

## Viewing the Test Report

After running the tests, the Spring Test Insight report will be generated at:

- `target/spring-test-profiler/latest.html`

Open this file in a web browser to see:

- Test execution summary
- Spring context caching statistics
- Cache hit/miss rates
- Individual test results with execution times
- Failed test details with stack traces

## Test Structure

The demo includes various types of tests:

- `UserRepositoryTest` - @DataJpaTest for repository layer
- `UserServiceTest` - Unit tests with mocks
- `UserControllerTest` - @WebMvcTest for REST controllers
- `UserIntegrationTest` - Full @SpringBootTest integration tests

Each test class uses different Spring configurations, demonstrating how the extension tracks context caching across
different test types.

## Key Features Demonstrated

1. **Context Caching Visualization**: See which test classes share Spring contexts
2. **Performance Metrics**: Track context load times and test execution durations
3. **Cache Efficiency**: Monitor cache hit rates to optimize test suite performance
4. **Test Results**: Comprehensive view of passed, failed, and skipped tests

## Tips for Optimization

Based on the report, you can:

- Identify tests that create new contexts unnecessarily
- Group tests with similar configurations to improve cache reuse
- Find slow context initialization that impacts test performance
259 changes: 259 additions & 0 deletions demo/spring-boot-4.0-maven/mvnw

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading