Opened 11 years ago

Closed 7 years ago

Last modified 7 years ago

#5630 closed defect (invalid)

[patch] [ccla] Not able to run DOH tests from outside of the dojo/tests directory

Reported by: ptwobrussell Owned by: haysmark
Priority: high Milestone: future
Component: TestFramework Version: 1.0
Keywords: needsreview Cc: ptwobrussell@…, Tom Trenka
Blocked By: Blocking:

Description (last modified by Adam Peller)

So, I have been trying to get doh to run tests from outside of the dojo/tests directory, and it looks like maybe I have run across a trivial bug (or at least something I can't explain):

Let's assume I have this trivial test:

dojo.provide("tests.foo.testMe");
dojo.require("doh.runner");
doh.register("tests.foo.testMe", [ 

    //test fixture
    {   
        name : "fooTest",
        setUp : function() {}, 
        runTest : function(t) { t.assertTrue(1); },
        tearDown : function() {}
    },  

    //test fixture
    {   
        name : "barTest",
        setUp : function() { this.bar="bar"},
        runTest : function(t) { t.assertEqual(this.bar, "b"+"a"+"rr"); },
        tearDown : function() {}
    },  

    //standalone function
    function baz() {doh.assertFalse(0)}

]);

Well, assuming that foo is a sibling of the the dojo directory in the root of the installation, there is a non-fatal exception thrown if you run it like so, although the tests do run:

Grendel:doh matthew$ java -jar ../shrinksafe/custom_rhino.jar runner.js dojoUrl="../../dojo/dojo.js" testModule=foo.testMe

------------------------------------------------------------
The Dojo Unit Test Harness, $Rev$
Copyright (c) 2007, The Dojo Foundation, All Rights Reserved
------------------------------------------------------------ 

An exception occurred: Error: Could not load 'foo.testMe'; last tried '../foo/testMe.js'
3 tests to run in 1 groups
------------------------------------------------------------
GROUP "tests.foo.testMe" has 3 tests to run
	_AssertFailure: doh._AssertFailure: assertEqual() failed: expected |bar| but got |barr|: assertEqual() failed: expected |bar| but got |barr|
doh._AssertFailure: assertEqual() failed: expected |bar| but got |barr|
	ERROR IN:
		 (function (t) {t.assertEqual(this.bar, "b" + "a" + "rr");})
------------------------------------------------------------
| TEST SUMMARY:
------------------------------------------------------------
	 3 tests in 1 groups
	 0 errors
	 1 failures

Notice that the module is also qualified as tests.foo.testMe, not just foo.testMe. Is that expected?

The next question I have involves the testUrl. If I run the following command, which seems like a slight variation of the previous one, all tests in dojo/tests run -- not the stuff in foo/testMe.js:

Grendel:doh matthew$ java -jar ../shrinksafe/custom_rhino.jar runner.js dojoUrl="../../dojo/dojo.js" testUrl=../../foo/testMe.js

------------------------------------------------------------
The Dojo Unit Test Harness, $Rev$
Copyright (c) 2007, The Dojo Foundation, All Rights Reserved
------------------------------------------------------------ 

338 tests to run in 26 groups
------------------------------------------------------------
GROUP "tests.date.locale" has 9 tests to run
------------------------------------------------------------
GROUP "tests.data.readOnlyItemFileTestTemplates, with datastore dojo.data.ItemFileReadStore" has 56 tests to run
^CGrendel:doh matthew$ 

Not sure if what testUrl is supposed to be doing may be my own misunderstanding or not? Looks like this issue may also be referenced in #5419.

At any rate, I really want to have excellent coverage of D.O.H in the product I'm working on, so any clarification would be very much appreciated.

Attachments (1)

runner.patch (2.3 KB) - added by Adam Peller 11 years ago.
patch from Mehmet Akin (IBM) to enable DOH to run outside Dojo dir

Download all attachments as: .zip

Change History (18)

comment:1 Changed 11 years ago by ptwobrussell

Cc: ptwobrussell@… added
Milestone: 1.1

Ok, so I think we established that the only real issue here is that you can't just use testUrl=someUrl on it's own and have D.O.H. fire off tests. If you do that (not including testModule=) to clear out the default testModules, it runs all of the core tests.

A related issue, I think, is that you also can't execute tests outside of the dojo root directory via the runner.html file. I tried multiple variations, and regardless of what I did, the runner.html insisted on running the core tests. (And if I moved the core tests somewhere else, it just failed.)

comment:2 Changed 11 years ago by dylan

Milestone: 1.11.2

comment:3 Changed 11 years ago by Adam Peller

Description: modified (diff)

see [13290]

comment:4 Changed 11 years ago by Adam Peller

Owner: changed from alex to Adam Peller

Changed 11 years ago by Adam Peller

Attachment: runner.patch added

patch from Mehmet Akin (IBM) to enable DOH to run outside Dojo dir

comment:5 Changed 11 years ago by Adam Peller

from Mehmet:

a semi-colon is used to separate module path registrations, e.g. registerModulePath=module1,path1;module2,path2. On my machine, this works in FF, but in IE6/7 the string is cut off after a semi-colon appears in the URL when redirecting with the meta tag in runTests.html. Therefore I replaced that with a colon, e.g. registerModulePath=module1,path1:module2,path2. There was another small issue related to the usage of a custom dojo path as the path for dojo.css was hardcoded

comment:6 Changed 11 years ago by bill

Milestone: 1.21.3

comment:7 Changed 10 years ago by bill

Milestone: 1.3future
Summary: Not able to run D.O.H tests from outside of the dojo/tests directory[patch] [ccla] Not able to run D.O.H tests from outside of the dojo/tests directory

comment:9 Changed 9 years ago by Adam Peller

Summary: [patch] [ccla] Not able to run D.O.H tests from outside of the dojo/tests directory[patch] [ccla] Not able to run DOH tests from outside of the dojo/tests directory

comment:10 Changed 7 years ago by ben hockey

Keywords: needsreview added

there's a typo in this ticket's description - #5149 is the similar ticket regarding testUrl.

comment:11 Changed 7 years ago by Adam Peller

Cc: Tom Trenka added

comment:12 Changed 7 years ago by Adam Peller

see also #10511 for a patch

comment:13 Changed 7 years ago by Adam Peller

#10511 is a duplicate of this ticket.

comment:14 Changed 7 years ago by andybalaam

The patch attached to #10511 solves this problem for me, but the patch attached to this ticket seems to be addressing a different problem?

comment:15 Changed 7 years ago by Adam Peller

Owner: changed from Adam Peller to haysmark
Status: newassigned

comment:16 Changed 7 years ago by haysmark

Resolution: invalid
Status: assignedclosed

There is some serious confusion here. You can run DOH on tests outside of dojo/tests just fine; see dijit, dojox, etc.

The tests package is hardwired to dojo/tests. If you do not want to put your tests in dojo/tests, don't declare your tests as being in the tests package.

The DOH runner trace refers to the first test as tests.foo.testMe because you coded the test as:

dojo.provide("tests.foo.testMe");

You should have typed:

dojo.provide("foo.testMe");

Then you would not have seen the nonfatal error.

There is no such thing as testUrl.

comment:17 in reply to:  16 Changed 7 years ago by Adam Peller

Replying to haysmark:

There is no such thing as testUrl.

FWIW, there was at one time. This is a very old ticket. It seemed to get deprecated in r24328

Note: See TracTickets for help on using tickets.