Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I call ToolsAPI from code in the DUnit GUITestrunner?

Is there a way to initialize the global variable BorlandIDEServices in ToolSAPI unit so that it can be used from the DUnit GUITestrunner code?

procedure TGUITestRunner.FailureListViewClick(Sender: TObject);
var
  Project: IOTAProject;
begin
  if FailureListView.Selected <> nil then
  begin
    TestTree.Selected := TTreeNode(FailureListView.Selected.data);

    // call OTA
    Project := ToolsAPI.GetActiveProject;
    ShowMessage(Project.ProjectType);

  end;
end;

In this example, the Project variable will be nil because the BorlandIDEServices variable is not initialized. The GUITestrunner is run from within the IDE in debug mode.

like image 580
mjn Avatar asked Sep 09 '11 15:09

mjn


2 Answers

No, because BorlandIDEServices is only available from code actually running inside (as part of) the IDE itself. Code executing in external applications through the debugger are still running externally; they're not part of the IDE, even though the debugger is, and therefore don't have access to the ToolsAPI functionality.

Tools like GExperts actually plug into the IDE and become part of it, which is why they can access ToolsAPI interfaces. This isn't the case with GUITestRunner; it's an external application whether it's running under the debugger or not.

like image 144
Ken White Avatar answered Oct 17 '22 21:10

Ken White


The only way I can imagine (have not tested it) would require a OTA plugin which communicates with the GUITestrunner over some inter process communication.

For example, the plugin opens a socket and receives commands like 'open file 'SomeTests.pas' in the editor' from the GUITestrunner application.

like image 42
mjn Avatar answered Oct 17 '22 21:10

mjn