Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top