Eclipse: How to get Current Test Script name while running Script using PyDev / PyUnit

Asked by Prateek Sahu

I am using Python to create Test Scripts in Eclipse and Pyunit for batch run.
I have created a Reporting feature for my project. Now for that I need the name of current Test Script.

How can I get the name of current test Script being executed.

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 you are talking about Sikuli scripts, have a look at sys.argv[0].

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

It displays runfile.py.
When I am running script using Jython unit test

But when I am using jython run:
Its working fine.....I have already used this in my script but the problem is when I am trying to run using Jython unit test run

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

Are you using the Python unit test feature of PyDev?

If yes, runfile.py seems the Python script, that is used by the feature to run your stuff.

Find out in the docs or source of PyDev, where you can get your scripts name.

Or do not use the PyDev feature and make your own untidiest support with plain Jython.

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

Yes I am using Python unit test feature of PyDev.

Raiman it would be really helpful if could share one sample for unit test run.

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

Sorry, I am not familiar with Eclipse/PyDev in such detail, that I can help you with that.

If you decide, to implement unit testing yourself with the unittest module of Python and then run the script normally in Eclipse, then you can read about the basics here: faq 1804

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.