Need tutorials for Jython in SOA test

kamit2733kamit2733 Posts: 16

Hi all,

Can some one give me guide regarding scripting in Jython in SOA test .
I am new to SOA test and finding it a bit difficult while scripting in Jython . it would be grateful if some one could give me some kind of study material for Jython.



  • OmarROmarR Posts: 227 admin

    Good evening,

    What are you looking to accomplish with Jython scripting? Perhaps we could help you accomplish the same using the SOAtest tools :smile:

    Aside from documentation, I recommend looking over the "jythonbook" posted in the Jython project page:

  • benken_parasoftbenken_parasoft Posts: 908 ✭✭✭

    Jython is a Python interpreter. So, you also can find many resources and tutorials for the Python language around the web. Concerning SOAtest, feel free to post any specific questions you have if you are not sure how to accomplish something. In general, SOAtest tooling is intended to avoid scripting or otherwise having to manually code test cases.

  • Mounika238Mounika238 Posts: 6

    I am new to SOA test and trying to develop a test case to get the count of total no of rows in a web table in a browser.i am assuming that only scripting will accommodate this scenario. Can you please suggest is there a way to do this with SOA tool?

  • jakubiakjakubiak Posts: 684 admin

    Yes you will need scripting for this. You can use the SOAtest Extensibility API to accomplish what you want to do.
    1. Record a browser test scenario
    2. At the test step where the table appears, add an Extension Tool by choosing to right-click on the test at that step and selecting Add Output... > Browser contents (rendererd HTML) > Extension Tool.
    3. Write a script like the following in the Extension Tool (this script is written in Groovy):

    import com.parasoft.api.*;
    import org.w3c.dom.*;
    import webking.api.browser2.*;
    public void countRows(BrowserContentsInput input, ExtensionToolContext context) {
        Document doc = input.getDocument();
        Element table = WebBrowserTableUtil.getTable("id", "accountTable", doc);
        NodeList rows = table.getElementsByTagName("tr");
        if (rows.getLength() != 12) {
  "Incorrect number of table rows: " + rows.getLength());

    The key elements of this script are the following:
    1. com.parasoft.api.BrowserContentsInput is how you can get the contents of the page. There are multiple getDocument() methods that allow you to specify which window/frame for which you want to get the contents.
    2. webking.api.browser2.WebBrowserTableUtil has a number of nice utility methods for working with tables.
    3. com.parasoft.api.ExtensionToolContext is used to report an error in SOAtest

    You can find JavaDocs for these classes by going to Help > Help Contents > Parasoft SOAtest Extensibility API.

  • Mounika238Mounika238 Posts: 6

    i am able to extract rows count with the above script by customizing with my table values.

Sign In or Register to comment.