Forum Discussion

maria_vst's avatar
6 years ago

How to provide an object from third party components to TestExecute REST API?


I'm trying to communicate with TestExecute API.
When executing GET/POST requests with parameters simple data types everything is Ok.
But there are some methods from third party components that are expecting an object from some their class.
How to obtain this?
SomeMethod(id, someObject)
where id is an identification for object whoes method is trying to be executed and 
someObject is object from third party components, which identifications also is available.

Thanks in advance,

  • maria_vst's avatar
    6 years ago


    If someone is interested in this, that is the way to resolve my issue:
    methodName = "LocateByDisplayText";
                request = new RestRequest("1/sys/" + mainViewId + "/method/" + methodName, Method.GET);
                request.AddParameter("arg1", 0); 
                request.AddParameter("arg2", request.JsonSerializer.Serialize(new { id = gridColumnId })); // Making a JSON based on the GridColumn id
                request.AddParameter("arg3", "\"Nissan\"");
                response = restClient.Execute(request);



9 Replies

  • AlexKaras's avatar
    Champion Level 3

    Hi Maria,


    It might help to understand the problem better if you provide your code here.

    But generally speaking,

    > GET/POST requests

    pass data in textual form. As JSON, text, some encoding etc.

    Thus, it is my expectation that serialized representation of the object is required as the value for the someObject parameter.



    > I'm trying to communicate with TestExecute API.

    Can you describe what for?


    • maria_vst's avatar


         I'm trying to communicate with TestExecute API as alternative of Connected/Self-Testing applications which are deprecated by Smartbear. (These technologies will be removed in one of the future releases of TestComplete.)
      Because our tests are based on this approach, I'm trying to find a way to work with TestComplete using REST API.

      this is an example of usage of TestComplete in documentation

      function FindRowByCellText (Grid, View, ColumnId, Text)
        var Column;
        if (View == null)
          View = Grid["MainView"];
        Column = GetColumn (Grid, View, ColumnId);
        return View["LocateByDisplayText"](0, Column, Text);

      function GetColumn (Grid, View, ColumnId)
        var Columns;

        Columns = View["Columns"];
          // The column is specified by index
          return Columns["Item_2"](ColumnId);

      My question is how to call using REST API methods like this one:
      View["LocateByDisplayText"](0, Column, Text);

      where the Column is an object.

      And there is a rough sample for CallMethod using REST API:

      private static void CallMethod(string id, string methodName, params object[] methodParams)
      methodName = AddArguments(methodName, methodParams);
      RestRequest request = new RestRequest("1/sys/" + id + "/method/" + methodName, Method.GET);
      string content = ExecuteRequest(request);
      RMReturn r = JsonConvert.DeserializeObject<RMReturn>(content);
      if (!r.success) throw new Exception("CallMethod: " + r.result);


      CallMethod(ViewId, "LocateByDisplayText", 0, Column, Text);


      • tristaanogre's avatar
        Esteemed Contributor

        Those aren't REST API calls.  They are methods that are associated with the component itself.  As far as I know, there's not an API as such in TestComplete/TestExecute.  So, the question itself doesn't make sense since there isn't a published API.

        The replacement for connected/self-testing applications is the product called "TestLeft".  Take a look at that and see if that will solve your problems.