Forum Discussion

mannu_77's avatar
mannu_77
Occasional Contributor
5 years ago
Solved

TC Service REST API - Is there a way to get TC instance ID of remote machine

Hi All,

 

Is there a way to get the instance ID of TC/TE installed on Remote machine(VM) instead of uploading archive folder as project already exsists in the VM. Dont want to spend time on archiving and uploading the archive to VM(Skip zip and upload steps of Rest API).

 

Get the instance ID and trigger the execution of tests by specifying the project path.

 

Regards,

Manu G

  • Hello,

     

    If you have a way to execute a command on a remote machine, you can use the SessionCreator utility to create a user session and execute a test within it instead of using the REST API.

     

    Also, you can try to reduce the size of your project. The easiest way is to clear the old logs. For this, you can use the Number of recent logs to keep option.

4 Replies

  • Hello Manu,

     

    This is impossible at the moment. However, thank you for your question, we will take it into account in the future.

    • mannu_77's avatar
      mannu_77
      Occasional Contributor

      Thanks for the reply Dmitry_Nikolaev 

      why i posted this question is, as our code base exists in VM and we just need to open testcomplete and trigger test execution using REST API rather then again uploading project through Zip file.

      or

      Can we use other than http to upload zip file as time taken is too long to upload more than 1GB of Project suite.

       

      script:

      function UploadZIPFile()
      {
      Log.Message("Upload Zip file to the remote VM");
      var address = "URL";
       var username = "UName";
      var password = "pwd";

      var aqHttpRequest = aqHttp.CreatePostRequest(address, username, password);
      aqHttpRequest.SetHeader("Content-Type","application/zip");

      var requestBody = ReadByteFromFile();
      var aqHttpResponse = aqHttpRequest.Send(requestBody);

      if(aqHttpResponse.StatusCode == 200)
      {
      Project.Variables.InstanceID = aqHttpResponse.Text;
      Log.Message("File Upload to remote VM is successful and Instance ID is: " + aqHttpResponse.Text);
      CreateTestCompleteInstance();
      }
      else
      {
      Log.Error("Error in uploading zip file to remote VM");
      }
      Log.Message("End of Test");
      }

       

      function ReadByteFromFile()
      {
      Log.Message("Read Byte from the zip file");
      var Path = "C:\\Validation1.zip";

      // Opens the specified file for reading
      var myFile = aqFile.OpenBinaryFile(Path, aqFile.faRead);
      Log.Message("File by bytes:");

      // Reads bytes from the file and posts them to the test log
      while(! myFile.IsEndOfFile())
      {
      s = myFile.ReadByte();
      Log.Message(s);
      }

      // Writes the received array to the file
      myFile = aqFile.OpenBinaryFile(Path, aqFile.faWrite, true);
      result = myFile.WriteBytes(s);

      Log.Message("File reading and converted to binary");
      // Closes the file
      myFile.Close();
      Log.Message("End of Test");
      return result;
      }

       

      This way time taken for execution is more. Is there any other way zip file can be uploaded?

       

      Thanks,

      Manu G

      • Hello,

         

        If you have a way to execute a command on a remote machine, you can use the SessionCreator utility to create a user session and execute a test within it instead of using the REST API.

         

        Also, you can try to reduce the size of your project. The easiest way is to clear the old logs. For this, you can use the Number of recent logs to keep option.