How to... exclude testcases?

Hello all,

I created a superclass for my Unit tests, but now IntelliJ thinks this is a testcase. The test fails, because the testcase does not contain any tests. I run the test using the JUnit tab of 'Edit Configurations', and then I choose 'All in Package' + 'In whole project'. Now I added a simple test which always succeeds, but it would be better to execlude it from the tests. Is that possible?

Btw, the code looks like this:

4 comments

Have you tried making the class Abstract? That's what I usually do in such cases, since the base test class is never initiated alone.

However, I run my tests from the command line, so I can't say for certain whether IDEA properly handles this.

0

Good idea, it works. Thanks!

(PS: I also encountered a different problem:

When I ran my test, I saw a failing test. I was not necessary anymore, so I put an 'x' for the method name, so it wouldn't be recognized as a test. The method was now called xtestDoGet(), so normally, the test wouldn't be executed. However, IntelliJ "remembers" the original name, so when I rerun my tests, the original method 'testDoGet()' is executed, even though it doesn't even anymore!

(I'm using IntelliJ 5.0.2)

0

Well, if the test method is truly not needed, why not simply delete it?

However, I did some experimenting myself. I could repeat this error if, within the "Edit Configurations" dialogue, my "Make module before before running" was unchecked. If I checked this box, the xtestXXX method no longer executed after rerunning the test.

Hope this helps!

KeithC

0

Grr, I must have been sleeping! I noticed the checkbox was unchecked here too, though normally it never is. It fixed the problem (and a lot of other problems! :)) immediately!

Thanks for your help!

0

Please sign in to leave a comment.