Running multiple specs using jasmine and jstestdriver

I wrote several specification files for unit testing various modules on a web page. If I run them individually, one at a time they work fine. But when I try to run all the files in the sequence, only the first file in the spec folder works, while all other tests fail. Any help would be appreciated.

Each specification file loads a static page using requirejs and displays them on the page. When the page is displayed, I check the title, text, etc. Specification files are as follows. AboutSpec.js →

require(["views/About", "nls/messages"], function (About, messages) { beforeEach(function(){ var temp = new About(); temp.render(); }); describe("Test for About Page", function () { it("Check For About Title", function () { var aboutTitleText = $('.eight.columns h2').text(); expect(aboutTitleText).toEqual(messages["about_title"]); }); }); }); 

FooterSpec.js →

 require(["views/Footer", "nls/messages"], function (Footer, messages) { beforeEach(function(){ var temp = new Footer(); temp.render(); }); describe("Test for Footer Page", function () { it("Check For Footer Content", function () { var footerText = $('.five.columns h2').text(); expect(footerText).toEqual(messages["footer_content"]); }); }); }); 

jstestDriver.conf →

  load: - jasmine/lib/jasmine-1.3.1/jasmine.js - jasmine/lib/adapter/JasmineAdapter.js - js-src/javaScript/require.js - js-src/javaScript/default.js test: - js-test/AboutSpec.js - js-test/FooterSpec.js 

When I started this setup, the About page does not display. Only the footer page is displayed, which causes all test cases about the page to appear.

+4
source share
1 answer

We faced the same problem, and I spent - how many hours, now? Oh yes, too much! - trying to solve this problem.

Today I discovered Karma , a JsTD replacement from Google that runs every test in a new iframe. It also integrates with Jenkins. I am now in the installation process, and report on how this happened.

+1
source

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


All Articles