-
Notifications
You must be signed in to change notification settings - Fork 4
Spring
π Β Spring and JUnit 4
π Β Spring and JUnit 5
π Β Spring and TestNG
QuickPerfSpringRunner adds QuickPerf features to SpringRunner (also called SpringJUnit4ClassRunner).
To use it, following your Spring version, you have to add one of the dependencies below.
Spring 5
<dependency>
<groupId>org.quickperf</groupId>
<artifactId>quick-perf-junit4-spring5</artifactId>
<version>1.0.0-RC6</version>
<scope>test</scope>
</dependency>
Spring 4
<dependency>
<groupId>org.quickperf</groupId>
<artifactId>quick-perf-junit4-spring4</artifactId>
<version>1.0.0-RC6</version>
<scope>test</scope>
</dependency>
Spring 3
<dependency>
<groupId>org.quickperf</groupId>
<artifactId>quick-perf-junit4-spring3</artifactId>
<version>1.0.0-RC6</version>
<scope>test</scope>
</dependency>
With one of these dependencies, you have access to core, JVM and SQL annotations.
QuickPerf annotations are executed after the loading of the SpringContext. So, for example, if you profile your JVM with @ProfileJvm, the profiling starts just after the loading of the Spring context.
Java code example with QuickPerfSpringRunner
import org.junit.runner.RunWith;
import quickperf.spring.QuickPerfSpringRunner;
@RunWith(QuickPerfSpringRunner.class)
public class AccountTest {
}
To can use SQL annotations, you have to add a QuickPerfProxyBeanPostProcessor bean.
To do this, you can look at the Java code examples below or this Spring Boot project.
After that, you can evaluate the SQL properties of the database repositories, the Spring services or the Spring controller.
Addition of a QuickPerfProxyBeanPostProcessor bean with @Bean
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import quickperf.spring.QuickPerfProxyBeanPostProcessor;
@Configuration
public class Configs {
@Bean
public QuickPerfProxyBeanPostProcessor dataSourceBeanPostProcessor() {
return new QuickPerfProxyBeanPostProcessor();
}
}
Addition of a QuickPerfProxyBeanPostProcessor bean in a Spring XML file
<bean id="QuickPerfProxyBeanPostProcessor" class = "org.quickperf.spring.sql.QuickPerfProxyBeanPostProcessor" />
See the code of this repository.
π Β Core
π Β JVM
π Β SQL
π Β Scopes
π Β Create an annotation
π Β JUnit 4
π Β JUnit 5
π Β TestNG
π Β Spring
π Β Detect and fix N+1 SELECT
π Β Maven performance
π Β Spring Boot - JUnit 4
π Β Spring Boot - JUnit 5
π Β Micronaut Data - JUnit 5
π Β Micronaut - Spring - JUnit 5
π Β Quarkus - JUnit 5
π Β FAQ
π Β QuickPerf code