Bug 69390 - No tests root folder was found
No tests root folder was found
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: JUnit
4.x
All All
: P3 with 2 votes (vote)
: 7.2
Assigned To: Theofanis Oikonomou
junit-issues@java
:
: 100221 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-11-27 10:48 UTC by rkm1
Modified: 2012-10-26 11:43 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rkm1 2005-11-27 10:48:58 UTC
Situation:

An existing project has no unit tests.  Following docu instructions to create an
initial test results in an error message.

Reproduce:

In a project with no unit tests:

Project Window -> Right Click on project -> New File/Folder -> JUnit -> Test for
existing class. Then "Next".  This message appears: "No tests root folder was
found in the selected project".  This message isn't as clear as it could be.

Workaround:

It is necessary to create a folder called "test" within the project in order to
proceed.  Project Window -> Right Click on project -> New File/Folder -> Other
-> Folder.  Enter "test" then "Finish".

Once the "test" folder exists, it is possible to create a Unit test for an
existing class.

There appears to be no mention in the docu that this "test" folder must be
created first.  It seems like the "test" folder should be creating automatically
if it doesn't already exist.  Otherwise, the user should be notified that he
must first create it manually.


Netbeans Info:
Version: 4.1
Build: 200505031930
OS: Linux version 2.7.114-20a running on i386
Comment 1 Marian Petras 2005-12-05 17:48:09 UTC
Accepted.
Comment 2 Marian Petras 2007-09-18 16:32:45 UTC
*** Issue 100221 has been marked as a duplicate of this issue. ***
Comment 3 gglazer 2007-11-30 19:40:48 UTC
In addition, if the existing project is freeform, only the barest skeleton of a JUnit class is pregenerated.  By way of
example for a JUnit test of a class called Foo:

/*
 * FooTest.java
 * 
 * Created on Nov 26, 2007, 10:39:13 AM
 * 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.sun.Turing;

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

/**
 *
 * @author gglazer
 */
public class FooTest extends TestCase {
    
    public FooTest () {
    

    }

    

}

On top of this, the two inserted import statements throw "package org.junit does not exist" errors and there does not
appear to be any way to fix this other than starting the project over from scratch.
Comment 4 Peter Pis 2008-09-12 10:18:02 UTC
The fix should be easy. Ken, could you please look on it. Correct sentence and then I can fix it ;-).
Comment 5 Kenneth Ganfield 2008-09-12 13:11:26 UTC
This is a fairly old issue and was partially fixed in 6.1.
In 6.1 additional information was added to the help topic for the wizard that described how to specify a test package
folder for the project.

Also, information was added to the warning that appears if the user tries to create a test by right-clicking a class and
choosing Tools > Create JUnit Test.

The text in the warning dialog also describes how to specify a test package folder.
Unable to located test package

I think that you can take the text in the warning dialog and display it in the wizard panes for step 2 of each of the
JUnit wizards [JUnit  Test, Test for Existing Class, JUnit Suite].

Between the text in the wizard and the help topic for the wizard the user should understand how to resolve the problem.

I will add this issue to the late UI change and approved the change.

This will resolve the first part of the issue.
The second part of the issue about junit libraries in freeform projects would require another solution and probably
should be filed as a separate issue. I think that in a freeform project the user is supposed to locate the test
libraries when they create the freeform project, but i am not sure exactly how the user would add the library location
after creating the project. Probably modifying the Ant script. 
Comment 6 josediazaz 2009-06-17 17:23:49 UTC
Actually, I had to create $(PROJECT)/test/unit/src for this message to disappear (in 6.5.1). So, if you follow the
directions in 6.5.1 to create $(PROJECT)/test, the problem does not go way. I'd suggest the warning tells people to
create test/unit/src unless the fix in 6.8 includes just looking for test and not test/unit/src.

Comment 7 Yulia Novozhilova 2011-05-04 09:48:21 UTC
See also #50012
Comment 8 Theofanis Oikonomou 2012-10-26 11:43:41 UTC
I cannot reproduce in NetBeans IDE Dev (Build 20121024-d3ca6f6fc27b). If I try to create some test for the first time (without any test folder in the project) it gets created for me and just gives some info in the output like the following

INFO: No FileObject found for the following URL: file:/tmp/JavaApplication1/test/
java.lang.IllegalStateException: No FileObject found for the following URL: file:/tmp/JavaApplication1/test/
	at org.netbeans.modules.java.testrunner.CommonTestUtil.getTestTargets(CommonTestUtil.java:174)

probably this was fixed in 8904f692d00e. Please reopen otherwise. Thank you


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