This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 93297 - Remove dependency on test datadir of other project
Summary: Remove dependency on test datadir of other project
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Freeform (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Milan Kubec
URL: http://anna.nbextras.org/test/unit/qa...
Keywords: TEST
Depends on:
Blocks: 93294
  Show dependency tree
 
Reported: 2007-01-26 12:24 UTC by pzajac
Modified: 2007-02-20 18:11 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch (5.41 KB, patch)
2007-02-15 13:43 UTC, pzajac
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description pzajac 2007-01-26 12:24:51 UTC
Tests of Java/freeform module uses  datadir of ant/freeform. Execution of tests
doesn't works in test distribution.

Please remove:

# Better to fix by not using a data dir (just generator), or copying required
files into java/freeform/test/unit/data
test-unit-sys-prop.xtest.data=${nb_all}/ant/freeform/test/unit/data

You can fix  this problem in two ways:

1) Either don't depends on datadir. For example you can add resource on
classpath of tests. You can access to the resource by using
Class.resource.asStream in test initialization

2)or ovverride tasks in build.xml of project:
    <target name="test-build-datajar" depends="do-test-build" if="exists.test.data">
           <zip destfile="${test.unit.out.folder}/data.zip"
basedir="${test.unit.dir}/data"/> 
    </target>

to somethink like ...

    <target name="test-build-datajar" depends="do-test-build" if="exists.test.data">
           <zip destfile="${test.unit.out.folder}/data.zip"
basedir="${nb_all}/ant/freeform/test/unit/data"/> 
    </target>
Comment 1 pzajac 2007-01-30 17:51:11 UTC
P3 -> P2
We switch daily test runs to binary tests distribution. Please either remove
tests from stable test suite or fix it. Thanks. 

Proposal for stable test suite is available at:
http://wiki.netbeans.org/wiki/view/TestAttribsInUse
Comment 2 pzajac 2007-02-15 13:42:38 UTC
It isn't  easy to use other datadir together for binary distribution and xtest.
At xtest side it is necessary to override 

xtest.data property

Unfortunatelly this property is automatically copied to test.properties of bin
test dist. 

NBM harness doesn't know nothing about xtest.data property. It's correct because
NBM  harness doesn't depends on xtest. 

I am going to add to common.xml ability to override data dir location 
 <property name="test.unit.data.dir" location="${test.unit.dir}/data"/>

I am not sure if is good idea to add some info about test.uit.data.dir  to
harness/README

Jesse, what do you think about my workaround?

Finally if some one can use datadir from other project he can do it. If he want
 to use xtest for test run he needs to override

test-unit-sys-prop.xtest.data 

property in nbproject/project.properties.

If he want  to use junit he needs to override  

test.unit.data.dir

property in nbproject/project.properties.
Comment 3 pzajac 2007-02-15 13:43:54 UTC
Created attachment 38542 [details]
patch
Comment 4 pzajac 2007-02-15 13:48:32 UTC
fixed

Checking in nbbuild/antsrc/org/netbeans/nbbuild/ShorterPaths.java;
/cvs/nbbuild/antsrc/org/netbeans/nbbuild/ShorterPaths.java,v  <--  ShorterPaths.java
new revision: 1.5; previous revision: 1.4
done
Checking in nbbuild/templates/common.xml;
/cvs/nbbuild/templates/common.xml,v  <--  common.xml
new revision: 1.56; previous revision: 1.55
done
Checking in nbbuild/test/unit/src/org/netbeans/nbbuild/ShorterPathsTest.java;
/cvs/nbbuild/test/unit/src/org/netbeans/nbbuild/ShorterPathsTest.java,v  <-- 
ShorterPathsTest.java
new revision: 1.3; previous revision: 1.2
done
Checking in nbbuild/test/unit/src/org/netbeans/nbbuild/ShorterPathsTest.xml;
/cvs/nbbuild/test/unit/src/org/netbeans/nbbuild/ShorterPathsTest.xml,v  <-- 
ShorterPathsTest.xml
new revision: 1.3; previous revision: 1.2
done
Checking in java/freeform/nbproject/project.properties;
/cvs/java/freeform/nbproject/project.properties,v  <--  project.properties
new revision: 1.16; previous revision: 1.15
done
Comment 5 Jesse Glick 2007-02-16 17:34:54 UTC
IMO better would be to delete these old crappy tests that use the data dir and
rewrite to generate projects in the workdir.
Comment 6 pzajac 2007-02-20 18:11:24 UTC
 There are only problems with data dirs. I am for to deprecate :
NbTestCase.getDatadir()