[Jython-users] Junit with Jython
by Thomas SMETS other posts by this author
Dec 8 2004 1:09PM messages near this date
Web Site Trashed (Again)
|
Re: [Jython-users] distributing a Java application
need to valiate a file format... to do so I believe jython is
easier to use that Java and I though writting a Unit-test in jython.
Here below is my code :
<code>
from junit.framework import *
from junit.textui import *
# from junit.swingui import *
#
http://patricklogan.blogspot.com/archives/2004_01_18_patricklogan_arch
ive.html#107466534182478004
class ValidateFileOutputTest(TestCase):
def __init__(self, testCaseName):
TestCase.__init__(self, testCaseName)
print 'TestCase name is : %s ', testCaseName
def setUp(self):
print "def setUp(self)"
self.file = open (self.fileName, 'r')
print "def setUp --> completed"
def tearDown(self):
print "def tearDown(self)"
try:
self.file.close()
except IOException:
TestCase.fail (self, "Problem closing the file")
def setFileName(self, aFileName):
print "def setFileName(self, aFileName)"
self.fileName = aFileName
def testHeaderLineOK(self):
print "def testHeaderLineOK(self)"
def suite():
ts = TestSuite()
ts.setName("Valicating the file format")
testCase = ValidateFileOutputTest("testHeaderLineOK")
testCase.setFileName('/path/to/my/file')
ts.addTest(testCase)
return ts
if __name__ == "__main__" :
print "Hello world"
TestRunner.run(suite());
# TestRunner.run(ValidateFileOutputFile);
</code>
Unfortunately the output is the following :
<pre>
Hello world
TestCase name is : %s testHeaderLineOK
def setFileName(self, aFileName)
def setUp(self)
def setUp --> completed
def tearDown(self)
</pre>
Any idea what I do wrong ... ?
Tia,
\T,
=====
Anyone can write software a computer understands;
let's write software that people understand.
K. Beck
T. : +32 (0)2 742 05 94
M. : +32 (0)497 44 68 12
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Jython-users mailing list
Jython-users@[...].net
https://lists.sourceforge.net/lists/listinfo/jython-users
|