Configure and disable Jstestdriver

Does anyone know the syntax for setUp and tearDown functions for JsTestdriver? They claim on their website that they can identify it, but I cannot figure it out.

Thanks.

+3
source share
1 answer

I download the code and rake for "setUp" and find the following:

javascript/TestCaseBuilder.js:  if (typeof testCaseClass.prototype.setUp == 'undefined') {
javascript/TestCaseBuilder.js:    testCaseClass.prototype.setUp = function() {};
javascript/plugins/TestRunnerPlugin.js:    if (testCaseInstance.setUp) {
javascript/plugins/TestRunnerPlugin.js:      testCaseInstance.setUp();

And similar for "tearDown":

javascript/TestCaseBuilder.js:  if (typeof testCaseClass.prototype.tearDown == 'undefined') {
javascript/TestCaseBuilder.js:    testCaseClass.prototype.tearDown = function() {};
javascript/plugins/TestRunnerPlugin.js:      if (testCaseInstance.tearDown) {
javascript/plugins/TestRunnerPlugin.js:        testCaseInstance.tearDown();

Thus, it seems that the setUp and tearDown functions are defined just like any other test function, except that their name is "setUp" and "tearDown". Their example:

GreeterTest = TestCase("GreeterTest");

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

, js- , 'prototype' ( javascript), YUI vids

, setUp tearDown, , , , .

, setUp, tearDown .

, Selenium ( )

+4

Source: https://habr.com/ru/post/1724696/


All Articles