Debugging Scripts in Jython
From an existing customer, but I figure I would post here:
Can you recommend how we debug Jython scripts, which we’re planning to use within SOAVRT as “shared” scripts we can distribute to teams?
Should we need use Eclipse and PyDev?
Comments
-
You could write your shared python modules and test/debug them with unit tests. Yes, PyDev could assist with this (see unit test integration). After your python modules are written and tested, then you could start referencing them from SOAtest test cases. You would not use SOAtest to test or debug the scripts themselves. Rather, from SOAtest, you want to use your scripts as a part of testing and debugging your application under test. For visibility as to what your scripts are doing when executed from SOAtest test cases, you could add your own logging to your scripts.
1 -
Very helpful recommendation! Thank you!
0 -
Python has a debugger , which is available as a module called pdb . It supports setting conditional breakpoints , stepping through the source code one line at a time, stack inspection, and more.
import pdb msg = "this is a test" pdb.set_trace() print(msg)
Insert pdb.set_trace() anywhere and it will function as a breakpoint . When you execute the script by python test.py, you will in the debug mode.
0