You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Brian Eaton (JIRA)" <ji...@apache.org> on 2008/06/16 09:07:44 UTC
[jira] Created: (SHINDIG-383) unit tests for io.js
unit tests for io.js
--------------------
Key: SHINDIG-383
URL: https://issues.apache.org/jira/browse/SHINDIG-383
Project: Shindig
Issue Type: Bug
Components: Features (Javascript)
Reporter: Brian Eaton
Attachments: iotest.patch
We should have unittests for io.js. I've put together a (very rough) patch for that based on a mocked out XMLHTTPRequest object.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (SHINDIG-383) unit tests for io.js
Posted by "Kevin Brown (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHINDIG-383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605408#action_12605408 ]
Kevin Brown commented on SHINDIG-383:
-------------------------------------
"Re: constructor conversion: this was done to allow different values to be passed into gadgets.config.register. Is there another way to do this? "
You can call config.init multiple times to reset configuration if you need it to vary for some reason.
"Re: testing the IE 6 case: is there a meaningful way to do browser-specific testing in this code, given that the tests are going to run in a non-browser environment? My approach to this would be to minimize the bits of code that are browser specific (e.g. the makeXhr function), and test those carefully by hand or in Selenium. Sure someone could write tests that use window.ActiveXObject in Rhino, but it would give me zero confidence that the code keeps working in IE. "
We should never write "browser specific" code, rather "feature specific" code, so that's what we test.
I don't think the XHR mocks need to be strict (but I think strict mocks are overused anyway; it's pretty rare for the order of execution to actually matter).
> unit tests for io.js
> --------------------
>
> Key: SHINDIG-383
> URL: https://issues.apache.org/jira/browse/SHINDIG-383
> Project: Shindig
> Issue Type: Bug
> Components: Features (Javascript)
> Reporter: Brian Eaton
> Attachments: iotest.patch
>
>
> We should have unittests for io.js. I've put together a (very rough) patch for that based on a mocked out XMLHTTPRequest object.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (SHINDIG-383) unit tests for io.js
Posted by "Kevin Brown (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHINDIG-383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605388#action_12605388 ]
Kevin Brown commented on SHINDIG-383:
-------------------------------------
- Converting gadgets.io into a constructor is painful (like all constructors in javascript); it doesn't add anything to the tests since gadgets.io.makeRequest works the same as it always has. Using a constructor is far more expensive at run time than simply defining properties on an object. None of the tests are deriving any benefit out of this, so what value does it add? For a long explanation of this, try Doug Crockford's book "Javascript: the good parts".
- Tests for getProxyUrl need to include %rawurl% as well as %url%
- This doesn't test the IE6 case (window.ActiveXObject).
> unit tests for io.js
> --------------------
>
> Key: SHINDIG-383
> URL: https://issues.apache.org/jira/browse/SHINDIG-383
> Project: Shindig
> Issue Type: Bug
> Components: Features (Javascript)
> Reporter: Brian Eaton
> Attachments: iotest.patch
>
>
> We should have unittests for io.js. I've put together a (very rough) patch for that based on a mocked out XMLHTTPRequest object.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (SHINDIG-383) unit tests for io.js
Posted by "Brian Eaton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHINDIG-383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brian Eaton updated SHINDIG-383:
--------------------------------
Attachment: (was: iotest.patch)
> unit tests for io.js
> --------------------
>
> Key: SHINDIG-383
> URL: https://issues.apache.org/jira/browse/SHINDIG-383
> Project: Shindig
> Issue Type: Bug
> Components: Features (Javascript)
> Reporter: Brian Eaton
>
> We should have unittests for io.js. I've put together a (very rough) patch for that based on a mocked out XMLHTTPRequest object.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (SHINDIG-383) unit tests for io.js
Posted by "Brian Eaton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHINDIG-383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605804#action_12605804 ]
Brian Eaton commented on SHINDIG-383:
-------------------------------------
I've added tests for preloading, oauth, signed fetch, various content types, etc...
There are no tests for window.ActiveXObject.
There are no tests for %rawurl%.
Tests of several areas are lacking depth.
This is still using a strict mock, because that was easier to write and I don't think it will cause problems for these test cases. It might even be useful for some of the more stateful tests, e.g. OAuth.
I'll let this sit in Jira for a day or two to see if there are more comments. Assuming no one objects, I'll check it in as is.
> unit tests for io.js
> --------------------
>
> Key: SHINDIG-383
> URL: https://issues.apache.org/jira/browse/SHINDIG-383
> Project: Shindig
> Issue Type: Bug
> Components: Features (Javascript)
> Reporter: Brian Eaton
> Attachments: iotests-v2.patch
>
>
> We should have unittests for io.js. I've put together a (very rough) patch for that based on a mocked out XMLHTTPRequest object.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (SHINDIG-383) unit tests for io.js
Posted by "Brian Eaton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHINDIG-383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605397#action_12605397 ]
Brian Eaton commented on SHINDIG-383:
-------------------------------------
Re: constructor conversion: this was done to allow different values to be passed into gadgets.config.register. Is there another way to do this?
Re: tests for getProxyUrl: My main goal here is to get us to a place where someone can write regression tests before they go hacking around in the code. Hopefully we'll someday reach a point where io.js has good test coverage, but that is going to depend on more people than just me.
Re: testing the IE 6 case: is there a meaningful way to do browser-specific testing in this code, given that the tests are going to run in a non-browser environment? My approach to this would be to minimize the bits of code that are browser specific (e.g. the makeXhr function), and test those carefully by hand or in Selenium. Sure someone could write tests that use window.ActiveXObject in Rhino, but it would give me zero confidence that the code keeps working in IE.
One spot where I'd like more feedback is on the mock XHR objects. They currently work by checking for equality of requests based on the method, url, and form-encoded query and body arguments irrespective of order. They are also strict mocks, in that they expect particular requests to occur exactly once in a particular order. Is this a good place to start? Is there more flexibility that is likely to be useful?
> unit tests for io.js
> --------------------
>
> Key: SHINDIG-383
> URL: https://issues.apache.org/jira/browse/SHINDIG-383
> Project: Shindig
> Issue Type: Bug
> Components: Features (Javascript)
> Reporter: Brian Eaton
> Attachments: iotest.patch
>
>
> We should have unittests for io.js. I've put together a (very rough) patch for that based on a mocked out XMLHTTPRequest object.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (SHINDIG-383) unit tests for io.js
Posted by "Brian Eaton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHINDIG-383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brian Eaton updated SHINDIG-383:
--------------------------------
Attachment: iotest.patch
This is not quite ready for submission, I'm putting it up for review.
> unit tests for io.js
> --------------------
>
> Key: SHINDIG-383
> URL: https://issues.apache.org/jira/browse/SHINDIG-383
> Project: Shindig
> Issue Type: Bug
> Components: Features (Javascript)
> Reporter: Brian Eaton
> Attachments: iotest.patch
>
>
> We should have unittests for io.js. I've put together a (very rough) patch for that based on a mocked out XMLHTTPRequest object.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (SHINDIG-383) unit tests for io.js
Posted by "Brian Eaton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHINDIG-383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brian Eaton updated SHINDIG-383:
--------------------------------
Attachment: iotests-v2.patch
New version. Miscellaneous cleanups.
> unit tests for io.js
> --------------------
>
> Key: SHINDIG-383
> URL: https://issues.apache.org/jira/browse/SHINDIG-383
> Project: Shindig
> Issue Type: Bug
> Components: Features (Javascript)
> Reporter: Brian Eaton
> Attachments: iotests-v2.patch
>
>
> We should have unittests for io.js. I've put together a (very rough) patch for that based on a mocked out XMLHTTPRequest object.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (SHINDIG-383) unit tests for io.js
Posted by "Brian Eaton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHINDIG-383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brian Eaton resolved SHINDIG-383.
---------------------------------
Resolution: Fixed
Fixed in r670557.
> unit tests for io.js
> --------------------
>
> Key: SHINDIG-383
> URL: https://issues.apache.org/jira/browse/SHINDIG-383
> Project: Shindig
> Issue Type: Bug
> Components: Features (Javascript)
> Reporter: Brian Eaton
> Attachments: iotests-v2.patch
>
>
> We should have unittests for io.js. I've put together a (very rough) patch for that based on a mocked out XMLHTTPRequest object.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.