Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

tool for running unit test in a loop

Posted on 2011-04-26
28
Medium Priority
?
469 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?
0
Comment
Question by:bhomass
  • 12
  • 9
  • 5
  • +2
28 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 35469165


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.
0
 
LVL 23

Expert Comment

by:cmalakar
ID: 35469175
why not use junit.framework.TestSuite ?
0
 

Author Comment

by:bhomass
ID: 35470278
looking for tools used by testers, without programming support
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

Expert Comment

by:for_yan
ID: 35470374
windows scheduler may be used to start testing at certain time of teh day or week, etc.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35470380
And once the programmer prepares the class and say batch file
no programming requires to run it on the scheduler
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 35471616
@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

0
 

Author Comment

by:bhomass
ID: 35471968
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 35471995
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


0
 

Author Comment

by:bhomass
ID: 35477312
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 35480398
why not just use the swing test runner that comes with junit
0
 

Author Comment

by:bhomass
ID: 35480441
hey, let me take a look at that.
0
 

Author Comment

by:bhomass
ID: 35489110
looks like swing ui is removed from junit4.
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 35489122
they have too
see if this helps
http://talkingjas.blogspot.com/2010/07/how-to-run-your-junit-4-tests-using-old.html

or you might need to write your own runner or use eclipse
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35489331

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?






0
 

Author Comment

by:bhomass
ID: 35756162
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.
0
 

Author Comment

by:bhomass
ID: 35756183
turns out the guy uses TestNG, so JUnit Swing UI would not work.
0
 
LVL 92

Expert Comment

by:objects
ID: 35758708
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
0
 

Author Comment

by:bhomass
ID: 35758870
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.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35758881

You can run it from cooman line, put it in batch file and run through Windows Scheduler at any interval
0
 
LVL 92

Expert Comment

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

Author Comment

by:bhomass
ID: 35759250
no, not 100+tests. same test 100+ times.
0
 
LVL 92

Expert Comment

by:objects
ID: 35759695
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.
0
 

Author Comment

by:bhomass
ID: 35761924
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 35762826
the testers wouldn't write ant scripts, that the developers job.
The testers would just use ant to run the tests
0
 

Author Comment

by:bhomass
ID: 35762860
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.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 500 total points
ID: 35763409
as I mentioned very early, nothing like that exists and you would need to build it yourself.
0
 

Author Comment

by:bhomass
ID: 35767526
ok. that is what it looks like.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month10 days, 4 hours left to enroll

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question