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.

I am looking for java predefined classes in the Parasoft

swapna0707
swapna0707 Posts: 41

Hi Team,

I am trying to create sample java class in the parasoft but it asking for Java class name and method .

Please help me on this.

Thanks,
Swapna

Comments

  • Ireneusz Szmigiel
    Ireneusz Szmigiel Posts: 227 ✭✭✭

    Swapna

    how did you create your "sample java class"?
    Do you have it added in Parasoft>Preferences>System Properties ( and restarted tool)?
    More information how to use Java project in SAOtest you can find in section "Using Eclipse Java Projects" in User Manual or here

    Ireneusz Szmigiel

  • swapna0707
    swapna0707 Posts: 41

    Hi Ireneusz,

    I would like to write java code in the Extension Tool to read the data from data source

    Thanks,
    Swapna

  • Ireneusz Szmigiel
    Ireneusz Szmigiel Posts: 227 ✭✭✭

    Hi Swapna

    as I said, all details how to create Java Project in SOAtest you can find in documentation.
    I think you can take a look here You can find there thread about your question.

    Ireneusz Szmigiel

  • Thomas Moore
    Thomas Moore Posts: 82 admin

    Hi Swapna,

    As a side note, you can also use the Groovy scripting language to write code, as Groovy accepts Java syntax (making it my personal scripting language of choice).

    If you want to use Java as a scripting language, you will have to create an external Java class and add it into the the System Properties as @Ireneusz Szmigiel noted.

    Hope this helps!

  • swapna0707
    swapna0707 Posts: 41

    Thanks Thomas and Ireneusz .
    how do we know the predefined methods and classes in parasoft .
    For ex:
    import com.parasoft.api.*
    void checkDataSource(Object input, ScriptingContext context) {
    List firstCol = context.getValues(
    "MyDS", // set this to the name of your data source
    "A") // set this to the name of some column in your data source
    Application.showMessage(Integer.toString(firstCol.size()))
    }
    how do we know getValues method is available in context object?

    can you please help me on this?please don't mind if i am asking wrong question?

    Thanks,
    Swapna

  • swapna0707
    swapna0707 Posts: 41

    Hi Team,

    How we can know the classes available in the parasoft.api package like IOUtil as mentioned in the below.

    for ex:
    rom com.parasoft.api import *
    from soaptest.api import *
    from java.util import *
    from java.text import *
    from java.lang import *
    from com.parasoft.api import IOUtil
    from java.io import File

    Thanks,
    Swapna

  • swapna0707
    swapna0707 Posts: 41

    Hi Team

    Please help me on the documentation for the Parasoft api calls for better understanding about the methods.
    Ex:
    def customAssertion(Object input, ScriptingContext context) {
    String value = context.getValue("New Datasource","xyx");
    String encoded = "text" + value.bytes.encodeBase64().toString()
    }

    Thanks,
    Swapna

  • Thomas Moore
    Thomas Moore Posts: 82 admin

    Hi Swapna,

    As @bpowell commented here, You can take a look at the pre-defined methods that are available for scripting use under Help > Help Contents and search for "Index (Extensibility API)".

    Once there, you can search for the method that you are looking to use and get all the information you need.

    Hope this helps!

  • swapna0707
    swapna0707 Posts: 41

    Thanks @bpowell and @Thomas Moore