Integration tests are super slow


#1

Hi there !

I just started to automate my tests and I find that QUnit is taking too much time to run the tests (~10sec / test).

Is it normal ?

If not, do somebody have tips to increase the speed of QUnit ?

EDIT : It’s like the andThen clause is called after a timeout of 10 sec, even thought the route resolved and worked (the tests are green)

Here’s a sample of my tests

module('Supplements Controller', {
    beforeEach: function() {
        visit('/settings/supplements');
    },
    afterEach: function() {
        App.reset();
    }
});

test('first test', function() {
    andThen(function() {
        equal(find('tr').length, 6, '6 rows');
    });
});

test('Adding a supplement', function() {
    click('a.wm-title-btn');
    fillIn('input', 'new supplement');
    click('button.btn-success');

    andThen(function() {
        equal(find('tr').length, 7, '7 rows');
    });
});

#2

Can you try moving the visit call into the tests, rather than setup? Also, is that endpoint hitting any external services?


#3

Not really sure about the 10second delay, but you should put expect(1) at the top of each test.


#4

The app doesn’t access any external services (I’m using Fixtures for hte tests).

I tried your 2 suggestions and I still get the 10 seconds delay.

I see in my test-div that the route is visited in no time, but the test still wait of the andThen clause. From what I’m seeing, it’s like the visit() couldn’t say it actually resolved, instead, it wait the the generic 10 seconds timeout.

I’ll continue to dig arround. thanks !


#5

Any update on this. Our tests are also dog slow. Not only that but they are cumulatively slow (gets slower the more integrations test are ran). PS we use pretender for our network mocking.


#6

Not sure if this helps you guys, but we just had the same problem. Our solution was twofold:

First, we had some tests that were from generators whose source classes had been deleted. So we had e.g. foo-component-test…when Ember ran the test, it tried to create a foo-component prior to the test (to set this.subject()), but failed. Each test that failed to create an object like that hung for about a minute before timing out and moving on. With 15 or so stale tests that quickly added up.

Second, we had a test that had a typo in its moduleForComponent call. It also hung for a minute, failing to create the component.


#7

Perhaps a bit late to enter the conversation, but I am developing an ember app on cloud9 hence the development server is remote. Disabling the live-reload server massively increased the speed of my tests in the browser.