I like the idea that I can write Jython scripts and access my Java classes and I was wondering if anybody's got experience with a tool like JUnit but written in Jython? Is it worth digging into, or is JUnit good enough by itself? Thanks, Burk
SCJP, SCJD, SCEA 5 "The only rules that really matter are these: what a man can do and what a man can't do." Captain Jack Sparrow
Matthew X. Brown
Ranch Hand
Joined: Nov 08, 2000
Posts: 165
posted
0
Have you tried to do imports using the jython java import functions- I might try to import my junit classes and open up the implementation- conceivably- you could build, using the reflection API, a class that could allow you to pass in the jython classes you wanted to validate in a Junit "proxy" class.
Glenn Murray
Ranch Hand
Joined: Dec 07, 2001
Posts: 74
posted
0
I have the same question and would like to hear from the wizards regarding this. In particular I'm wondering about automating GUI testing, which I've found to be very difficult. Thanks, Glenn
That's a neat idea I hadn't thought of. Use JUnit to unittest the Jython code. Mind if I borrow it?
Originally posted by Matthew Brown: Have you tried to do imports using the jython java import functions- I might try to import my junit classes and open up the implementation- conceivably- you could build, using the reflection API, a class that could allow you to pass in the jython classes you wanted to validate in a Junit "proxy" class.
I use pyunit extensively for unit testing an EJB application. It's the bomb and I recommend you take some time to learn python to fully utilize this amazing tool! The only problem is it's easy to get addicted to python/jython. I'm trying to learn .NET and I'm not thrilled I've got to give up the interactive console I've grown to love - lol. If you know already know java, python is cake. For info on pyunit: http://pyunit.sourceforge.net/ http://pyunit.sourceforge.net/pyunit.html#USING General python links: http://www.dickbaldwin.com/tocpyth.htm I also recommend Jython Essentials as an excellent reference.
Karthik Guru
Ranch Hand
Joined: Mar 06, 2001
Posts: 1209
posted
0
we are usign cactus to test EJBs. We have EJBLocal interfaces. Looks like pyunit is python version of junit. I guess we can'tuse juint to test EJBLocal interfaces. Can you tell me how can i use pyunit for testing EJBs? I understand python so that is not a problem. thanks! karthik
Originally posted by Justin Steadham: I use pyunit extensively for unit testing an EJB application. It's the bomb and I recommend you take some time to learn python to fully utilize this amazing tool! The only problem is it's easy to get addicted to python/jython. I'm trying to learn .NET and I'm not thrilled I've got to give up the interactive console I've grown to love - lol. If you know already know java, python is cake. For info on pyunit: http://pyunit.sourceforge.net/ http://pyunit.sourceforge.net/pyunit.html#USING General python links: http://www.dickbaldwin.com/tocpyth.htm I also recommend Jython Essentials as an excellent reference.
Andrew Glover
author
Greenhorn
Joined: Dec 19, 2002
Posts: 16
posted
0
if you'd like to test your EJB code, you need to use Jython, not Python. With Jython you can use regular java objects. Jython can use Python code- hence the pyunit reference.
Certified City Slicker
Laurent Ploix
Greenhorn
Joined: Dec 05, 2003
Posts: 4
posted
0
Answer to the original question about writing Junit tests in Jython.
Yes it is possible (and done).
We wrote an article about it on DevX. Now the classes are may be somewhat obsolete but they work.
Then, last but not lease, we will gather the useful classes in the project : http://sourceforge.net/projects/crosstest/ (the project is still, well, pre alpha... give us a few weeks, it will be ok). [ May 28, 2005: Message edited by: Laurent Ploix ]