cancel
Showing results for 
Search instead for 
Did you mean: 

Script vs Keyword Test with Delphi menu items

Highlighted
New Contributor

Script vs Keyword Test with Delphi menu items

This script works fine for checking the expected enabled/disabled state of submenu items.

 

function Connect_No_Loggers_Check_Menus()
{
var Process, Window, MainMenu, Submenu, Item;
Process = Sys.Process("ConnectScreen");
Window = Process.FormMain;
MainMenu = Window.MainMenu;
Submenu = MainMenu.Items("File").Submenu;
Item = Submenu.Items("Select Server...");
aqObject.CheckProperty(Item,"Enabled",0,true);
Item = Submenu.Items("Connect");
aqObject.CheckProperty(Item,"Enabled",0,false);
Item = Submenu.Items("Disconnect");
aqObject.CheckProperty(Item,"Enabled",0,false);
Item = Submenu.Items("Exit");
aqObject.CheckProperty(Item,"Enabled",0,true);
}

 

I'd like to do the same in a Keyword Test. The problem is that this is a Delphi application, and using the object browser, I cannot drill down all the way to the submenu items. The deepest I can go is to TMenuItem (the submenus).

 

Sys.Process("ConnectScreen").VCLObject("FormMain").VCLObject("MainMenu").VCLObject("TMenuItem")

 

I'm still wrapping my head around what I can do in scripts vs. keyword tests. How can I specify the submenu by name or index and submenu item by name or index that I want to examine in a keyword test?

 

 

1 REPLY 1
Community Hero

Re: Script vs Keyword Test with Delphi menu items

There are, quite honestly, limtiations in keyword tests.  Basically, you can do the same, but I find it cumbersome in keyword tests to build out similar code.

However.... since you have the script code, you CAN call that from a keyword test.  There is an operation in keyword tests to run a script routine.  It doesn't make any sense to re-invent the wheel... just call your script from your keyword test... in fact, I find this the BETTER way to do things in a team that doesn't have a lot of coding experience... those who can code help write utility functions like this and those who can't code so well incorporate those into the keyword tests.  Everyone is happy then. :-) 


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Here?
Join us and watch the welcome video:
API Testing Mistake #2
APITestingMistake#2
Top Kudoed Authors