Last Comment Bug 384502 - ability to start runtests.pl in a certain directory
: ability to start runtests.pl in a certain directory
Status: RESOLVED FIXED
:
Product: Testing
Classification: Components
Component: Mochitest (show other bugs)
: Trunk
: All All
: -- enhancement (vote)
: ---
Assigned To: Myk Melez [:myk] [@mykmelez]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-14 16:18 PDT by Myk Melez [:myk] [@mykmelez]
Modified: 2008-12-13 14:43 PST (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
patch v1: implements feature (3.23 KB, patch)
2007-06-14 16:18 PDT, Myk Melez [:myk] [@mykmelez]
sayrer: review+
Details | Diff | Review

Description Myk Melez [:myk] [@mykmelez] 2007-06-14 16:18:17 PDT
Created attachment 268434 [details] [diff] [review]
patch v1: implements feature

Right now the instructions in the MochiTest FAQ on devmo say that to run one test you should "skip the --autorun argument, and then click on the test you want to run."  But finding the test in the list every time you want to run it can be painful, especially if you're doing it over and over again as you develop a set of tests.

It should be possible to specify a test path (either to a specific test or to a directory of them) on the command line and go directly to that path when the application starts.  Here's a patch that does this.

Besides adding the command-line parameter, I also fixed what I think is a bug in server.js where it appends a slash to a directory name if necessary but then appends a child filename to the slashless version.  This makes it possible to specify --test-path=foo/bar (<-- no slash at the end), where bar is a directory containing tests, and have the links on the page of tests still work.
Comment 1 Jeff Walden [:Waldo] (remove +bmo to email) 2007-06-14 16:47:23 PDT
(In reply to comment #0)
> Besides adding the command-line parameter, I also fixed what I think is a bug
> in server.js where it appends a slash to a directory name if necessary but then
> appends a child filename to the slashless version.  This makes it possible to
> specify --test-path=foo/bar (<-- no slash at the end), where bar is a directory
> containing tests, and have the links on the page of tests still work.

That's a nice hackaround in the index generator to make the links work, but it's more a bug in the server that for /foo it serves the same content as for /foo/; the server really should respond with a redirect to /foo/ instead.  One of these days I'll get around to fixing it.
Comment 2 Myk Melez [:myk] [@mykmelez] 2007-06-15 00:13:15 PDT
Checked in to trunk:

Checking in runtests.pl.in;
/cvsroot/mozilla/testing/mochitest/runtests.pl.in,v  <--  runtests.pl.in
new revision: 1.20; previous revision: 1.19
done
Checking in server.js;
/cvsroot/mozilla/testing/mochitest/server.js,v  <--  server.js
new revision: 1.9; previous revision: 1.8
done

I also updated the MochiTest FAQ entry "How do I run just one test?" with info on using the new command line flag to run a single test or a group of tests:

http://developer.mozilla.org/en/docs/Mochitest#How_do_I_run_just_one_test_or_group_of_tests.3F

Note You need to log in before you can comment on or make changes to this bug.