Ask a Question

How to pass arguments to java file through QA Complete Custom Args text box?

raja2
Contributor

How to pass arguments to java file through QA Complete Custom Args text box?

Hi Team,

 

I am running selenium script using java file. All script is configured in single java file. Java file is entry point of script, so I have to pass 4 arguments (test id, result path, status, no) to Java file for running selenium script. Could you please let me know how to pass arguments to java file through QA Complete Custom Args text box ? Please find the attached screenshot.

 

Regards,

Poovaraj

4 REPLIES 4
Nastya_Khovrina
SmartBear Alumni (Retired)

Hi Poovaraj,

 

Currently, QAC will create and run the following command line based on the provided info:

java -cp "C:\TestNG_WORKSPACE" org.testng.TestNG <Your Custom Args>

 

To specify the class to run you can use the -testclass parameter. 

 

In your case, you may need to specify something like this: 

-testclass com.classname.class -testId 1234 -resultPath "\\results" -status Passed -no No

 

So, if you specify the following in the Automation configuration: https://www.screencast.com/t/GFspEv0b9c, you will receive the following command line:

java -cp "C:\TestNG_WORKSPACE" org.testng.TestNG  -testclass com.smartbear.class -testId 1234 -resultPath "\\results" -status Passed -no No

 

You can find the created command line in the Test Agent logs (How to collect Test Agent logs?) and can compare it with the command line which you use when you run your tests manually.

 


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

Thanks for your reply !

How to pass arguments to Maven Project Java file through QA Complete Custom Args text box?

 

I have developed selenium script using java language without TestNG and  have mapped java file to Maven project. I am passing some arguments from QA Complete Custom Args text box to Maven project Java file ? Could you please help me how to pass arguments to Maven Project java file from QA Complete Custom Args text box ?  Please find the attached screenshot.

 

Java file : TestRunner

 

Java file configured in Maven Project

 

<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>TestRunner</mainClass>
<classpathScope>test</classpathScope>
</configuration>
</execution>
</executions>

 

Nastya_Khovrina
SmartBear Alumni (Retired)

Poovaraj,

 

It seems that there is no option to pass custom args when the "Use Maven Project" option is enabled.


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: