Saturday, 23 January 2016

How to run Selenium TestNg from QC




We can run the TestNg from QC by using below methods

1) Create the batch file(.bat) for run Selenium from TestNg.xml

2) Create the vapi-xp-test for run batch file.





1) Create the batch file(.bat) for run Selenium from TestNg.xml


-> create the folder name as "lib" and paste all .jar file need for run our selenium scripts.

Ex: create bin folder in below path

 C:\SeleniumTestNG\lib

And paste all jar files for Selenium,JXL,Apache POI etc.


-> create the batch file (.bat) like below and save as name TestNG.bat under C:\SeleniumTestNG path


set javaTestProjectPath=C:\SeleniumTestNG
c:
cd %javaTestProjectPath%
set path=C:\Program Files\Java\jdk1.8.0\bin
set classpath=%javaTestProjectPath%\bin;%javaTestProjectPath%\Lib\*;
javac -verbose %javaTestProjectPath%\src\driverFiles\TestNGExecution.java -d %javaTestProjectPath%\bin
java org.testng.TestNG %javaTestProjectPath%\testng.xml


Walkthru above code

-> set javaTestProjectPath=C:\SeleniumTestNG

set selenium project parent folder. we have all files inside the C:\SeleniumTestNG


-> c:
cd %javaTestProjectPath%

change the current project path in command prombt at run time.



-> set path=C:\Program Files\Java\jdk1.8.0\bin

set the path of Jave JDK



-> javac -verbose %javaTestProjectPath%\src\driverFiles\TestNGExecution.java -d %javaTestProjectPath%\bin


Here TestNGExecution.java is main file which we write all testNG annotations script.


%javaTestProjectPath%\bin  = its have all source code of the java file.



-> java org.testng.TestNG %javaTestProjectPath%\testng.xml


this code for running the testng.xml file from command probt.


-> SO now while double click on TestNG.bat under C:\SeleniumTestNG path, its automatically lauch the browser and run the selenium Automation script.





2) Create the vapi-xp-test for run batch file.


use this link -> http://www.ranorex.com/blog/running-ranorex-automated-tests-with-hp-quality-center

please use below method for Create the vapi-xp-test for run batch file.


-> Create the new Test (Testing-> TestPlan-> New Test)

-> Set the test type to “VAPI-XP-TEST:

-> Select VBScript as Script language:

-> Set “Console Application as test type:


-> Enter the batch file location in “Application Executable file” and press the “+” button to add the application call to your script:


-> Finish the HP VAPI-XP Wizard:



3) Run the Selenium TestNG from ALM

please use below method for run selenium TestNg from ALM QC


-> Selenium Test from TestPlan (Testing -> TestPlan -> test)

4 comments:

  1. Hi Arun,
    Your post was of great help, I had been looking for this for sometime, and finally came across your post.
    However, theres one problem I am facing.
    Irrespective of the run, the run status in test lab is displayed as passed, even when the script fails.
    Is there a way to get the results to be updated in alm using the same method that you have used here.

    ReplyDelete
  2. What is TestNGExecution.java ?

    ReplyDelete
  3. Thank you for this valuable information which is very useful and important. Are you looking for the best spacebar clicking Techniques?Here you can get all information by using Spacebar Click Test.

    ReplyDelete