-
Notifications
You must be signed in to change notification settings - Fork 4
Core annotations
@MeasureExecutionTime
@ExpectMaxExecutionTime
@DisplayAppliedAnnotations
@DisableGlobalAnnotations
@DisableQuickPerf
@FunctionalIteration
@DebugQuickPerf
Configure core annotations with a global scope
Measure execution time of test method.
[QUICK PERF] Execution time of test method: 5 s 289 ms (5 289 245 600 ns)
The test will fail if the execution time is greater than expected.
It can be useful to configure this annotation with a global scope.
Name | Type | Meaning | Default value |
---|---|---|---|
hours | int | Number of hours | 0 |
minutes | int | Number of minutes | 0 |
seconds | int | Number of seconds | 0 |
milliSeconds | int | Number of milli seconds | 0 |
You can use several elements together, as shown in the following example.
@ExpectMaxExecutionTime(seconds = 2)
[PERF] Execution time of test method expected to be less than <2 s> but is <5 s 286 ms (5 285 734 000 ns)>
Display applied QuickPerf annotations in console.
An annotation can have three scopes (gobal, test class, test method). This annotation is useful to see which annotations are applied on a test method.
[QUICK PERF] Applied annotations: @JdbcBatches(batchSize=30), @DisableSameSelectTypesWithDifferentParamValues
Class specifying global annotations: org.quickperf.QuickPerfConfiguration
Disable global annotations on test method or test class.
Name | Type | Meaning | Default value |
---|---|---|---|
comment | String | Comment why global annotations are disabled | - |
Disable QuickPerf features.
Name | Type | Meaning | Default value |
---|---|---|---|
comment | String | Comment why QuickPerf is disabled | - |
Disable QuickPerf features.
This annotation is addressed to developers working on QuickPerf annotations.
It displays information in console for debugging purpose.
Annotations having a global scope apply on each test.
org.quickperf.annotation.CoreAnnotationBuilder
helps to configure core annotations with a global scope.
package org.quickperf;
import org.quickperf.annotation.CoreAnnotationBuilder;
import org.quickperf.config.SpecifiableGlobalAnnotations;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.Collection;
public class QuickPerfConfiguration implements SpecifiableGlobalAnnotations {
public Collection<Annotation> specifyAnnotationsAppliedOnEachTest() {
return Arrays.asList(
CoreAnnotationBuilder.expectMaxExecutionTimeOfSeconds(1)
);
}
}
SpecifiableGlobalAnnotations
has to be in org.quickperf package.
π Β 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