We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

tool for running unit test in a loop

bhomass
bhomass asked
on
Medium Priority
479 Views
Last Modified: 2012-05-11
to find an intermittent but, it is helpful to run unit tests in a loop. is there a public domain tool available which allows you to run unit tests in a controlled loop? is there any way to get eclipse to do this?
Comment
Watch Question

Awarded 2011
Awarded 2011

Commented:


Maybe you could find something here:
http://www.javasmile.com/data/testing-tools.html

In general, you can run tests as any java applications, so you can make a loop
within application itself, waiting in Thread.sleep way for some time
in between or you can use any operating system scheduler and start
them as java application or you can probably even wrap them as say service in
Windows environment. I don't see why it is different form othe java apps.

Commented:
why not use junit.framework.TestSuite ?

Author

Commented:
looking for tools used by testers, without programming support
Awarded 2011
Awarded 2011

Commented:
windows scheduler may be used to start testing at certain time of teh day or week, etc.
Awarded 2011
Awarded 2011

Commented:
And once the programmer prepares the class and say batch file
no programming requires to run it on the scheduler

Commented:
@bhomass

What test do you want to do? Ping, port accessibility... ?

For example, here is a simple batch file that will monitor Yahoo.com http port 80.

 
@ECHO OFF

:Home

PORTQRY -n yahoo.come -e 80>NUL
IF %errorlevel% == 0 (
	ECHO ^>%DATE% %TIME% Yahoo.com and my Internet connection are online
) ELSE (
	ECHO ^>%DATE% %TIME% Yahoo.com or my Internet connection is offline   - ALERT -
)

REM WHAIT FOR ARROUND 15 SECONDS
PING -n 15 127.0.0.1 >NUL

GOTO HOME

Open in new window

Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:

Author

Commented:
hey, man, how you expect a tester to set up continuous integration?

I mean some UI based tool that a non-programmer can use to select certain unit tests in a controlled manner, and monitor the results.

I guess it is an oxymoron that no one thought of putting out.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
tester wouldn't set it up (same as they wouldn't setup the tests in the first place), but they can manage one.
In fact it frees up the tester from having to run tests because it is running them for them


Author

Commented:
I see what you mean, but this is not an option. our continuous integration is pre-determined, and testers are not allowed to run tests on them manually. They are busy enough as is. Testers need to work on the local environment. I would not want to set up continuous integration in the local env for this purpose.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
why not just use the swing test runner that comes with junit

Author

Commented:
hey, let me take a look at that.

Author

Commented:
looks like swing ui is removed from junit4.
Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Awarded 2011
Awarded 2011

Commented:

I'm still trying to understand your point - when you say in a loop, do you mean
that you want to run the test all the time in a ,loop, so  that run of each one takes
substantial time and as soon as it finishes you want to run it again?

Or you want to schedule, say to run it at three hours interval, or every midnight?

If you want it in a loop all the time and if you create .bat file containing such lines:

:loop
set CLASSPATH=C:\lib\junit-4.8.2.jar;.\
java org.junit.runner.JUnitCore myPackage.MyTestClass
goto loop

it will run your test continuosly  (at least it runs for me).

Is there some problem with such setup?






Author

Commented:
I am doing this for my self. I am a programmer. I am looking for something that works for a tester without having to give him programming support.

The need is to run the test with some regularity to bump out an intermittent bug.

Author

Commented:
turns out the guy uses TestNG, so JUnit Swing UI would not work.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
Depends a bit onn the level of the tester but simply running then from ant (you setup the build file for them), or via eclipse could be the go

http://testng.org/doc/documentation-main.html#running-testng

Author

Commented:
I know you can trigger the test in eclipse, but it is a manual process. if you need to run 100+ tests to kick out the bug, you wouldn't bother.
Awarded 2011
Awarded 2011

Commented:

You can run it from cooman line, put it in batch file and run through Windows Scheduler at any interval
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
if you need to run 100+ test you wouldn't be running then individually in the first place, theyd be part of a group.

Author

Commented:
no, not 100+tests. same test 100+ times.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
you can do that using ant as I suggested above

though what sort of tests are they that you want to run them 100+ times.

Author

Commented:
I know about ant. the tester does not write any ant, and I am looking for a no-support-needed solution.

the second question I already responded to. it is for an intermittent bug.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
the testers wouldn't write ant scripts, that the developers job.
The testers would just use ant to run the tests

Author

Commented:
this thread is so long, I don't think any one reads up the original premises any more. I am looking for a solution so that the tester can work without any developer support., that is why ant solution is NOT what I am looking for.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
ok. that is what it looks like.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.