Welcome! Log In Create A New Profile

Advanced

WD24: EmulateInput() doesn't recognize controls from external components

Posted by jacek 
WD24: EmulateInput() doesn't recognize controls from external components
April 07, 2021 04:46PM
After spending several frustrating hours, I need a workaround for a simple automatic test like this:

PROCEDURE MyScenario()
EmulateInput(WIN_RegVisitA_BOC.EDT_CargoCode,"{F5}")
//Scenario that will be run when opening
// the "cmp_wdWS50DictSQL.WIN_SelectCargo" window
ON "cmp_wdWS50DictSQL.WIN_SelectCargo" DO
EmulateInput("cmp_wdWS50DictSQL.WIN_SelectCargo.TABL_Cargo","{DOWN}{DOWN}{ENTER}")
END


After it is run at the end of the last line with a call to EmulateInput() a No Entry icon is displayed with a tooltip: "EmulateInput function called. Error caused by 1 parameter. The 'cmp_wdWS50DictSQL.WIN_SelectCargo.TABL_Cargo' control is unknown."

- cmp_wdWS50DictSQL is the external component.
- WIN_SelectCargo is the window from this component.
- TABL_Cargo is the control from this window (the one not recognized)

I have checked the spelling, besides the script was "recorded" not entered by hand.
Any help, suggestions, how to make EmulateInput() recognize controls in external components ?

Or may be the Automatic Testing of Windows in WD is just a time wasting shitty trap for suckers like me.

Thanks in advance
/Jacek
Re: WD24: EmulateInput() doesn't recognize controls from external components
April 07, 2021 05:13PM
Hi, I never used the test functions but, maybe, you should set the Window name in front of the component's name?

MyWindowName.cmp_wdWS50DictSQL.WIN_SelectCargo.TABL_Cargo

Kind regards,
Guenter Predl
office@windev.at
Re: WD24: EmulateInput() doesn't recognize controls from external components
April 08, 2021 09:19PM
Hello Guenter,

What a wonderful idea. You must have gained an insight into that mysterious process in which a French mind decides what is intuitive and what is not. Sorry francophiles, I'll be in a much better mood tomorrow morning.
Anyway, it did not work.

Alas your idea has switched something in my brain and I have changed test mode configuration (Menu: Project >Test mode > Configure the test mode) of that inner external component (cmp_wdWS50DictSQL).
The change was to tell the component that it will be tested via another project. The documentation (under "Debugging an external component") says that this change is needed when you want to debug the component from another project (it never worked for me). I'm not mad, it's just that the documentation is only a suggestion of a direction. Whatever.
It worked.

Solution in plain English:
When you do automatic tests of a component A window that calls a component B window, remember to select "Run the test of the component from another project" in "Configure the test mode" of the component B.

Thanks Guenter, I would not get it running without you.
I'll be honored to have a beer or coffee with you when the pandemics is gone and you happen to pass through my part of the world.

All the best
Stay healthy
/Jacek
Re: WD24: EmulateInput() doesn't recognize controls from external components
April 09, 2021 08:23AM
Hi Jacek,

I'm happy about providing a solution! I'm used to adding the window's name to controls / components etc. One can open a new window and take values from the controls of the previous window. There is even the function

// Name of the previous window
ResPreviousWin = PreviousWin()

in WINDEV to find out the name of the previous window! So, one can open the same window from several windows and you can always refer to the controls of the previous window!

Kind regards,
Guenter Predl
office@windev.at



Edited 1 time(s). Last edit at 04/09/2021 08:26AM by gpredl.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: