English 中文(简体)
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.xml
|- tools
    |- js-test-driver
        |- js-test-driver.js
        |- js-test-driver.conf
|- src
    |- code
        |- projectname.web
            |- assets
                |- javascript
                    |- my-javascript-files.js
    |- tests
        |- projectname.javascript
            |- my-javascript-tests.js

In my Nant build I kick off Java using then pass it the js-test-driver.js file, with the arguments to use the config file provided. Now I noticed that when I was running it that its config file paths seem to be relative to the js-test-driver directory, not the project root directory.

I didnt think this was an issue, and just put the following in my config file:

server: http://localhost:9876

load:
  - ../../src/code/projectname.web/assets/javascript/*.js
  - ../../src/tests/projectname.javascript/*.js

Now if I run my task in Nant, it starts up the test driver (in Firefox currently) fine but just fails, saying that it cannot find any tests to run, but the thing which I find confusing is that it lists the test directory as:

tests/../../src/tests/projectname.javascript/*.js

And I cannot for the life of me figure out why it is putting this "tests/" before everything... If i put ../../../ in to negate this seemingly hardcoded tests dir, it tells me that the path is not in a valid pattern.

Anyone else had anything similar or know where I am going wrong?

最佳回答

The "tests" folder is always prepended, it s just where jsTestDriver serves its files from. To quote Cory Smith from the jsTestDriver team:

All resources associated with the test run are served off /test. All static runner resources are served off /static

JsTestDriver-1.3.2 has problems with relative paths. The issue has already been discussed and filed as an issue.

Did you try setting the basepath in js-test-driver.conf. It s fairly new and not yet documented, not sure how it s affected by the relative path problems.

basepath: /root/src
问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签