Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are test cases in Jasmine 2.0 run in parallel

Tags:

jasmine

Are tests in Jasmine 2.0 run in parallel? In my experience they aren't but the article , referenced by Jasmine.js: Race Conditions when using "runs" suggests that Jasmine does run them in parallel so I wondered if I was writing my tests incorrectly.

Here is a set of tests that I would expect to execute in 1 second instead of 4 seconds.

describe("first suite", function() {
  it("first test", function(done) {
    expect(true).toBeTruthy();
    setTimeout(done, 1000);
  });

  it("second test", function(done) {
    expect(true).toBeTruthy();
    setTimeout(done, 1000);
  });
});

describe("second suite", function() {
  it("first test", function(done) {
    expect(true).toBeTruthy();
    setTimeout(done, 1000);
  });

  it("second test", function(done) {
    expect(true).toBeTruthy();
    setTimeout(done, 1000);
  });
});

Am I missing something?

jsFiddle

like image 532
Spig Avatar asked Sep 03 '14 20:09

Spig


People also ask

How can you run your test cases in parallel?

TestNG helps to run test methods/classes/tests in parallel. Using the testng. xml file, one can specify parallel attributes to classes, tests, and methods. Java's multi-thread feature can also be applied by defining the number of threads for parallel testing in the thread attribute.

How do you run a single test case in Jasmine?

You can use fit() or fdescribe() instead of it() and fdescribe() to achieve what is known as focussed test cases. describe("test spec", function() { it("test case 1", function() { }); fit("test case 2", function() { }); });

Are Go tests run in parallel?

The 'go test' command may run tests for different packages in parallel as well, according to the setting of the -p flag (see 'go help build'). Allow parallel execution of test functions that call t. Parallel . The value of this flag is the maximum number of tests to run simultaneously.

How many tests will run at a time in parallel execution?

What is Parallel Testing? Parallel testing means running multiple automated tests simultaneously to shorten the overall start-to-end runtime of a test suite. For example, if 10 tests take a total of 10 minutes to run, then 2 parallel processes could execute 5 tests each and cut the total runtime down to 5 minutes.


1 Answers

Jasmine does not actually run your specs in parallel in any way. It is however possible to have specs whose asynchronous portion takes long enough that the built-in time limit elapses which will cause jasmine to start running the next spec, even though there may still be code running from earlier specs.

like image 63
Gregg Avatar answered Oct 11 '22 07:10

Gregg