JUnit Test Plugin Question

I hope this is the right place to ask this question. If not excuse me in advance.

I'm trying to use the very latest JUnit Test Plugin ( 0.15 (#876)) with the latest Aurora build (#887).

I'm trying to get the JUnit Test Plugin to generate the test classes into a seperate source directory, but I can't seem to figure out how to do it.

My poject file structure looks like this:

\Project (Main project directory)
\Project\build\classes (the directory where my ".class files" are compiled to.
\Project\src (the directory where my source files reside)
\Project\test (the directory where I want my test srce files to reside)

I've tried every combination I can think of in the JUnit Test Plug-in configuration panel and I can never get it to
generate the classes in the directory
\Project\test\com\companyname\util\FooTest.java,
instead the best I can do is:
\Project\src\com\companyname\util\test\FooTest.java

Is there no way to accomplish this with the plug-in?
Any assistance would be greatly appreciated.

Regards,
C.J.

14 comments
Comment actions Permalink

Did you try
tested class: src\$DIRECTORY$\$CLASS$
test class: test\$DIRECTORY$\$CLASS$Test

Jacques

0
Comment actions Permalink

Yes, and I got an error when I tried to generate the JUnit Test Class that "Current class C:\Project\src\com\company\util\Foo.java does not conform to the defined test organization."

Regards,
C.J.

0
Comment actions Permalink

Turn on diagnostic as documented at http://www.intellij.org/twiki/bin/view/Main/JUnitTestPlugin#Troubleshooting and send me the log file.
Also it would help if you could just zip up your project (project files ipr,iml,iws + directory structure + one source file that demonstrate the problem)

Jacques

0
Comment actions Permalink

Jacques,

Thanks for your help. I’ve included the log like you requested; unfortunately I can’t include my project with source. It is way to big to send via email, plus it is company confidential. I tried using your plug-in on simpler projects that I could send you, but they all worked fine. I don’t understand what is special about my main project that causes your plug-in to fail. L Hopefully the log will help shed some lie on the problem for you. If there is anything else I can do to help, short of sending you my source files let me know.



Regards,
C.J.

ChrisJ@vertical.com



Attachment(s):
idea.log
0
Comment actions Permalink

You have named your source directory "Src" not "src".
Just set your the tested class pattern to Src/$DIRECTORY$/$CLASS$Test and it should work.

Jacques

0
Comment actions Permalink

Actually, my source directory is indeed "src". The project path has "Src". All my projects are under the "Src" directory, while all my projects have a "src" directory that holds the source files.

C:\Development\Src\Project\src\com\companyname\util\Foo.java.

Anyway I changed "src" to "Src" and got the same error.

Regards,
C.J.

0
Comment actions Permalink

Sorry I did not even see that you had twice src in your path.
So here are the 2 things I noticed that might not be handled correctly:
1) _ in path
2) src twice in path
I will try to create test cases to see if it is the source of your problem. In the meantimes does any of your other projects that work share these characterics?

Jacques

0
Comment actions Permalink

Jacques,

So all my projects have the double "Src/src" in the path. And a few of them worked fine, so I don't think that is the issue.

However, only my main project has "_" in the path, the other small projects that worked didn't have a "_" in the path. So that might indeed be the problem.

Regards,
C.J.

0
Comment actions Permalink

Sorry C.J but I was wrong. I was already testing for underscore. Just for kicks I added a test with one of the failing file path you had in your log and it passed.
Would it be possible for you to recreate the same project tree with underscore in any paths?
I am sorry but I am clueless here.

Jacques

0
Comment actions Permalink

Jacques,

Wow, I am stuck. I tried reproducing the bug on a number of different projects -- no luck. So I make a dummy project that copies the form of the offending project, still no luck. I've tried everything I can think of, but I'm at a complete lose what is different about this one project that causes your great plug-in to throw the error.

I've copied the logs from the unsuccessful attempt and the succesfull attempt, hoping maybe you can see something.

Regards,
C.J.


2003-08-12 13:53:16,085 DEBUG - llij.plugins.junit.TestPattern - C:/Development/Src/IO_6/Voice_Applications/AA_VM/src/com/vertical/va/apps/AAVMMain.java does not match src/(?:((?:\w|\/)\/))?(\w) \b(?=\.|\Z)
2003-08-12 13:53:16,085 DEBUG - llij.plugins.junit.TestPattern - C:/Development/Src/IO_6/Voice_Applications/AA_VM/src/com/vertical/va/apps/AAVMMain.java does not match src/(?:((?:\w|\/)\/))?(\w) \b(?=\.|\Z)
2003-08-12 13:53:21,954 DEBUG - t.actions.JUnitTestCaseHandler - originClass = PsiClass:AAVMMain
2003-08-12 13:53:21,954 DEBUG - t.actions.JUnitTestCaseHandler - originClass = PsiClass:AAVMMain
2003-08-12 13:53:21,964 DEBUG - t.actions.JUnitTestCaseHandler - method = PsiMethod:courtesyShutdown
2003-08-12 13:53:21,964 DEBUG - t.actions.JUnitTestCaseHandler - method = PsiMethod:courtesyShutdown
2003-08-12 13:53:21,964 DEBUG - llij.plugins.junit.TestPattern - C:/Development/Src/IO_6/Voice_Applications/AA_VM/src/com/vertical/va/apps/AAVMMain.java does not match src/(?:((?:\w|\/)\/))?(\w) \b(?=\.|\Z)
2003-08-12 13:53:21,964 DEBUG - llij.plugins.junit.TestPattern - C:/Development/Src/IO_6/Voice_Applications/AA_VM/src/com/vertical/va/apps/AAVMMain.java does not match src/(?:((?:\w|\/)\/))?(\w) \b(?=\.|\Z)
2003-08-12 13:53:28,033 DEBUG - t.actions.JUnitTestCaseHandler - originClass = PsiClass:AAVMMain
2003-08-12 13:53:28,033 DEBUG - t.actions.JUnitTestCaseHandler - originClass = PsiClass:AAVMMain
2003-08-12 13:53:28,033 DEBUG - t.actions.JUnitTestCaseHandler - method = PsiMethod:foo
2003-08-12 13:53:28,033 DEBUG - t.actions.JUnitTestCaseHandler - method = PsiMethod:foo
2003-08-12 13:53:28,043 DEBUG - llij.plugins.junit.TestPattern - getTestClassPath(C:/Development/Src/IO_7/Voice_Applications/AA_VM/src/com/vertical/va/apps/AAVMMain.java)=C:/Development/Src/IO_7/Voice_Applications/AA_VM/test/src/com/vertical/va/apps/AAVMMainTest.java
2003-08-12 13:53:28,043 DEBUG - llij.plugins.junit.TestPattern - getTestClassPath(C:/Development/Src/IO_7/Voice_Applications/AA_VM/src/com/vertical/va/apps/AAVMMain.java)=C:/Development/Src/IO_7/Voice_Applications/AA_VM/test/src/com/vertical/va/apps/AAVMMainTest.java
2003-08-12 13:53:28,043 DEBUG - llij.plugins.junit.TestPattern - getTestClassPath(C:/Development/Src/IO_7/Voice_Applications/AA_VM/src/com/vertical/va/apps/AAVMMain.java)=C:/Development/Src/IO_7/Voice_Applications/AA_VM/test/src/com/vertical/va/apps/AAVMMainTest.java
2003-08-12 13:53:28,043 DEBUG - llij.plugins.junit.TestPattern - getTestClassPath(C:/Development/Src/IO_7/Voice_Applications/AA_VM/src/com/vertical/va/apps/AAVMMain.java)=C:/Development/Src/IO_7/Voice_Applications/AA_VM/test/src/com/vertical/va/apps/AAVMMainTest.java
2003-08-12 13:53:28,053 DEBUG - llij.plugins.junit.TestPattern - getTestClassPath(C:/Development/Src/IO_7/Voice_Applications/AA_VM/src/com/vertical/va/apps/AAVMMain.java)=C:/Development/Src/IO_7/Voice_Applications/AA_VM/test/src/com/vertical/va/apps/AAVMMainTest.java
2003-08-12 13:53:28,053 DEBUG - llij.plugins.junit.TestPattern - getTestClassPath(C:/Development/Src/IO_7/Voice_Applications/AA_VM/src/com/vertical/va/apps/AAVMMain.java)=C:/Development/Src/IO_7/Voice_Applications/AA_VM/test/src/com/vertical/va/apps/AAVMMainTest.java

0
Comment actions Permalink

Little question:
If you create the class manually, will the toggle find it?

Jacques

0
Comment actions Permalink

Jacques,

I'm sorry, but I'm not exactly sure what you mean by "manually" and "the toggle".

By manually to you mean if I create a class file outside of IDEA?

I'm at a lose what you mean by "the toggle".

C.J.

0
Comment actions Permalink

By create manually I mean just create the test class from Idea (New/Class)

Then do Ctrl-Shit-T from the corresponding tested class and see if the plugin open the test class

Jacques

0
Comment actions Permalink

Jacques,

I get the exact same error when I do Ctrl-Shit-T. At least it is consistent. :)

C.J.

0

Please sign in to leave a comment.