Junit test runner docs need examples

Hi, could someone please help me figure out how to use the Run -> Edit Configurations -> : Test Runner Parameters field?

I would like to pass some variables such as database connection information that my tests can use. I cannot seem to find an example anywhere on the internet.

Thanks,

7 comments
Comment actions Permalink

I'm also trying to figure out how to use this field to pass parameters to a test case. Does anyone know how to do this?

0
Comment actions Permalink

I know this thread is old, but it's better to keep all information in one place.

I tried entering a parameter into the field and received this error.

Class not found: "id=261"

It looks like you're supposed to put a class name there ... ?

0
Comment actions Permalink

Hello Connor,

I know this thread is old, but it's better to keep all information in
one place.

I tried entering a parameter into the field and received this error.

Class not found: "id=261"

It looks like you're supposed to put a class name there ... ?


You aren't actually supposed to put anything there, this field is displayed
by mistake. Any values specified in this field are intepreted by IDEA testrunner,
they aren't available to your tests in any way.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Thanks for the information! I'm used to passing parameters through VM arguments, so I'll continue doing that.

For anyone who's interested, enter something like this in VM args.

-Dmyparametername=somevalue

Then, to access the parameter in your code ...

String parameter = System.getParameter("myparametername");

If the parameter is not specified, you'll get null. This has been great on my projects because if a single item in a smoke test fails, we can run that single item as many times as we like.

Edited by: Connor Garvey on Sep 17, 2008 10:05 PM

0
Comment actions Permalink

So, can this field be used to specify which tests to run? For example, I don't want to run anything called *IntegrationTest.java. Thanks!

0
Comment actions Permalink

Small correction to notice:
The method name is System.getProperty("myparametername") and not getParameter("...");

0
Comment actions Permalink

In the cold weather, the UGG boots are considered as the best shoes.More and more people like wearing the UGG boots such as the http://sell-ugg.com/UGG-Classic-Metallic-5812/c9/index.html.With its development ,the UGG boots have lauched different kinds of boots into the fashion market,including the http://uggboots-euro.com/UGG-Classic-Short-Boots/c3/index.html and the http://uggboots-euro.com/UGG-Women%27s-ighkoo/c23/index.html.However,in the fashion world,if you want to be more attractive and elegant,the beautiful shoes are not enough.You have to choose the best stylish handbag to match your shoes.Therefor,the designer replica handbags are very necessary.If you want to buy the best designer cheap handbags,i would like to introduce two famous brand handbags to you.I think there must be one handbag is your favorite.One is the famous brand http://www.famousbrandbag.com/Versace/c40/index.html,the other is the Ferragamo Handbags.Both of them are the famous brand in the world.Their quality are very good.

---
Original message URL: http://www.jetbrains.net/devnet/message/5254890#5254890

0

Please sign in to leave a comment.