mercredi 25 novembre 2015

Junit testing assert output not being displayed on console [duplicate]

This question already has an answer here:

I am trying to implement Junit test using Spring boot I have written some simple test when I am running the ApplicationTests.groovy as junit test it showing green color bar when the test is successful and red upon errors but it is not displaying any output I am getting empty stack trace upon successful test methods though I am using assert.

import org.junit.Test
import org.junit.runner.RunWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.SpringApplicationConfiguration
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
import org.springframework.test.context.web.WebAppConfiguration
import org.junit.Assert.*;
@RunWith(SpringJUnit4ClassRunner)
@SpringApplicationConfiguration(classes = Application)
@WebAppConfiguration
class ApplicationTests {

    @Test
    void testAssertions() {
        assertTrue(1 == 1)
        assertEquals("test", "test")

        def x = "42"
        assertNotNull "x must not be null", x
        assertNull null

        assertSame x, x
    }
  }

Aucun commentaire:

Enregistrer un commentaire