Reputation: 217
I am trying to display colors when I execute test but it does not work for spring 2
i tried
spring.output.ansi.enabled=always
still same result.
i tried this website:
Enable Color in Spring Boot Test Console Log
but get only "black and white", the colors never shows up
I have maven 3.5.2 and spring/boot 2
unitest result:
springboot tests result:
Upvotes: 3
Views: 1809
Reputation: 203
Yes, you do need to use spring.output.ansi.enabled=ALWAYS
(in my testing the value is case-insensitive, supporting ALWAYS
or always
).
The key for colored output for Spring Boot tests is to place this value in your test resource folder: src/test/resources/application.properties
.
If you only place that property in the src/main/...
folder, it won't apply to your tests.
Upvotes: 0
Reputation: 49887
What is your pom.xml configuration. Depending on which group/artifact you are using to run the mvn verify
.
I am using the org.codehaus.mojo
and I was never able to make it work, I switched to org.springframework.boot/spring-boot-maven-plugin and it worked for me.
Try this configuration and try again:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
EDIT: In addition, make sure you have:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
Upvotes: 2
Reputation: 15878
As it might be because of case sensitivity so change always to uppercase like below.
spring.output.ansi.enabled=ALWAYS
Upvotes: 0