jakubiak ✭✭✭

About

Username
jakubiak
Joined
Visits
739
Last Active
Roles
Members, Staff
Points
162
Posts
219
Badges
11
  • Re: How to apply an x-path into an array.

    Try /root/documents/item/documentId[../products/item/subcategory/text()="Loans"]/text()

  • Re: HOW TO EXECUTE JAR FILE USING JYTHON OR GROOVY SCRIPT VIA EXTENSION TOOL

    Here is a groovy script that will execute the jar in a separate process and capture the output that gets sent to standard output (if you need standard error as well you will need to slightly modify it to also capture process.getErrorStream()):

    import java.lang.*;
    import java.io.*;
    import com.parasoft.api.*;
    
    public void runJar() {
        Process process;
        try {
            process = Runtime.getRuntime().exec("java -jar <full path to jar>")
            StringBuilder buf = new StringBuilder();
            InputStream is = process.getInputStream();
            int i = 0;
            while ((i = is.read()) != -1) {
                buf.append((char) i);
            }
            process.waitFor();
            Application.showMessage(buf.toString());
        } finally {
            closeStreams(process);
        }
    }
    public static void closeStreams(Process process) {
        if (process != null) {
            try {
                process.getInputStream().close();
            } catch (IOException e) {
            }
            try {
                process.getErrorStream().close();
            } catch (IOException e) {
            }
            try {
                process.getOutputStream().close();
            } catch (IOException e) {
            }
        }
    }
    
  • Re: Resize Chrome Browser

    It depends on which browser you are using. You could add an "Execute JavaScript" action to your scenario after the initial "Navigate" action and use JavaScript like "window.resizeTo()" to change the window size, but most browsers don't actually allow you to do that anymore. It worked for me in Internet Explorer but did not work for me in Chrome.

    Here is the code I used in my "Execute JavaScript" action:

    function resize() {
        window.resizeTo(500, 500);
    }
    
  • Re: SOATest-Can we define environments at project level?

    Each project needs to have the same environments with the same names. In the Test Configuration, you simply need to specify the name of the environment and it will use it for all tst files since each tst file will have that named environment.