Show More
@@ -3,9 +3,9 b'' | |||||
3 | // |
|
3 | // | |
4 | casper.get_notebook_server = function () { |
|
4 | casper.get_notebook_server = function () { | |
5 | // Get the URL of a notebook server on which to run tests. |
|
5 | // Get the URL of a notebook server on which to run tests. | |
6 | port = casper.cli.get("port"); |
|
6 | var port = casper.cli.get("port"); | |
7 | port = (typeof port === 'undefined') ? '8888' : port; |
|
7 | port = (typeof port === 'undefined') ? '8888' : port; | |
8 | return 'http://127.0.0.1:' + port; |
|
8 | return casper.cli.get("url") || 'http://127.0.0.1:' + port; | |
9 | }; |
|
9 | }; | |
10 |
|
10 | |||
11 | casper.open_new_notebook = function () { |
|
11 | casper.open_new_notebook = function () { |
@@ -220,16 +220,18 b' def all_js_groups():' | |||||
220 |
|
220 | |||
221 | class JSController(TestController): |
|
221 | class JSController(TestController): | |
222 | """Run CasperJS tests """ |
|
222 | """Run CasperJS tests """ | |
|
223 | ||||
223 | requirements = ['zmq', 'tornado', 'jinja2', 'casperjs', 'sqlite3', |
|
224 | requirements = ['zmq', 'tornado', 'jinja2', 'casperjs', 'sqlite3', | |
224 | 'jsonschema'] |
|
225 | 'jsonschema'] | |
225 | display_slimer_output = False |
|
226 | display_slimer_output = False | |
226 |
|
227 | |||
227 | def __init__(self, section, xunit=True, engine='phantomjs'): |
|
228 | def __init__(self, section, xunit=True, engine='phantomjs', url=None): | |
228 | """Create new test runner.""" |
|
229 | """Create new test runner.""" | |
229 | TestController.__init__(self) |
|
230 | TestController.__init__(self) | |
230 | self.engine = engine |
|
231 | self.engine = engine | |
231 | self.section = section |
|
232 | self.section = section | |
232 | self.xunit = xunit |
|
233 | self.xunit = xunit | |
|
234 | self.url = url | |||
233 | self.slimer_failure = re.compile('^FAIL.*', flags=re.MULTILINE) |
|
235 | self.slimer_failure = re.compile('^FAIL.*', flags=re.MULTILINE) | |
234 | js_test_dir = get_js_test_dir() |
|
236 | js_test_dir = get_js_test_dir() | |
235 | includes = '--includes=' + os.path.join(js_test_dir,'util.js') |
|
237 | includes = '--includes=' + os.path.join(js_test_dir,'util.js') | |
@@ -247,14 +249,18 b' class JSController(TestController):' | |||||
247 | if self.xunit: |
|
249 | if self.xunit: | |
248 | self.add_xunit() |
|
250 | self.add_xunit() | |
249 |
|
251 | |||
250 | # start the ipython notebook, so we get the port number |
|
252 | # If a url was specified, use that for the testing. | |
251 | self.server_port = 0 |
|
253 | if self.url: | |
252 | self._init_server() |
|
254 | self.cmd.append("--url=%s" % self.url) | |
253 | if self.server_port: |
|
|||
254 | self.cmd.append("--port=%i" % self.server_port) |
|
|||
255 | else: |
|
255 | else: | |
256 | # don't launch tests if the server didn't start |
|
256 | # start the ipython notebook, so we get the port number | |
257 | self.cmd = [sys.executable, '-c', 'raise SystemExit(1)'] |
|
257 | self.server_port = 0 | |
|
258 | self._init_server() | |||
|
259 | if self.server_port: | |||
|
260 | self.cmd.append("--port=%i" % self.server_port) | |||
|
261 | else: | |||
|
262 | # don't launch tests if the server didn't start | |||
|
263 | self.cmd = [sys.executable, '-c', 'raise SystemExit(1)'] | |||
258 |
|
264 | |||
259 | def add_xunit(self): |
|
265 | def add_xunit(self): | |
260 | xunit_file = os.path.abspath(self.section.replace('/','.') + '.xunit.xml') |
|
266 | xunit_file = os.path.abspath(self.section.replace('/','.') + '.xunit.xml') | |
@@ -401,7 +407,7 b' def prepare_controllers(options):' | |||||
401 | js_testgroups = all_js_groups() |
|
407 | js_testgroups = all_js_groups() | |
402 |
|
408 | |||
403 | engine = 'slimerjs' if options.slimerjs else 'phantomjs' |
|
409 | engine = 'slimerjs' if options.slimerjs else 'phantomjs' | |
404 | c_js = [JSController(name, xunit=options.xunit, engine=engine) for name in js_testgroups] |
|
410 | c_js = [JSController(name, xunit=options.xunit, engine=engine, url=options.url) for name in js_testgroups] | |
405 | c_py = [PyTestController(name, options) for name in py_testgroups] |
|
411 | c_py = [PyTestController(name, options) for name in py_testgroups] | |
406 |
|
412 | |||
407 | controllers = c_py + c_js |
|
413 | controllers = c_py + c_js | |
@@ -509,6 +515,9 b' def run_iptestall(options):' | |||||
509 | slimerjs : bool |
|
515 | slimerjs : bool | |
510 | Use slimerjs if it's installed instead of phantomjs for casperjs tests. |
|
516 | Use slimerjs if it's installed instead of phantomjs for casperjs tests. | |
511 |
|
517 | |||
|
518 | url : unicode | |||
|
519 | Address:port to use when running the JS tests. | |||
|
520 | ||||
512 | xunit : bool |
|
521 | xunit : bool | |
513 | Produce Xunit XML output. This is written to multiple foo.xunit.xml files. |
|
522 | Produce Xunit XML output. This is written to multiple foo.xunit.xml files. | |
514 |
|
523 | |||
@@ -637,6 +646,8 b" argparser.add_argument('--all', action='store_true'," | |||||
637 | help='Include slow tests not run by default.') |
|
646 | help='Include slow tests not run by default.') | |
638 | argparser.add_argument('--slimerjs', action='store_true', |
|
647 | argparser.add_argument('--slimerjs', action='store_true', | |
639 | help="Use slimerjs if it's installed instead of phantomjs for casperjs tests.") |
|
648 | help="Use slimerjs if it's installed instead of phantomjs for casperjs tests.") | |
|
649 | argparser.add_argument('--url', const=None, default='', type=unicode, | |||
|
650 | help="URL to use for the JS tests.") | |||
640 | argparser.add_argument('-j', '--fast', nargs='?', const=None, default=1, type=int, |
|
651 | argparser.add_argument('-j', '--fast', nargs='?', const=None, default=1, type=int, | |
641 | help='Run test sections in parallel. This starts as many ' |
|
652 | help='Run test sections in parallel. This starts as many ' | |
642 | 'processes as you have cores, or you can specify a number.') |
|
653 | 'processes as you have cores, or you can specify a number.') |
General Comments 0
You need to be logged in to leave comments.
Login now