Question

I am developing an application based on TDD.

For the server-side everything is fine as Python test runner are great.

For JS, I start using mocha which is also great.

I have wrote my first tests with Karma and Angular Scenario Runner and it also great.

The problem is that soon after starting to use Angular Scenario Runner in real life I ended up with 60 e2s tests. Running all tests takes 1 minute.

Now, when I write a new test, each time I want to check the test, I will have to wait up to 60 seconds.

In Mocka there is this option to running only a specific test with .only http://visionmedia.github.io/mocha/#exclusive-tests


It looks like Angular Scenario Runner is briefly documented, but somehow mimics Jasmine.


Looking at Angular Scenario Runner code I could only find the xit definition, for skipping a test.

Is there a trick to ask Angular Scenario Runner to only run a subset of the test?

I have implemented an xdescribe blank method to skip a whole suite... but this is feasible for the long term.

Many thanks!

Was it helpful?

Solution

Yes, you can run a subset of tests.

Use iit instead of it on the tests you would like to run and the others will be skipped.

Example:

describe('TestCtrl', function() {

    var $scope;

    iit('should have scope', function() {
        expect($scope).toBeDefined();
    });

    it('should have scope', function() {
        expect($scope).toBeDefined();
    });

    it('should have scope', function() {
        expect($scope).toBeDefined();
    });

});

This will cause only the first test to be run and the others to be skipped.

As soon as Jasmine detects a test with iit, it will skip the all tests with it.

This is very handy if you need to test only one or two tests you are working on when you have defined a whole suite of tests.

This also works when you replace describe with ddescribe to run only blocks with ddescribe.

As soon as you remove all iit and ddescribe calls, all tests will be run again.

Hope that helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top