Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
JSTestDriver, Mocking and RequireJS
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Aaron Greenlee  
View profile  
 More options Dec 12 2010, 7:18 pm
From: Aaron Greenlee <aarongreen...@gmail.com>
Date: Sun, 12 Dec 2010 16:18:50 -0800 (PST)
Local: Sun, Dec 12 2010 7:18 pm
Subject: JSTestDriver, Mocking and RequireJS
I am curious, if anyone is using JSTestDriver with their RequireJS
projects?

JSTestDriver seems to run all the tests within a single instance--
which has led me to wrap each unit test within it's own RequireJS
context.

I have a feeling I am over complication things and was hoping someone
could share an example.

The application and I am experimenting with includes RequireJS and
Backbone.JS with tests powered by JSTestDriver from Eclipse.

Thanks,

Aaron Greenlee


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fabian Jakobs  
View profile  
 More options Dec 13 2010, 3:31 pm
From: Fabian Jakobs <fabian.jak...@web.de>
Date: Mon, 13 Dec 2010 21:31:10 +0100
Local: Mon, Dec 13 2010 3:31 pm
Subject: Re: [requirejs] JSTestDriver, Mocking and RequireJS
Hi Aaron,

let me know if you find a solution. After converting ACE
<https://github.com/ajaxorg/ace> to requireJS all our jsTestDriver
stopped working. I have found no easy way to use it together with
requireJS. I'm very interested in your findings.

Best,
Fabian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
neonstalwart  
View profile  
 More options Dec 13 2010, 3:37 pm
From: neonstalwart <neonstalw...@gmail.com>
Date: Mon, 13 Dec 2010 12:37:29 -0800 (PST)
Local: Mon, Dec 13 2010 3:37 pm
Subject: Re: JSTestDriver, Mocking and RequireJS
i haven't used jsTestDriver but i did notice this
https://github.com/jrburke/requirejs/blob/master/build/tests/builds.j...
which looks like it might be fixing the problem you are describing.
it's maybe not elegant but perhaps it's helpful.

ben...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Aaron Greenlee  
View profile  
 More options Dec 13 2010, 6:02 pm
From: Aaron Greenlee <aarongreen...@gmail.com>
Date: Mon, 13 Dec 2010 15:02:04 -0800 (PST)
Local: Mon, Dec 13 2010 6:02 pm
Subject: Re: JSTestDriver, Mocking and RequireJS

RequireJS can not play with JSTestDriver. No script loader can without
introducing some kind of build process. JSTestDriver acts as it's own server
and will not respond to script or Ajax requests. I was able to get a ugly
sample up and running by mocking the 'define()' and 'require()' methods,
but, I don't think I like this approach as it forces me to inject the real
code inside a RequireJS module during a build process to allow the code to
execute within my test environment. Here is my quick sample test for
JSTestDriver:

SampleTest.prototype.setUp = function () {
// Mock RequireJS
--------------------------------------------------------------
rjsMock = {};
require = function (mdl) {
var request = rjsMock[mdl];
return request;

}

define = function (mdl, fn) {
rjsMock[mdl] = fn;
}

// Mock Dependencies
-----------------------------------------------------------
define(
'js/model/Document'
,function
(){
return Backbone.Model.extend({});

}
);
}

I really enjoy using JSTestDriver since it makes testing multiple browsers
so easy and fast. But, I am close to giving up and getting these two to play
nice. At one point, JSTestDriver supported a 'serve' attribute which would
have allowed this; however, it appears to have been removed to keep the unit
tests "pure".

Thanks,

Aaron Greenlee


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Burke  
View profile  
 More options Dec 14 2010, 2:02 am
From: James Burke <jrbu...@gmail.com>
Date: Mon, 13 Dec 2010 23:02:39 -0800
Local: Tues, Dec 14 2010 2:02 am
Subject: Re: [requirejs] Re: JSTestDriver, Mocking and RequireJS

On Mon, Dec 13, 2010 at 3:02 PM, Aaron Greenlee <aarongreen...@gmail.com> wrote:
> RequireJS can not play with JSTestDriver. No script loader can without
> introducing some kind of build process. JSTestDriver acts as it's own server
> and will not respond to script or Ajax requests. I was able to get a ugly
> sample up and running by mocking the 'define()' and 'require()' methods,
> but, I don't think I like this approach as it forces me to inject the real
> code inside a RequireJS module during a build process to allow the code to
> execute within my test environment. Here is my quick sample test for

I am not familiar with JSTestDriver, it seems like it is focused on
very small unit tests. How would tests that involve data requests via
XHR work, or are they not allowed?

I have been thinking of trying out the updated YUI Test[1] that does
not depend on YUI, and Yeti[2] for driving the tests. I'm not sure if
Yeti works with the new YUI, but Ben Lowery was able to do some sort
of adapter that works for Dojo[3] that allows the use of Yeti.

I know that switching test frameworks is not fun though. I'm open to
entertaining getting something to work with JSTestDriver, but if it
cannot even do XHR/JSONP tests, not sure there is much hope in finding
a solution, unless you run the RequireJS optimizer to collect all the
scripts together, as Aaron mentioned.

James

[1] http://www.yuiblog.com/blog/2010/11/09/introducing-the-new-yui-test/
[2] http://yuilibrary.com/projects/yeti/
[3] https://github.com/blowery/yeti


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Aaron Greenlee  
View profile  
 More options Dec 14 2010, 6:41 am
From: Aaron Greenlee <aarongreen...@gmail.com>
Date: Tue, 14 Dec 2010 03:41:50 -0800 (PST)
Local: Tues, Dec 14 2010 6:41 am
Subject: Re: [requirejs] Re: JSTestDriver, Mocking and RequireJS

Thanks, James.

After discussing the issue on the JSTestDriver Google Group, I expect they
will make some changes to better support script loaders.

JSTestDriver does work "out-of-the-box" but it is not designed to be a test
framework. JSTestDriver is really more of a test runner supporting YUI Test,
QUnit, Jasmine, Ruby Auto Teast, Team City and really any other testing
framework. It works via the command line, from Eclipse or from within
IntilliJIDEA and makes it very easy (and fast) to test in all major
browsers. You can learn more here: http://code.google.com/p/js-test-driver/

On a side note, I've been waiting for an opportunity to introduce it into my
work since seeing your presentation at the jQuery confernece at Microsoft
last April. I appreciate you contributing this to the community. Thanks!

Aaron Greenlee


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fabian Jakobs  
View profile  
 More options Dec 14 2010, 9:05 am
From: Fabian Jakobs <fabian.jak...@web.de>
Date: Tue, 14 Dec 2010 15:05:18 +0100
Local: Tues, Dec 14 2010 9:05 am
Subject: Re: [requirejs] Re: JSTestDriver, Mocking and RequireJS
Hi James,

> I am not familiar with JSTestDriver, it seems like it is focused on
> very small unit tests. How would tests that involve data requests via
> XHR work, or are they not allowed?

The last time I checked jsTestDriver did not allow async tests and it
seems to me that they don't even want them to keep the tests pure.

> I have been thinking of trying out the updated YUI Test[1] that does
> not depend on YUI, and Yeti[2] for driving the tests. I'm not sure if
> Yeti works with the new YUI, but Ben Lowery was able to do some sort
> of adapter that works for Dojo[3] that allows the use of Yeti.

That would be awesome. Yeti looks to me like the better jsTestDriver.

Best,
Fabian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »