Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Debugging Scripts in Jython

Options
Grigori Trofimov
Grigori Trofimov Posts: 83 ✭✭
edited September 2018 in SOAtest

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

  • benken_parasoft
    benken_parasoft Posts: 1,232 ✭✭✭
    edited September 2018
    Options

    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.

  • Grigori Trofimov
    Grigori Trofimov Posts: 83 ✭✭
    Options

    Very helpful recommendation! Thank you!

  • bennetcole
    bennetcole Posts: 1
    Options

    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.