Opened 12 years ago

Closed 12 years ago

#3730 closed defect (fixed)

0.9: dojo.rpc tests fail when running Dojo UT under Rhino

Reported by: Jared Jurkiewicz Owned by: Jared Jurkiewicz
Priority: high Milestone: 0.9
Component: RPC Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

GROUP "tests.rpc" has 4 tests to run TypeError?: Cannot find function rawXhrPost.

ERROR IN:

(function () {var d = new doh.Deferred();var td = this.svc.myecho("RPC TEST");if (window.location.protocol == "file:") {var err = new Error("This Test requires a webserver and PHP and will fail intentionally if loaded from file://");d.errback(err);return d;}td.addCallbacks(function (result) {if (result == "<P>RPC TEST</P>") {return true;} else {return new Error("JsonRpc?-EchoTest? test failed, resultant content didn't match");}}, function (result) {return new Error(result);});td.addBoth(d, "callback");return d;})

TypeError?: Cannot find function rawXhrPost.

ERROR IN:

(function () {var d = new doh.Deferred();var td = this.svc.contentB();if (window.location.protocol == "file:") {var err = new Error("This Test requires a webserver and PHP and will fail intentionally if loaded from file://");d.errback(err);return d;}td.addCallbacks(function (result) {if (result == "<P>Content B</P>") {return true;} else {return new Error("JsonRpc?-EmpytParamTest? test failed, resultant content didn't match");}}, function (result) {return new Error(result);});td.addBoth(d, "callback");return d;})

TypeError?: Cannot find function xhrGet.

ERROR IN:

(function () {if (this.svc.objectName = "testClass") {return true;} else {return new Error("Error loading and/or parsing an smd file");}})

TypeError?: Cannot find function xhrGet.

ERROR IN:

(function () {var d = new doh.Deferred();if (window.location.protocol == "file:") {var err = new Error("This Test requires a webserver and will fail intentionally if loaded from file://");d.errback(err);return d;}console.debug("Run Test: ", this.svc);var td = this.svc.webSearch({[Error: Query filter requires field and constraints separated by a "="]});td.addCallbacks(function (result) {return true;if (resultResultSet?Result?[0]DisplayUrl? == "dojotoolkit.org/") {return true;} else {return new Error("JsonRpc_SMD_Loading_Test failed, resultant content didn't match");}}, function (result) {return new Error(result);});td.addBoth(d, "callback");return d;})

This looks like the RPC tests are making use of the xhr* code, which isn't available under Rhino. Therefore, these tests should be flagged with an:

if(dojo.isBrowser) check before they're executed. (Or the tests should be dojo.requireIf(dojo.isBrowser, ...).

To run the UT in rhino, just: cd utils/doh then execute: java -jar ../buildscripts/lib/custom_rhino.jar runner.js

Attachments (1)

dojo.rpc_tests_20070712.patch (465 bytes) - added by Jared Jurkiewicz 12 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 12 years ago by Jared Jurkiewicz

Simple fix for this is to only engage these tests when DOH is running in the browser (and has xhr support). Minor change to tests/module.js:

dojo.requireIf(dojo.isBrowser, "tests.rpc");

comment:2 Changed 12 years ago by Jared Jurkiewicz

Owner: changed from Dustin Machi to Jared Jurkiewicz

Changed 12 years ago by Jared Jurkiewicz

comment:3 Changed 12 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed

(In [9604]) Fixing minor issue with RPC tests and Rhino. fixes #3730

Note: See TracTickets for help on using tickets.