简体   繁体   中英

How to specify a relative path for the jsUnit-ant-script?

JsUnit provides an ant-script with the target 'standalone_test'. This target uses the property url to identify the HTML-site, that executes the tests. These site is checked in, so that everyone should be able after a checkout to execute this tests. This works, but the url-proprty must be set to an absolute path, like file:///home/user/projects/my-project/path/in/project/jsunit/testRunner.html . That avoids an automatic start, everyone have too specify a command with the path constructed on his box. Is it possible to pass a relative path/url instead, so that the execution of these tests can be automated? This would be helpful to setup these test in our continuous-integration-system.

You could construct the url property value using the built-in Ant basedir property .

For example, if your build script is located in and run from your /home/user/projects/my-projects directory you could set your url property as:

<property
    id="url"
    name="url"
    value="file://${basedir}/path/in/project/jsunit/testRunner.html"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM