How to read parameters in runtime + Java + TestNg

Wednesday, September 6, 2023
Avatar

Hi,

I'm using CommandLine+RemoteLaunchX, and I have added parameters in the "editParameters" section (in TestCase & TestSet). How can I read them at runtime in Java?
I have attempted to use "System.getProperty("search")," but it didn't work.

 

Thanks,

 

1 Replies
Friday, September 8, 2023
Avatar
re: naresh.bodda Wednesday, September 6, 2023

When RemoteLaunchX runs it will call the specified application, which sounds like it is Java.

They will be passed as arguments to the command-line, so I imagine you would read them using:

class MyClass {
 
    // Main driver method
    public static void main(String[] args)
    {
        // Printing the first argument
        System.out.println(args[0]);
    }
}

where the args array contains the parameters and values passed.

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Wednesday, September 6, 2023
  • Last Reply: Friday, September 8, 2023
  • Replies: 1
  • Views: 1062