English 中文(简体)
当Im使用Js 试验驾驶员时,我用超文本固定装置在哪里?
原标题:Where do I put HTML fixtures when I m using JsTestDriver?

I m 很难用时间来装载固定装置的超文本文档。

我的名录结构是:

 localhost/JsTestDriver.conf
 localhost/JsTestDriver.jar
 localhost/js/App.js
 localhost/js/App.test.js
 localhost/fixtures/index.html

我的议事文件说:

server: http://localhost:4224

serve:

- fixtures/*.html

load: 

- http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js
- jasmine/lib/jasmine-1.1.0/jasmine.js
- jasmine/jasmine-jquery-1.3.1.js
- jasmine/jasmine-jstd.js
- js/App.js

test: 

- js/App.test.js

我的考验是:

describe("App", function(){

    beforeEach(function(){
        jasmine.getFixtures().fixturesPath =  fixtures ;
        装饰(指数.html); **//THIS LINE CAUSES IT TO FAIL**
    });

    describe("When App is loaded", function(){

        it( should have a window object , function(){
            expect(window).not.toBe(null);
        });

    });

});

我的ole果是:

“enter

(link to full-sizegram)

。 问题,但我看不到。 顺便说一句,当我发表评论时,我们就不 thing。

装饰(指数.html);

通行证。

任何想法?

最佳回答

奥凯——数字不详。 Js 试验驾驶员将“测试”预留给你处理。

另外,麻风树也使用一种麻风树。

因此,这些步骤最终对我有利:

在js 试验驾驶员中:

serve:
 - trunk/wwwroot/fixtures/*.html

load:

  - trunk/wwwroot/js/libs/jquery-1.7.1.min.js 
  - jstd/jasmine/standalone-1.2.0/lib/jasmine-1.2.0/jasmine.js
  - jstd/jasmine-jstd-adapter/src/JasmineAdapter.js
  - jstd/jasmine-jquery/lib/jasmine-jquery.js

  - trunk/wwwroot/js/main.js

test:

  - trunk/wwwroot/js/main.test.js

在我的测试档案中:

describe("main", function(){

    beforeEach(function(){
        jasmine.getFixtures().fixturesPath =  /test/trunk/wwwroot/fixtures ;
        jasmine.getFixtures().load( main.html );
    });

    describe("when main.js is loaded", function(){

        it( should have a div , function(){
            expect($( div ).length).toBe(1); 
        });

    });

});

注:前使用绝对的URL代替超文本固定装置。

问题回答

改变固定道路,以便:

jasmine.getFixtures().fixturesPath =  /fixtures ;

我有不同的错误,但也有类似的错误。





相关问题
jsTestDriver + Nant = test directory issue

I am working on a project where the Javascript is becoming more complex, and needs to be tested as part of our automated build. Now I have got a project structure like shown below: - root |- build....

Why would false not be defined in jasmine?

I m using jasmine in conjunction to Js-test-driver using an adapter to connect them both. I ve got the following test case: describe("Undefined false", function(){ beforeEach(function(){ ...

Considerations before doing test driven development

I m starting to use test driven development for JavaScript, but I would like to start using it in my different projects. I would like to know what are the typical mistakes and how to avoid them? ...

Javascript Unit Testing with Javascript-Test-Driver

Recently a new framework for Javascript unit testing has been released. HERE Can anyone points me to some sample examples which I can look at to? This seems to be an excellent framework; considering ...

热门标签