Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(17180)

Issue 7003054: Make tests more reliable.

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 4 months ago by hazmat
Modified:
11 years, 3 months ago
Reviewers:
bac, bcsaller, mp+141197
Visibility:
Public.

Description

Make tests more reliable. - Disable async loading for yui to ensure app code is loaded before tests. - Yank yui loader closures around tests, this is an anti-pattern. - Any test file can be run in isolation now. - Re-order test loading into alphabetical order to detect/correct collisions. - Enable using firefox for tests via test loader fix. - WIP enable using phantomjs for running tests on cli. - Make topology-mega.js more foregiving on its (there's a event subscription leak here.) - Fix event subscription leak in charm-panel code. https://code.launchpad.net/~hazmat/juju-gui/reliable-test/+merge/141197 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+740 lines, -664 lines) Patch
A [revision details] View 1 chunk +2 lines, -0 lines 0 comments Download
M app/app.js View 1 chunk +11 lines, -6 lines 1 comment Download
M app/modules-debug.js View 3 chunks +6 lines, -2 lines 1 comment Download
M app/templates/overview.handlebars View 1 chunk +1 line, -1 line 0 comments Download
M app/views/charm-panel.js View 2 chunks +3 lines, -2 lines 0 comments Download
M app/views/environment.js View 2 chunks +4 lines, -7 lines 0 comments Download
M app/views/topology/mega.js View 2 chunks +6 lines, -2 lines 0 comments Download
M app/views/topology/panzoom.js View 1 chunk +3 lines, -2 lines 1 comment Download
M app/views/utils.js View 1 chunk +2 lines, -0 lines 0 comments Download
M package.json View 1 chunk +2 lines, -1 line 0 comments Download
M test/index.html View 2 chunks +45 lines, -29 lines 3 comments Download
M test/test_app.js View 5 chunks +41 lines, -17 lines 0 comments Download
M test/test_app_hotkeys.js View 2 chunks +47 lines, -45 lines 0 comments Download
M test/test_d3_components.js View 1 chunk +0 lines, -1 line 0 comments Download
M test/test_notifications.js View 1 chunk +469 lines, -454 lines 0 comments Download
M test/test_notifier_widget.js View 1 chunk +98 lines, -95 lines 0 comments Download

Messages

Total messages: 4
hazmat
Please take a look.
11 years, 4 months ago (2012-12-24 03:49:24 UTC) #1
bcsaller
This looks good, and looks like a real improvement, I made some changes below that ...
11 years, 4 months ago (2012-12-24 18:26:11 UTC) #2
bac
These changes look good and should help standardize the way the tests are run. Like ...
11 years, 3 months ago (2013-01-03 13:43:00 UTC) #3
hazmat
11 years, 3 months ago (2013-01-03 13:46:14 UTC) #4
On 2012/12/24 18:26:11, bcsaller wrote:
> This looks good, and looks like a real improvement, I made some changes below
> that I think help as well. 
> 
> Not sure why Y.use around the tests is an anti-pattern. With this style of
> loading it all up front we could almost get away with use('*') which would
bind
> all the modules to the Y object but that gives up something about scoped
> dependencies in the tests. Happy with the improvement.

in practice Y.use around the tests made test loading unreliable. mocha scan
would often complete before the Y.use had finished resulting in no tests founds
for a module.

> 
> https://codereview.appspot.com/7003054/diff/1/test/index.html
> File test/index.html (left):
> 
> https://codereview.appspot.com/7003054/diff/1/test/index.html#oldcode44
> test/index.html:44: <script>
> I changed to a pre-load global config object and added use of the delayUntil
> option. I think this makes this already nice improvement a little nicer.
> 
> === modified file 'test/index.html'
> --- test/index.html	2012-12-24 03:17:11 +0000
> +++ test/index.html	2012-12-24 18:21:50 +0000
> @@ -53,29 +53,29 @@
>  
>  
>    <script>
> -  YUI({'async': false}).use('node', 'event', function(Y) {
> -     Y.on('domready', function() {
> -
> -     var config = GlobalConfig;
> -
> -     config.async = false;
> -     config.consoleEnabled = true;
> -
> -     for (group in config.groups) {
> +  YUI_config = {
> +      async: false,
> +      consoleEnabled: true,
> +      delayUntil: 'domready'
> +  };
> +
> +  YUI().use(['node', 'event'], function(Y) {
> +      var config = GlobalConfig;
> +
> +      for (group in config.groups) {
>            var group = config.groups[group];
> -         for (m in group.modules) {
> -            var resource = group.modules[m];
> -            if (!m || !resource.fullpath) {
> -              continue
> -            }
> -            resource.fullpath = resource.fullpath.replace(
> -              '/juju-ui/', '../juju-ui/');
> -         }
> -     }
> -     // Run the tests.
> -     if (window.mochaPhantomJS) { mochaPhantomJS.run(); }
> -     else { mocha.run(); }
> -     });
> +          for (m in group.modules) {
> +              var resource = group.modules[m];
> +              if (!m || !resource.fullpath) {
> +                  continue
> +              }
> +              resource.fullpath = resource.fullpath.replace(
> +                  '/juju-ui/', '../juju-ui/');
> +          }
> +      }
> +      // Run the tests.
> +      if (window.mochaPhantomJS) { mochaPhantomJS.run(); }
> +      else { mocha.run(); }
>    });
>    </script>


looks nice, thanks. i'll give it a shot.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b