Unit-test run using pyunit

Asked by Prateek Sahu

I am using Pydev Eclipse for scripting.
For exection Jython
and to execute multiple tests Jython-unit test

This much I am able to do.
Now I want all this using Command Prompt

I have already set sysPATH, JYTHONPATH...I am able to run single testscripts using jython...
eg.
>jython -m unittest xxxx.py

This is working fine.

Now I want to run all the test cases using command prompt(as I have done in Eclipse using pyunit)...
Please Help me..
Thanks in advance

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

If I understand right, then you have different .py, that each contain one ore more definitions like

class Testxxx(unit test.TestCase):

    def testXXX(self):
           # coding

# and so on

Using PyUnit, you get the test runner by the PyDev plugin.

Running on Jython directly, you have to setup your own test runner.

faq 1804 might help to setup some solution.

Revision history for this message
Prateek Sahu (prateek-sahu01apr) said :
#2

when I am running my test Suite from command prompt following error is coming. I am not getting this error
What I should do to resolve this

D:\EBA\Scripts\eBA-POC\TestScripts>jython -m unittest TestSuite_Authorization_Modification.py
[info] Sikuli vision engine loaded.
[info] Windows utilities loaded.
[info] VDictProxy loaded.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\jython2.5.2\Lib\runpy.py", line 94, in run_module
    return _run_module_code(code, init_globals, run_name,
  File "C:\jython2.5.2\Lib\runpy.py", line 51, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\jython2.5.2\Lib\runpy.py", line 32, in _run_code
    exec code in run_globals
  File "C:\jython2.5.2\Lib\unittest.py", line 816, in <module>
    main(module=None)
  File "C:\jython2.5.2\Lib\unittest.py", line 767, in __init__
    self.parseArgs(argv)
  File "C:\jython2.5.2\Lib\unittest.py", line 794, in parseArgs
    self.createTests()
  File "C:\jython2.5.2\Lib\unittest.py", line 794, in parseArgs
    self.createTests()
  File "C:\jython2.5.2\Lib\unittest.py", line 799, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
  File "C:\jython2.5.2\Lib\unittest.py", line 565, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "C:\jython2.5.2\Lib\unittest.py", line 541, in loadTestsFromName
    parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'py'

Revision history for this message
RaiMan (raimund-hocke) said :
#3

This is absolutely shit (Steve Jobs would have said in this case ;-)

But since I am a little bit more polite:

Sorry, but this does not work this way:

jython -m unittest TestSuite_Authorization_Modification.py

have a look at http://jython.org/docs/using/cmdline.html, and I am sure, you will find out.

(unittest module does nothing, when it is run - can only be included)

again:
look at faq 1804, to get some hints how to easily setup a test runner.
Or have a look at the official Python/Jython docs.
Or have a look for tons of tutorials and examples in the net.

Not really a Sikuli question.

Can you help with this problem?

Provide an answer of your own, or ask Prateek Sahu for more information if necessary.

To post a message you must log in.