My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
ConfigurationFile  
Configuration file for test runner.
Updated Oct 25, 2011 by corbinrs...@gmail.com

Introduction

Configuration file is written in YAML and is used to tell the test runner which files to load to browser and in which order. By default the JsTestDriver looks for the configuration file in the current directory and with the name jsTestDriver.conf. You can use --config command line option to specify a different file.

Example:

server: http://localhost:4224

load:
  - src/*.js

test:
  - src-test/*.js

exclude:
 - uselessfile.js

serve:
 - css/main.css

proxy:
 - {matcher: "*", server: "http://localhost/whatever"}

plugin:
 - name: "coverage"
   jar: "lib/jstestdriver/coverage.jar"
   module: "com.google.jstestdriver.coverage.CoverageModule"

timeout: 90

server:

Specifies the default location of the server. This value can be overridden with a command line option --server. See CommandLineFlags.

load:

List of files to load to browser before the test can be run. We support globing with *. The files are loaded in the same order as specified in the configuration file or alphabetically if using globing.

You can declare external scripts by adding the http address of the script as a loadedable item.

test:

A list of test sources to run.

exclude:

Never load this file. Used in conjunction with globing and load. Useful saying load everything except these files.

serve:

Load static files (images, css, html) so that they can be accessed on the same domain as jstd.

proxy:

Set jstd to behave as proxy. See proxy.

plugin:

Load jstd plugin. See plugins.

timeout:

Timeout in seconds.

Comment by tomasz.c...@gmail.com, Dec 17, 2009

Is there a way to load an external scripts ?

Comment by fcamel@gmail.com, Apr 13, 2010

Can it load files in "../x/"? Thanks.

Comment by halle...@gmail.com, Jul 9, 2010

From what I can see the web server component does not support paths with "../". But it looks like you can pass a --basePath option when running the jar to load files relative to a parent directory.

Comment by charlie...@gmail.com, Aug 2, 2010

Is there a way to include and exclue files recursively?

E.g.:

load:

- src/

exclude:

- .svn

Comment by didkobr...@gmail.com, Dec 22, 2010

how can I load jsp files containing javascript in script tags?

Comment by eric...@gmail.com, Mar 18, 2011

Is there a recommended way to integrate JsTestDriver? with Closure Library? First, it's a pain to depend on each Closure directory (or even each directory of my own source). Second, I have to order the dependencies properly.

Comment by sharif.m...@gmail.com, Jun 6, 2011

How exactly does the serve directive work? I've added the it as detailed above but none of the css is ever applied.

Comment by stevelto...@gmail.com, Jun 8, 2011

I have managed to install and apply some tests in jsTestDriver on eclipse, but there is a very unusual flaw in the output. It displays all the tests in a jumbled order that the tests were created? For example: If I write:

TestCase('Hello World 123',{

,"test - Hello":function(){assertEquals('Hello','Hello');} ,"test - World":function(){assertEquals('World','World');} ,"test - 1":function(){assertEquals('1','1');} ,"test - 2":function(){assertEquals('2','2');} ,"test - 3":function(){assertEquals('3','3');}
});

Then the output is:

Hello World 123

test - World test - 1 test - Hello test - 2 test - 3

Can I change the order of the display with the conf file?

Comment by johnanth...@gmail.com, Sep 20, 2011

serve files can be called at runtime with the prefix:

/test/

Comment by toby.d...@tagman.com, Nov 3, 2011

is there a way of passing config info that the test can pick up such as an environment variable. would be helpful in some cases to have the test perform conditional behaviour based on it rather than having separate test configs.

Comment by pvank...@gmail.com, Jan 31, 2012

Note that you cannot use https:// in the load section.

load:

- src/main/webapp/js/.js - https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js <-- Won't work - http://github.com/janl/mustache.js/raw/master/mustache.js <-- Works fine

It resolves this as /test/https://ajax.googleapis.etc

I'm not sure if that should be a feature or not. It's available as http:// so in this case an easy workaround.

Comment by aggieb...@gmail.com, Jan 31, 2012

Is there a way to use a variable for the server value? That way I can set the server in one file and for multiple configs use the variable to easily update it. Instead of changing loads of config files to the new server.

Also, it states that I can use --port to override the config file. But when my command line port value is different from the config file it shoots out an error that cannot be resolved without having both the config file and command line port argument be the vale value.

Comment by smfoote, Mar 9, 2012

I'm using the serve directive to mock an AJAX call:

serve:
  - data.html

In my test code I make a GET request for 'data.html'. I'm getting a 200 repsonse, but the body of the response is empty. How do I get my data?


Sign in to add a comment
Powered by Google Project Hosting