1

We are having CI build servers where different JS TestCases are to be executed parallely (asynchronously) on the same instance of JS test driver server. The test cases are independent of each other and should not interfere with each other. Is this possible using JS test driver?

Currently, I have written two test cases, just to check if this is possible:

Test Case 1:

GreeterTest = TestCase("GreeterTest");

GreeterTest.prototype.testGreet = function() {
  var greeter = new myapp.Greeter();
  alert(“just hang in there”);
  assertEquals("Hello World!", greeter.greet("World"));
};

Test Case2:

GreeterTest = TestCase("GreeterTest");

GreeterTest.prototype.testGreet = function() {
   var greeter = new myapp.Greeter();
   assertEquals("Hello World!", greeter.greet("World"));
};

I have added the alert statement in test case 1 to make sure that it hangs there.

I have started the JS test driver server with the following command:

java --jar JsTestDriver-1.3.5.jar --port 9877 --browser <path to browser exe>

I am starting the execution of both the test cases as follows:

java -jar JsTestDriver-1.3.5.jar --tests all --server http://localhost:9877

The Test Case 1 executes and hangs at alert statement. Test Case 2 fails with an exception (BrowserPanicException). The conf file is proper, as the second test case passes if executed by itself.

Is there any configuration changes required to make the second test case pass, while the first test case is still executing?

Prajwal
  • 11
  • 1

1 Answers1

0

This issue is caused by the "app" (the jsTestDriver slave, running the tests) cannot really run them in parallel. This is because it's written in javascript, which is single threaded.
The implementation probably loops all tests and runs them one by one, thus, when an alert pops, the entire "app" is blocked, and cannot even report back to the jsTestDriver server, resulting in a timeout manifested in a BrowserPanicException.
Writing Async Tests won't help since the entire "app" is stuck.

shex
  • 326
  • 5
  • 13