Generating VAPI-XP scripts with HP Quality Center

You can generate a VAPI-XP script from HCL OneTest API by using the Integration Tester Test Execution plug-in. You can use the generated script to create tests when you want to run VAPI-XP tests in the HP Quality Center.

Before you begin

You must have completed the following tasks:
  • Installed HCL OneTest API on the Quality Center client machine to enable the execution of HCL OneTest API test resources.
  • You must have created a project and that project is open in HCL OneTest API.

Procedure

  1. Select Generate External Tool Configuration from the Tools menu.

    The Generate External Tool Configuration wizard is displayed.

  2. Complete the following steps in the Configuration type and environment window of the Generate External Tool Configuration wizard:
    1. Select VAPI-XP JavaScript for executing tests or suites in HP Quality Center.
    2. Select the HCL OneTest API environment from the list in which the selected resources are to be run.
    3. Click Next.

    The Select resources window is displayed with the project resources tree.

  3. Complete the following steps in the Select resources window of the Generate External Tool Configuration wizard:
    1. Select the tests or suites that you want to include in the project configuration.
      Note: You can select multiple items by pressing the Ctrl or Shift key and clicking the tests or suites.
    2. Select the way in which the resources are referred by clicking either Name or ID.

      The advantage of using names is that they are more easily recognizable. If you delete the resource from the project and create another resource with the same name, the script still works.

      If you choose to use IDs, you can rename or move the resource within the project, and the script still works.

      Note: If you selected one or more resources in the Test Factory perspective, those resources are automatically selected to be included in the project configuration.
    3. Click Next.

      The VAPI-XP JavaScript options window is displayed.

  4. Complete the following steps in the VAPI-XP JavaScript options window of the Generate External Tool Configuration wizard:
    1. Enter the path to the RunTests command that is used by Quality Center to execute the selected resource in the Test Executor field.

      By default, this field is populated with the installation location of HCL OneTest API. If you change the value, be sure to point it to a RunTests executable that is located in the installation directory of HCL OneTest API or HCL OneTest API Agent.

    2. Select the Raise defects automatically check box if you want to have Quality Center raise defects automatically in the case of a failed test run.
    3. Click Next.

      The Summary window is displayed with a preview of the contents of the project configuration file.

  5. Complete the following steps in the Summary window of the Generate External Tool Configuration wizard:
    1. Click Browse to select a location for the VAPI-XP script.
    2. Enter a name for the file.
      Note: The project configuration file is saved as an XML file by default.
    3. Click Save.
    4. Click Finish.
      An example of the VAPI-XP script generated by HCL OneTest API is as follows:
      // ----------------------------------------------------
      // Main Test Function
      // Debug - Boolean. Equals to false if running in [Test Mode] : reporting to Quality Center
      // CurrentTestSet - [OTA COM Library].TestSet.
      // CurrentTSTest - [OTA COM Library].TSTest.
      // CurrentRun - [OTA COM Library].Run.
      // ----------------------------------------------------
      
      function Test_Main(Debug, CurrentTestSet, CurrentTSTest, CurrentRun) {
      
      var project = "C:\\Users\\user\\git\\UATest_Sample\\calculator\\calculator.ghp";
      var run = "calculator/Add/Test 1 plus 1 equals 2";
      var env = "UATest";
      var executor = "C:\\Program Files\\HCL\\HCLProducts\\API\\RunTests.exe";
      
      var raiseDefect = 0;
      
        try {
          TDOutput.Clear(); // clear output window
      
          var res = XTools.run(executor, "-project \"" + project + "\" -run \"" + run + "\" -environment \"" + env + "\" -noHTTP", -1);
      
          TDOutput.Print("result is " + res );
      
          if( res > 0 ) {
             if( CurrentRun != null ) {
                CurrentRun.Status = "Failed";
             }
             if( CurrentTSTest != null ) {
                CurrentTSTest.Status = "Failed";
             }
          }
        }
        catch(e)
        {
          TDOutput.Print("Run-time error [" + (e.number & 0xFFFF) + "] : " + e.description);
      
          // update execution status in "Test" mode
          if (!Debug) {
            CurrentRun.Status = "Failed";
            CurrentTSTest.Status = "Failed";
          }
        }
      }

Results

The generated script is saved to an output file.

What to do next

You can use the new VAPI-XP test script to run the selected HCL OneTest API resource from HP Quality Center.