Forum Discussion

hemanth2626's avatar
hemanth2626
Occasional Contributor
10 years ago

How to Execute Testng scripts with QA complete without TestComplete?

Hi,

 

I have my testng scripts already developed using Selenium webdriver+testNG framework.

 

Can it be executed directly using QAComplete without using TestComplete ?

 

regards

Hemanth

6 Replies

  • Hemanth,

     

    The following online help provides details about how you might do this:

     

    http://www.softwareplanner.com/UsersGuide_SP/Content/UsersGuide_SP/About%20Automated%20Tests.htm

     

    You'll need to download and configure the Test Agent to make this work.

     

    Proxy Configuration (optional):

    1) To allow the TestAgent to work thru a proxy server, you need to configure poxy for WinHTTP services.

     

    If IE on the test machine is configured to use a proxy, run the following command from a command prompt with elevated privileges (Run as Administrator):

     

    netsh winhttp import proxy source=ie

     

    This article will provide more background:


    http://technet.microsoft.com/en-us/library/bb430772(v=exchg.141).aspx

     

    This, at one point, was a known issue in the TestAgent and an RFE has been created to provide user's with the option of configuring the WinHTTP service for the proxy within the TestAgent itself.

     

    Selenium Server & IDE Configuration:

     

    1) Make sure Selenium Server Standalone is running on your test machine:

     

    http://docs.seleniumhq.org/docs/05_selenium_rc.jsp#introduction

     

    Running Selenium Server:


    Before starting any tests you must start the server.


    Go to the directory where Selenium RC’s server is located and run the following from a command-line console.

     

    java -jar selenium-server-standalone-<version-number>.jar

     

    http://screencast.com/t/jpyy5qwfxpY

     

    2) Ensure you have downloaded and configured the necessary client driver (java in my case):

     

    Using the Java Client Driver:

     

    A - Download Selenium java client driver from the SeleniumHQ downloads page:

     

    http://www.seleniumhq.org/download

     

    B - Extract selenium-java-<version-number>.zip.

    C - Open your desired Java IDE and add the selenium-java-<version-number> .jar files (including the libs) to your project as references.

    D - Add selenium-java-<version-number>.jar to your project classpath.

     

    http://screencast.com/t/PwP3eTjBC

     

    3) Verify the JUnit script will run as a Junit test in your IDE.

     

    http://screencast.com/t/xrnIdZwg

     

    4) Compile the program you have written to test your AUT (export it as a runnable .jar file and choose to package the required libraries).

     

    http://screencast.com/t/VVVRj1isMO

     

    NOTE: You can ignore the error about a missing main method.

     

    Configure Test Agent for execution of Junit Test Scripts:

     

    1) Verify your Junit script executes from a command prompt using:

     

    java -cp "<path to selenium client driver>\*;<path to junit>\*;<path to compiled Junit script>\*" org.junit.runner.JUnitCore <fully qualified name of class which contains junit test>

     

    where

     

    <path to selenium client driver> is the path to the .jar file (like D:\Selenium\*)
    <path to junit> is the path to the junit.jar file (like D:\Junit\*)
    <path to compiled Junit script> is the path to your "runnable" .jar file (like D:\eclipse\workspace\MyProject\*)
    <fully qualified name of class...> is the name of the class in which you have written your test (like Automation.MyJunitTest).

     

    http://screencast.com/t/qUtWCHLi

     

    2) Once you verify the script will run from a command prompt, you need to include each of these paths in the Java Class Path of the Advanced Settings in the TestAgent:

     

    http://screencast.com/t/GLaV7BzHfLo

     

    To Upload your Test into QAComplete:

     

    http://screencast.com/t/35QKP16nS

     

    1) Archive your project into a .zip file (including the runnable .jar file for a pure Junit style test).

    2) In the Test Library of QAComplete create a new test, link a Configuration, and select your test machine as the Default Host Name.

    The need to link a configuration is a known limitation and a RFE has been created to address it.

    3) Submit the new Test and you will be redirected to the Automation tab where you can add your Junit (Selenium) based test.

    4) Provide a meaningful name, select Junit (Selenium) for the Agent drop down, and specify the full classname of the class in which the test is defined.

     

     

    To Run your Test:

     

    http://screencast.com/t/t2ouiG512nF

     

    1) Return to the listing page for the Test Library and select the Run icon (blue cirle with arrow) next to the test record you have just created.
    The Test Runner window will open.

    2) Select the Configuration you have linked to the test by clicking the Run? checkbox and press the Run button.
    You can then minimize the window and wait for the test to be executed.
    Here a defect exists where the Test Runner window is not being updated to reflect progress of test.
    It is best to wait the allotted timeout period and then refresh the Listing page.
    The Run count will increase when the test is completed and you can check by selecting the refresh button at the bottom of the grid.

    3) Once the test is completed, verify successful execution by checking the Run History tab.


    Running Multiple Scripts from QAComplete:

     

    http://screencast.com/t/t24owoEU3P

     

    All you need to do is create separate Tests in the Test Library and then add those Tests to a Test Set.
    For Selenium WebDriver tests, you will need to ensure the path to the Selenium\libs .jar files is specified in Java Class Path of Test Agent.
    Here you will also need to link a Configuration in order for the Test Set to run.

    See the video for an example.

     

    Hope this helps!

     

    Thanks,
    Michael

     

    • hemanth2626's avatar
      hemanth2626
      Occasional Contributor

      Hi Michael,

       

      Thank you for the detailed steps.

       

      After following all the said steps, I am facing two problems,

       

      1. When i open TestAgent , i donot get the Administrator settings Button to enter class paths( find the screenshot as attached)

      2.When i run the test in QAComplete it fails due to reason , Run status will be awaiting Run for long time

       Step 1:Searching for the test runner (JUnit (Selenium)) on the test host. fails with result "JUnit (Selenium) was not found on the host."

       

       

      Could you please help in what i am missing.

       

      Thanks and regards

      Hemanth

       

      • MGergely's avatar
        MGergely
        Staff

        Hamanth,

         

        I think you may have installed/downloaded an older version of the Test Agent.

        If you re-download the agent from within the QAComplete, you should end up installing the most current version.

         

        Here is a direct link to the latest available agent:

         

        http://downloads.smartbear.com/TestAgent10V2.exe

         

         

        Uninstall the Test Agent from Add/Remove programs, clean out the directory where the agent was installed, then download this version of the agent, install, configure and retest. Let me know if this version includes the Advanced button we are expecting to see.

         

        Thanks,

        Michael