NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Not all JUnit test are run

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
Robert Wierschke
Posted via mailing list.





PostPosted: Tue Jun 10, 2008 3:03 pm    Post subject: Not all JUnit test are run Reply with quote

Hi,

when using JUnit test in NetBeans 6.0 or NetBeans 6.1 some test do not
run after clicking on Test.

I found the following in the ant script:

<target depends="init,compile-test-single,-pre-test-run-single"
if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE
or set test.includes</fail>
<j2seproject3:junit excludes="" includes="${test.includes}"/>
</target>

So the question may be: where ${test.includes} is set.

Any ideas or other workarounds?

regards
robert
Back to top
Marian Petras
Posted via mailing list.





PostPosted: Tue Jun 10, 2008 3:31 pm    Post subject: Not all JUnit test are run Reply with quote

Note that in most (maybe all) types of projects, only tests with class
name ending with "Test" are executed. This is defined in the project's
build script. Can this be the cause of the trouble?

Marián

PS:
I am going home in a minute so I will not be able to respond quickly.


Robert Wierschke wrote:
Quote:
Hi,

when using JUnit test in NetBeans 6.0 or NetBeans 6.1 some test do not
run after clicking on Test.

I found the following in the ant script:

<target depends="init,compile-test-single,-pre-test-run-single"
if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE
or set test.includes</fail>
<j2seproject3:junit excludes="" includes="${test.includes}"/>
</target>

So the question may be: where ${test.includes} is set.

Any ideas or other workarounds?

regards
robert
Back to top
Robert Wierschke
Posted via mailing list.





PostPosted: Wed Jun 11, 2008 9:20 am    Post subject: Not all JUnit test are run Reply with quote

Hi,

that's it, thanks.

Also I think that's not a good behavior since JUnit 4 does not requiere such a naming. At least the "Create JUnit Test" dialog should print a warning.

Quote:
This is defined in the project's build script.

Can you tell where I can find this? I searched all build.xml and build-impl.xml as well as all properties fiels and did not find such a naming constraint.

regards
robert
Back to top
Marian Petras
Posted via mailing list.





PostPosted: Wed Jun 11, 2008 12:49 pm    Post subject: Not all JUnit test are run Reply with quote

Robert Wierschke wrote:
Quote:
Hi,

that's it, thanks.

Also I think that's not a good behavior since JUnit 4 does not requiere
such a naming. At least the "Create JUnit Test" dialog should print a
warning.

It does print a warning if you create a test class for a single source
class.


Quote:
Quote:
This is defined in the project's build script.

Can you tell where I can find this? I searched all build.xml and
build-impl.xml as well as all properties fiels and did not find such a
naming constraint.

It depends on the type of project. For plain J2SE projects, it is in
defined in target "-do-test-run" in build-impl.xml. For NetBeans module
projects, it is in target "test" (in common.xml). For other types of
projects, it may be defined in other places, I do not know the details.

Marián
Back to top
Robert Wierschke
Posted via mailing list.





PostPosted: Thu Jun 12, 2008 8:53 am    Post subject: Not all JUnit test are run Reply with quote

Hi,

I tried to change the name pattern in the build-impl.xml so that it runs all classes. When I do this NB complains that some classes have no test (I've a few helper classes for some test). So in the end NetBeans forces a naming convention on JUnit Test, which is nowhere documented and not required by the underlying testing tool (JUnit). Additionally as you mentioned the naming convention may differ per project type.


regards
robert
Back to top
Marian Petras
Posted via mailing list.





PostPosted: Thu Jun 12, 2008 9:15 am    Post subject: Not all JUnit test are run Reply with quote

Robert Wierschke wrote:
Quote:
Hi,

I tried to change the name pattern in the build-impl.xml so that it runs
all classes. When I do this NB complains that some classes have no test
(I've a few helper classes for some test)...

This is given by the mechanism of execution of Ant tests. Currently,
JUnit tests in Ant-based projects are executed via Ant (<junit> task).
This task tries to run all the specified classes with the JUnit
framework but it reports classes that do not contain any tests - it does
not skip them silently. Until this changes, the only way of improvement
I can think of is to detect and ignore such reports on the NetBeans side
so that they do not appear in the JUnit results window.

I heard something that in NB 6.5 it could be possible to execute JUnit
tests without Ant but I do not know whether any decision has been made.

Marián
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo