I'm trying to print some data with System.out in my unit tests (@Test mehotds), but it is not showing anything. However, it works properly in @Before method. I'm using JUnit with Maven Surefire plugin.
System.out
@Test
@Before
public class MyTests { @Before void init(){ System.out.println("Initializing some data..."); // <- It works. } @Test void shouldRemoveSeries() { System.out.println("TEST: Should remove series"); // <- It doesn't. } }
maven-surefire-plugin configuration:
maven-surefire-plugin
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.15</version> <configuration> <includes> <include>**/*Tests.java</include> </includes> </configuration> </plugin>
Thanks.
Ran into this as well. I'm using gradle to manage my tasks and I put this in at the end of by build.gradle file :
build.gradle
test { testLogging.showStandardStreams = true }
Now I see System.out.println(whateves).
System.out.println(whateves)
1.4m articles
1.4m replys
5 comments
57.0k users