22

We use slf4j with logback, when running from the command line this still works as expected but within intellij it's different.

Running junit tests using gradle in intellij, log output is in the following xml format:

<ijLog><event type='afterSuite'><ijLogEol/>
  <test id='root' parentId=''><ijLogEol/>
    <descriptor name='Test Run' className='' /><ijLogEol/>
    <result resultType='SUCCESS' startTime='1427264227574' endTime='1427264315052'><ijLogEol/>
      <failureType>error</failureType><ijLogEol/>
    </result><ijLogEol/>
  </test><ijLogEol/>
</event></ijLog>

I don't want the IDE to change anything, just use the logging that we've provided. This use to work fine, but since 14.1 i'm having this issue.

Snekse
  • 15,474
  • 10
  • 62
  • 77
martin treurnicht
  • 1,223
  • 1
  • 10
  • 17
  • 1
    Are you using gradle? Does this happen for all of your tests or just integration tests? – Snekse Mar 26 '15 at 20:53
  • Hi @Snekse, I'm having the same problem and I'm using Gradle with IDEA. I have a separated task for integration tests. The `test` task is working well but for a run configuration that invoke a custom gradle task, `integration` in this case, the output are being printed in XML. Do you know why this and how to solve? – avaz Apr 08 '15 at 11:53
  • I have the same issue. Happens when running integration tests. Specifically, for integration tests, I change the value of the "Tasks" field in Run/Debug Configurations to: `cleanIntegTest integTest` (instead of intellij's default: `cleanTest test`). That's because for running integration tests I have a custom gradle task `integTest` of type `test`. – Doron Gold May 10 '15 at 15:15
  • Any solutions so far? Exact same problem here with Integration Tests... – Strinder Dec 01 '15 at 16:44
  • Assumption: Have you switched from Ultimate test version to Community edition? That is my case at least... – Strinder Dec 01 '15 at 16:55
  • I have the same problem. #Gradle 2.9, #Idea 14, the itest task gives me garbaged output like the one above – ieugen Dec 18 '15 at 13:32

4 Answers4

21

A gradle refresh fixed this issue for me.

Broonix
  • 1,135
  • 2
  • 11
  • 26
5

This issue appeared to me in IntelliJ IDEA 2016.2.3 with Gradle 3.0

I was able to resolve this by gradle refresh + clean, output again started coming in normal format for integration tests.

Munish Chandel
  • 3,572
  • 3
  • 24
  • 35
2

Bug in Intellij. See here: https://youtrack.jetbrains.com/issue/IDEA-151866 The gradle plugin will generate Intellij specific xml output whenever a test is run (task instance of Test), but Intellij will only interpret the test output as xml when one of the tasks is "test" (hardcoded value). One way to work around the problem: add a tasks test, even if that won't do anything. eg. cleanTest integTest test to run integTest

leblonk
  • 187
  • 8
1

This worked for me in IntelliJ Idea: 1) Edit your run configuration 2) From your script parameters option remove '--tests *'

stacker
  • 21
  • 1