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.

Help in loading JAVA classes

Options
LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
Hi,

I had written a code to apply XSLt on a given XML to convert it to HTML format, in JAVA window of Parasoft Soatest.
Then I added the extention tool to one of my teststep in SAOtest window. I chose the scripting language as JAVA, I mentioned the class and added the class path to system properties tab but I was unable to load the methods of the JAVA class.

My Java code is as follows:
package chap5;

import javax.xml.transform.*;
import javax.xml.transform.stream.*;

import java.io.*;

public class Simple3 {

public static void createHTML() throws TransformerException,
TransformerConfigurationException,
FileNotFoundException, IOException
{
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource("d:/Program Files/reports/test1.xsl"));
transformer.transform(new StreamSource("d:/Program Files/reports/TEST-ICalculator_TestSuite1.xml"),new StreamResult("d:/Program Files/reports/TEST-ICalculator_TestSuite1.html "));
System.out.println("** The output is written in html**");
}



public static void main(String args[]) throws TransformerException,
TransformerConfigurationException,
FileNotFoundException, IOException
{
createHTML();

}

}


How do I go about loading JAVA classes in extention tool?

Thanks a ton for your help


Regards,
Sayana
Tagged:

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    Hi Sayana,

    I'm happy to help you out.

    I was able to get your class to load with a few modifications:

    1. Remove the "package chap5;" line
    2. Remove the main class (optional, but the main method is not required for SOAtest)

    I then carried out the following steps in the extension tool configuration page:

    1. Language: Java
    2. Class: Simple 3
    3. Method: createHTML()
    4. Click the Modify Classpath link in the lower right-hand corner. Then click Add Class Folder and navigate to the directory in which Simple3.class is stored.

    The Method dropdown in the lower right-hand corner should now be populated.

    Please let me know if you have any further trouble with this issue. If you do, please attach a screenshot of the extension tool configuration and the SOAtest classpath to assist me in my investigation.

    Regards,
    Sam
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    Hi Sam,

    I did the required modifications but I am still not able to load the method of the class Simple3.


    Regards,
    Sayana
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    edited November 2016
    Options
    Hi Sayana,

    My apologies, but I realized that I made a slight error. I said:

    Class: Simple 3

    when I should have said:

    Class: Simple3

    Note the lack of the space in Simple3.

    Regards,
    Sam
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    Hi Sam,

    Its working
    The methods of the Simple3 class are loaded in the Method field.

    Thanks a lot for your help.

    Regards,
    Sayana
  • shress13
    shress13 Posts: 1
    Options

    Hi Sam,

    I made a class in eclipse and add class using modify classpath .

    I removed package and main class but still i am not able to see method.

    Where i need to create java or class or what is the first step creating class.

    Please help me.

    Thanks,
    Sujit

Tagged