Подтвердить что ты не робот

JsTestDriver на NetBeans прекращает тестирование после неудачного утверждения

Я настроил модульное тестирование JavaScript с помощью JS Test Driver для Netbeans согласно этой ссылке. Однако, в отличие от результатов этого учебника, после проверки не выполняется больше тестов. Как я могу изменить это поведение?

Например, для данного тестового файла:

Файл test.js:

AssertionsTestCase = TestCase("AssertionsTestCase");

AssertionsTestCase.prototype.testAlwaysPass = function(){
  assertEquals(1, 1);
  assertEquals(2, 2);
};
AssertionsTestCase.prototype.testAlwaysFail1 = function(){
  assertEquals(1, 2);
};
AssertionsTestCase.prototype.testAlwaysFail2 = function(){
  assertEquals(3, 4);
};

индикатор выполнения показывает 50%, (2 теста), это должно сказать 33%.

enter image description here

Файл jsTestDriver.conf:

server: http://localhost:42442
load:
  - test/lib/jasmine/jasmine.js
  - test/lib/jasmine-jstd-adapter/JasmineAdapter.js
  - test/unit/*.js

Я могу запустить все тесты из командной строки. (В Windows PowerShell). При выполнении следующих тестов тесты не прекращаются после сбоя:


java -jar $env:JSTD\JsTestDriver-1.3.5.jar --tests all --config jsTestDriver.conf

файл jsTestDriver.conf:

server: http://localhost:4244
load:
  - test/lib/jasmine/jasmine.js
  - test/lib/jasmine-jstd-adapter/JasmineAdapter.js
  - test/unit/*.js

Все три теста запущены.

4b9b3361

Ответ 1

Perform the following steps to create the HTML 5 sample application from a site template. 
Choose File > New Project (Ctrl-Shift-N, Shift-N on Mac) in the main menu to open the New Project wizard.
Expand the Samples node in the New Project wizard and select the HTML 5 category.
Select the Angular JS Phone Catalog Tutorial project. Click Next.
screenshot of Sample project in New File wizard
Specify a location for the project. Click Finish.
 Note that the URL of the template is github. The IDE needs to be able to access the network to retrieve the template archive. Check your proxy settings in the Options window if you encounter problems downloading the archive.
 When you click Finish the IDE creates the project and opens the index.html file in the editor. In the Projects window you can see that the project contains index.html and various CSS style sheets and JavaScript files and libraries.
screenshot of project nodes in Projects window. The project also includes several JavaScript unit test and configuration files that were generated by default.
Confirm that Chrome with Net Beans Connector is selected in the drop down list in the toolbar.
screenshot of drop down list in toolbar
Click the Run button in the toolbar (F6) or right-click the project node in the Projects window and choose Run.
When you Run the project the front page of the HTML 5 application opens in the Chrome browser and you can see a list of mobile phones. When you click the name of a mobile phone the page displays the phone details.

Ответ 2

Кажется, что в Chrome работает отлично. введите описание изображения здесь

Что касается Firefox, как в комментарии, то это неправильный ответ. Мне удалось заставить его работать частично. Проблема в том, как netbeans обрабатывают неудачные тесты и как запускается jstestdriver.jar. Я знаю, что это не решает проблему, но указывает на правильное направление.

введите описание изображения здесь

Шаги, чтобы воспроизвести это.

  • Запустите тестовый драйвер JS из служб
  • Запустить тест.
  • Так как я использую linux. Я нашел jstestdriver.properties из папки конфигурации Netbeans для текущего пользователя. В моем случае он находится в

    /home/{user}/.netbeans/8.2/config/Preferences/org/netbeans/modules/javascript/jstestdriver.properties

    Измените свойство location, добавив аргументы в jstestdriver.jar - все тесты - reset. После редактирования мои свойства выглядят следующим образом.

    location=/home/user/Downloads/jstestdriver-1.3.5.jar --tests all --reset server.url=http://localhost:42442 strict.mode=false use.browser.ANDROID_DEVICE_CHROME=false use.browser.ANDROID_DEVICE_DEFAULT=false use.browser.ANDROID_EMULATOR_DEFAULT=false use.browser.Chrome=false use.browser.Chrome.INTEGRATED=false use.browser.SL__Browsers_FirefoxBrowser=true use.browser.SL__Browsers_MozillaBrowser=false

  • Повторите 2 раза.

    • Перезапустите JS Test Driver из служб.
    • Запустить тест.

После второго перезапуска и запуска он должен запустить все тесты, как показано на рисунке выше. Если вы можете добавить аргументы --tests all - reset для JS Test Driver в Netbeans, он должен решить проблему, как в Chrome.