Test view information is not accurate

已回答

I have a set of test cases to run, but running the results view makes me confused.

The test results show 1failed, 9 passed, 1 ignored.

But my test case collection does not have a test marked as ignore, and I determined that the test case testCreateUser failed, but it appears to be ignored.

At the same time, the test case marked as failed is not seen in the view on the left.

BTW, I am using junit.

0

What testCreateUser shows? Is it ignored or stopped?

What IntelliJ IDEA shows in case you choose to hide "completed" and "ignored" tests: 

0

@Konstantin Annikov 

testCreateUser is ignored, not failed. That makes me confused.

And, I don't know if you noticed that I have only 10 test cases, but the final test results: 1 failed, 9 passed, 1 ignored, with 11 results. It seems that the failed test case and the ignored test case are the same one?

0

Untick "competed" and "ignored" buttons (as it is shown on my previous screenshot). What remains? 

0

Do you see anything in Run console? Results of the failed test should exist there: 

0

Please try to update IntelliJ IDEA to 2019.2.1 and in case it does not help, please share a test example where the issue could be reproduced. 

0

Konstantin Annikov I am using 2019.2.1. This is the simplest code to reproduce this problem:

import org.junit.BeforeClass;

public class TestCase {
private static int num = 1;

@BeforeClass
public static void before() {
int i = 1/num;
num = num - i;
}
}
import org.junit.Test;

import static org.junit.Assert.*;
public class ATestCase extends TestCase{

@Test
public void passed(){
assertTrue(true);
}

}
import org.junit.Test;
import static org.junit.Assert.*;

public class BTestCase extends TestCase{

@Test
public void failed() {
fail();
}
}

The problem should be an exception thrown by the parent class's @BeforClass, causing the subclass's test case to be ignored, but the view does not display the relevant information.

0

Hello,

I have modified before() function by adding division by zero, so it fails: 

int i = 1/0;

And run test1 and test2. In both cases, tests were skipped due to the error in before() function. And that is being displayed correctly (1 test failed and one skipped in both cases). See the gif as a reference: 

https://gifyu.com/image/hnf7

Maybe you can share an entire project with the reproduced issue? You can upload it to https://uploads.services.jetbrains.com/

 

 

0

Konstantin Annikov

It should be that I did not say complete, here is the complete scene restoration.

https://gifyu.com/image/hnYb

Need to run the entire test package to restore this problem.

0

Hello,

Thank you for all the details provided. I have created a bug based on your case: 

https://youtrack.jetbrains.com/issue/IDEA-221588

Feel free to watch it in order to be notified once it has updates. See this article if you are not familiar with YouTrack.

0

请先登录再写评论。