Here are some tantalizing hints. I'll look at this tomorrow if someone hasn't beaten me to it, but there are better things I can be doing late Friday night than messing around with stupid tests <G>.

From : http://junit.sourceforge.net/doc/cookbook/cookbook.htm

Once you have tests, you'll want to run them. JUnit provides tools to define the suite to be run and to display its results. To run tests and see the results on the console, run this from a Java program:

org.junit.runner.JUnitCore.runClasses(TestClass1.class, ...);
or this from the command line, with both your test class and junit on the classpath:
java org.junit.runner.JUnitCore TestClass1.class [...other test classes...]
From: http://kentbeck.github.com/junit/javadoc/4.7/index.html
See JunitCore and Request, especially Request.method.

From: http://old.nabble.com/How-to-run-individual-test-case-within-a-test-class-from-command-line%28JUnit-4.x%29-td20003338.html

new JUnitCore.run(Request.method(class, methodName));

I think the still-remaining clumsy part of this is specifying the test class file in the classpath. I can imagine that this could be part of a shell script, but is it worth the effort if things run from the IDE? Alternatively, a small Java program taking two arguments might do the trick. But as I said, it's late and even sleeping would be better than this <G>.....

Siiiiggghhh. Manning has a MEAP for JUnit In Action (herinafter JUIA) that covers up through Junit 4.5. Anybody dare me to spring for the $30 and see what wisdom is in there? I'm frustrated enough with the sparse documentation that it sure seems worth it....

Erick

P.S. no Double-Dog-Dares allowed.....

On Fri, Feb 26, 2010 at 6:14 PM, Yonik Seeley <yonik@lucidimagination.com> wrote:
On Fri, Feb 26, 2010 at 3:31 PM, Jason Rutherglen
>> I've never tried to learn a command-line invocation of a test
>> case for a single test method, I've always just used the IDE
>> to run individual methods....
>
> Right, I've been doing bunches of Solr dev which for me only works
> from the command line... I'm open to suggestions though!

Should work from the IDE provided you've set the working directory to
src/test/test-files
But I'd love a way to run a single method from the command line too.

-Yonik
http://www.lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org