The menu bar exist almost immediately, but is disabled while initialization is being performed on a worker thread. When the worker thread comes back, then the menu bar state is changed from disabled to enabled. the user (and Ranorex) may now proceed to use the Explorer.
I think we are talking passed each other. How do perform the task you described?
Currently, I have 2 validation steps after the line that starts up the application:
Validate exists on MainMenuBar with a duration of 1 minute
Validate Enabled on MainMenuBar with a duration of 4 minutes
The behavior of Ranorex is:
1) Waits 1 full minute regardless of whether the MainMenuBar exists or not. On a fast machine the wait is 55 seconds too long. On a slow machine the wait is 20 seconds too long.
2) Tests for existence of the MainMenuBar (passes)
3) Waits 4 full minutes regardless of whether the MainMenuBar is enabled or not. On a machine connected to a network with a few dozen sensors the wait is about 3 minutes and 30 seconds too long. On a machine connected to a network with hundreds of sensors the wait is about 30 seconds too long.
4) Tests the Enabled attribute of the MainMenuBar for a current state of TRUE (passes)
If I run with Shift-Pause (no -pauses), then the test does not run at all because the test for existence is performed before the menu bar has is created. The screen capture of the failure is the splash page.
If I wait until the menu bar is up before hitting SHIFT-Pause (while the execution is dawdling with the first 1m duration), then the Validate.Enabled fails because the test on the attribute state is performed immediately which is before the initialization is done. Yes after 15 seconds the menu bar is not enabled. After 2- 3 minutes it is enabled.
The duration settings seem to be arbitrary long poles within the test execution. How is a test case supposed to maintain synchronization with the application under test if the test script cannot detect simple state transitions? State transitions such as:
Not Exist -> Exists
Disabled -> Enabled
Enabled -> Disabled
Hidden -> Visible
The duration parameter set within the studio seems to be a fixed delay, not a specification of the maximum time out within which the desired state transition must occur.
Here is the code generated by the studio:
Code: Select all
Mouse.DefaultMoveTime = 300;
Keyboard.DefaultKeyPressTime = 100;
Delay.SpeedFactor = 1.0;
Init();
Report.Log(ReportLevel.Info, "Application", "Run application 'C:\\Program Files (x86)\\Cognex\\In-Sight\\In-Sight Explorer 5.1.0\\In-Sight Explorer.exe' with arguments '' in normal mode.", new RecordItemIndex(0));
Host.Local.RunApplication("C:\\Program Files (x86)\\Cognex\\In-Sight\\In-Sight Explorer 5.1.0\\In-Sight Explorer.exe", "", "C:\\Program Files (x86)\\Cognex\\In-Sight\\In-Sight Explorer 5.1.0", false);
Delay.Milliseconds(1000);
Report.Log(ReportLevel.Info, "Validation", "Validating Exists on item 'ExplorerForm.MainMenuBar'.", repo.ExplorerForm.MainMenuBarInfo, new RecordItemIndex(1));
Validate.Exists(repo.ExplorerForm.MainMenuBarInfo);
Delay.Milliseconds(60000);
Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (Enabled='True') on item 'ExplorerForm.MainMenuBar'.", repo.ExplorerForm.MainMenuBarInfo, new RecordItemIndex(2));
Validate.Attribute(repo.ExplorerForm.MainMenuBarInfo, "Enabled", "True");
Delay.Milliseconds(240000);
What do I change within Recording1.rxrec (e.g the properties dialog boxes within the recorder) so the generated code is as you suggest? So the generated code within recording1.cs becomes:
Code: Select all
Mouse.DefaultMoveTime = 300;
Keyboard.DefaultKeyPressTime = 100;
Delay.SpeedFactor = 1.0;
Init();
Report.Log(ReportLevel.Info, "Application", "Run application 'C:\\Program Files (x86)\\Cognex\\In-Sight\\In-Sight Explorer 5.1.0\\In-Sight Explorer.exe' with arguments '' in normal mode.", new RecordItemIndex(0));
Host.Local.RunApplication("C:\\Program Files (x86)\\Cognex\\In-Sight\\In-Sight Explorer 5.1.0\\In-Sight Explorer.exe", "", "C:\\Program Files (x86)\\Cognex\\In-Sight\\In-Sight Explorer 5.1.0", false);
Delay.Milliseconds(1000);
Report.Log(ReportLevel.Info, "Validation", "Validating Exists on item 'ExplorerForm.MainMenuBar'.", repo.ExplorerForm.MainMenuBarInfo, new RecordItemIndex(1));
repo.ExplorerForm.MainMenuBarInfo.WaitForExists(new Duration(60000));
Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (Enabled='True') on item 'ExplorerForm.MainMenuBar'.", repo.ExplorerForm.MainMenuBarInfo, new RecordItemIndex(2));
repo.ExplorerForm.MainMenuBarInfo.WaitForAttributeState("Enabled", true, new Duration(240000));
I don't see any method within the RepoItemInfo class analogous to WaitForExists() such as WaitForAttributeState().
The suggestion:
Code: Select all
Then simply call this code...
Duration newDuration = new Duration(240000);
repo.ExplorerForm.MainMenuBarInfo.WaitForExists(newDuration);
seems to be that I become a developer an write the C# code myself.
What is the point of the recorder generating C# code for use non-developers, if I have to mutate and maintain the generated C# code directly from that point on?