Configuring report attribute in maven surefire and failsafe reports

Viewed 20

Using maven to run tests generates reports in specific folders for surefire and failsafe

mvn verify -Pfailsafe

Here is the report looks like

<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-failsafe-plugin/xsd/failsafe-test-report-3.0.xsd" version="3.0" name="com.example.namerestrictionenforcement.controller.OrganizationIntegrationTest" time="5.036" tests="2" errors="0" skipped="0" failures="0">
  <properties>
    <property name="java.class.path" value=""/>
   
    <property name="file.separator" value="/"/>
    
    <property name="line.separator" value="&#10;"/>
    <property name="java.specification.name" value="Java Platform API Specification"/>
    <property name="java.class.version" value="55.0"/>
  </properties>
  <testcase name="createOrganizationWithSpace" classname="com.example.namerestrictionenforcement.controller.OrganizationIntegrationTest" time="0.732">
    <system-out><![CDATA[09:03:20.522 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
09:03:20.531 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
09:03:20.581 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.example.namerestrictionenforcement.controller.OrganizationIntegrationTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
09:03:20.598 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.example.namerestrictionenforcement.controller.OrganizationIntegrationTest], using SpringBootContextLoader
09:03:20.602 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.namerestrictionenforcement.controller.OrganizationIntegrationTest]: class path resource [com/example/namerestrictionenforcement/controller/OrganizationIntegrationTest-context.xml] does not exist
09:03:20.603 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.namerestrictionenforcement.controller.OrganizationIntegrationTest]: class path resource [com/example/namerestrictionenforcement/controller/OrganizationIntegrationTestContext.groovy] does not exist
09:03:20.603 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.example.namerestrictionenforcement.controller.OrganizationIntegrationTest]: no resource found for suffixes {-context.xml, Context.groovy}.
09:03:20.604 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.example.namerestrictionenforcement.controller.OrganizationIntegrationTest]: OrganizationIntegrationTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
09:03:20.681 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.example.namerestrictionenforcement.controller.OrganizationIntegrationTest]
09:03:20.770 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.example.namerestrictionenforcement.NameRestrictionEnforcementApplication for test class com.example.namerestrictionenforcement.controller.OrganizationIntegrationTest
09:03:20.854 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.example.namerestrictionenforcement.controller.OrganizationIntegrationTest]: using defaults.
09:03:20.855 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.event.ApplicationEventsTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
09:03:20.864 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/TransactionDefinition]
09:03:20.864 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]
09:03:20.864 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@57eda880, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@2b5825fa, org.springframework.test.context.event.ApplicationEventsTestExecutionListener@53d1b9b3, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@2cae1042, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@163d04ff, org.springframework.test.context.support.DirtiesContextTestExecutionListener@7c209437, org.springframework.test.context.event.EventPublishingTestExecutionListener@2262b621, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@7e928e2f, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@f667fe, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@788fcafb, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@4febb875, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@25e2a451, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@1698ee84]
09:03:20.868 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@505a9d7c testClass = OrganizationIntegrationTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@758c83d8 testClass = OrganizationIntegrationTest, locations = '{}', classes = '{class com.example.namerestrictionenforcement.NameRestrictionEnforcementApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=0}', contextCustomizers = set[[ImportsContextCustomizer@129b4fe2 key = [org.springframework.boot.test.autoconfigure.web.servlet.MockMvcAutoConfiguration, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcWebClientAutoConfiguration, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcWebDriverAutoConfiguration, org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration, org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration, org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration, org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration, org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcSecurityConfiguration, org.springframework.boot.test.autoconfigure.web.reactive.WebTestClientAutoConfiguration]], org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@6676f6a0, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@11f0a5a1, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@7d898981, org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@3b8f0a79, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@4b3fa0b3, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@3561c410, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@72057ecf], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> false]], class annotated with @DirtiesContext [false] with mode [null].
09:03:20.892 [main] DEBUG org.springframework.test.context.support.DependencyInjectionTestExecutionListener - Performing dependency injection for test context [[DefaultTestContext@505a9d7c testClass = OrganizationIntegrationTest, testInstance = com.example.namerestrictionenforcement.controller.OrganizationIntegrationTest@4cc6fa2a, testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@758c83d8 testClass = OrganizationIntegrationTest, locations = '{}', classes = '{class com.example.namerestrictionenforcement.NameRestrictionEnforcementApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=0}', contextCustomizers = set[[ImportsContextCustomizer@129b4fe2 key = [org.springframework.boot.test.autoconfigure.web.servlet.MockMvcAutoConfiguration, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcWebClientAutoConfiguration, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcWebDriverAutoConfiguration, org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration, org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration, org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration, org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration, org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcSecurityConfiguration, org.springframework.boot.test.autoconfigure.web.reactive.WebTestClientAutoConfiguration]], org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@6676f6a0, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@11f0a5a1, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@7d898981, org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@3b8f0a79, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@4b3fa0b3, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@3561c410, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@72057ecf], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> false, 'org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]]].

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.3)


2022-09-07 09:03:21.610  INFO 73555 --- [           main] c.e.n.c.OrganizationIntegrationTest      : No active profile set, falling back to 1 default profile: "default"
2022-09-07 09:03:23.483  INFO 73555 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 0 (http)
2022-09-07 09:03:23.492  INFO 73555 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-09-07 09:03:23.493  INFO 73555 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.65]
2022-09-07 09:03:23.604  INFO 73555 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-09-07 09:03:23.605  INFO 73555 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1970 ms
2022-09-07 09:03:24.561  INFO 73555 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring TestDispatcherServlet ''
2022-09-07 09:03:24.561  INFO 73555 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Initializing Servlet ''
2022-09-07 09:03:24.563  INFO 73555 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Completed initialization in 2 ms
2022-09-07 09:03:24.626  INFO 73555 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 49453 (http) with context path ''
2022-09-07 09:03:24.639  INFO 73555 --- [           main] c.e.n.c.OrganizationIntegrationTest      : Started OrganizationIntegrationTest in 3.713 seconds (JVM running for 5.078)
2022-09-07 09:03:25.135  INFO 73555 --- [o-auto-1-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-09-07 09:03:25.136  INFO 73555 --- [o-auto-1-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2022-09-07 09:03:25.138  INFO 73555 --- [o-auto-1-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 2 ms
]]></system-out>
  </testcase>
  <testcase name="createOrganization" classname="com.example.namerestrictionenforcement.controller.OrganizationIntegrationTest" time="0.03"/>
</testsuite>

I have deleted a few fields but I believe you get the point . Now since we log a lot of information during tests the test results are really large. Is there a way to configure the fields of the report ?

For ex I would like to get rid of in test case and classpath in testsuite as they contribute to the eventual file size.

0 Answers
Related