wwag110465 / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

AsyncTestCase not working in 1.2.2, based on example in Wiki #171

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Copy one of the examples at 
http://code.google.com/p/js-test-driver/wiki/AsyncTestCase into a test
2. Run the test.

What is the expected output? What do you see instead?
I expected the example test to pass or fail, but it throws an exception.

What version of the product are you using? On what operating system?
jsTestDriver 1.2.2 plugin for Aptana/Eclipse on Mac OSX 10.6.5

Please provide any additional information below.
The example I ran is;

var AsynchronousTest = AsyncTestCase('AsynchronousTest');

AsynchronousTest.prototype.testSomethingComplicated = function(queue) {
  var state = 0;

  queue.defer('Step 1: schedule the window to increment our variable 5 seconds from now.', function(pool) {
    var myCallback = pool.add(function() {
      ++state;
    });
    window.setTimeout(myCallback, 5000);
  });

  queue.defer('Step 2: then assert our state variable changed', function() {
    assertEquals(1, state);
  });
};

And the exception when run is;

[{"message":"Result of expression 'queue.defer' [undefined] is not a 
function.","line":58,"sourceId":4596678592,"sourceURL":"http://localhost:42442/t
est//Users/Jamie/Sites/Work/tests/example.test.js","expressionBeginOffset":1180,
"expressionCaretOffset":1191,"expressionEndOffset":1191}]

Original issue reported on code.google.com by siunmaru on 2 Dec 2010 at 1:27

GoogleCodeExporter commented 8 years ago

Original comment by corbinrs...@gmail.com on 2 Dec 2010 at 3:01

GoogleCodeExporter commented 8 years ago
The documentation is for unreleased software in svn trunk, not for the 1.2.2 
release. I have managed to make 1.2.2 do something useful by using its _de 
facto_ interface, which is that a test is passed a pool rather than a queue. 
Think of 1.2.2 as having an implicit single-member queue. Declaration would be 
something like this:

AsynchronousTest.prototype.testSomethingComplicated = function(pool){

There are two solutions for this issue, neither of which involves writing code:
1. Release a new version that incorporates the current version of 
AsyncTestCase. Presumably the trunk code works as described.
2. Add another documentation section describing the actual 1.2.2 interface for 
AsyncTestCase.

Original comment by eric.eh9@gmail.com on 9 Dec 2010 at 4:26

GoogleCodeExporter commented 8 years ago
Could I politely request a broad ETA for when one of the solutions above could 
be implemented? It's just that as it is I'm unable to write tests against 
asynchronous code.

Thanks.

Original comment by siunmaru on 23 Dec 2010 at 12:41

GoogleCodeExporter commented 8 years ago
I got the new tag today from 
http://js-test-driver.googlecode.com/svn/tags/1.2.3 but have had some issues. 
The version of this code reports as being 1.1.1.b and the AsyncTestCase in my 
Dec 02, 2010 comment still fails as before. 

There's a good chance I may have installed the plugin incorrectly, for info the 
steps I followed were;

1. Checked out http://js-test-driver.googlecode.com/svn/tags/1.2.3
2. Uninstalled the JsTestDriver plugin installed from 
http://js-test-driver.googlecode.com/svn/update
3. Restart Aptana (built on eclipse)
4. Created /Applications/Aptana Studio 2.0/links/JsTestDriver.link with the 
contents path=/Users/masonj/Documents/JsTestDriver 1.2.3.
5. Restart Aptana (built on eclipse).

Apologies if the above procedure is incorrect, the old version number is the 
main concern for me - please could you confirm the 1.2.3 tag is working and 
that the examples I'm following in the wiki article at 
http://code.google.com/p/js-test-driver/wiki/AsyncTestCase are expected to work 
with that code?

Thanks again for your time.

Original comment by siunmaru on 17 Jan 2011 at 9:54

GoogleCodeExporter commented 8 years ago
Updating to 1.3.1 will fix the discrepancy.

Original comment by corbinrs...@gmail.com on 29 Mar 2011 at 12:37