Writing JUnit Tests in Jython

I was wondering, does anyone use Jython to write JUnit tests? The reason for this is because I'm trying to find a neat way to test my SOAP-based web services without the need to generate any code. The reason for sticking to JUnit is that in the end I would like to integrate the tests into the Ant-based CI system.

I already looked at the article http://www.devx.com/java/Article/26602/1954 , which describes exactly what I need. Unfortunately, I could not get it to work.

Any thoughts and experiments on this issue will be very useful.

Thanks Alex

+4
source share
2 answers

I would prefer to go the other way around: write tests using python unittest to test java code from python. Then you also have doctrines to test Java code that is neat.

Then you can try to integrate into ant by creating an ant task, for example, running a nose to find and run tests.

Or you can use Hudson for continuous integration (which takes a long step beyond simple Ant) and never look back;)

Good article with this and more (including mention of the jython plugin for Hudson): http://www.jython.org/jythonbook/en/1.0/TestingIntegration.html

+1
source

I wrote jython code to test Java projects in the past. Saves me a headache when washing and speeds up the death of my keyboard with excessive keystrokes.

import sys sys.path.append('path/to/library.jar') from com.example.library import Foo import unittest class TestFoo(unittest.TestCase): def testFoo(): bar = (2, 3, 4) foo = Foo(bar) self.assertIn(2, foo) 
0
source

Source: https://habr.com/ru/post/1334051/


All Articles