This is a migrated thread and some comments may be shown as answers.

Run a key press event before or during application initialisation

3 Answers 83 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jakob
Top achievements
Rank 1
Jakob asked on 20 Sep 2016, 07:38 AM

Hi,

 

The issue I currently have is a little tricky to explain, so feel free to ask for clarification :)

I’m running wpf. tests on an in-house application. Our application uses integrated logins, so usually when I do standard workflows, I let the app login automatically with my personal credentials. However, at times I need to log in as a different user. In daily use we do this by holding down F2 to break the integration and allow manual login.

Previously I could accomplish this during testing by a small coded step with a keyboard.keyUp/Down event. However, this only worked because of an old inherent error in the test application that would cause the initialisation of the application to be halted until a dialogue was accepted, allowing us to insert the keyboard event before full app boot up.

And now we get to the issue at hand: Since I updated to current version of Test Studio and Runtime, that particular error message caused TS to lose focus on start-up and the tests failed because of this. The developers then fixed the error, so the message would not appear and the tests would run alright. BUT, without the error message dialogue, the initialisation of the application is not paused by anything, and the keypress event doesn’t happen at the critical point. Thus, I never get the login box and am not able to proceed with these particular tests.

So, based on this, can you think of a way to introduce the F2 key event at the moment of initialisation? Or alternatively, is there a way to pass arguments to execute the application so we can program a different start-up behaviour depending on the test?

 

Thank you,

Jakob

3 Answers, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 22 Sep 2016, 12:24 PM
Hello Jakob,

The described scenario is not a common one though I will try to be of help for you. Test Studio offers a feature to include custom scripts before or after a test run. You could implement such in your project and press the F2 key in code. The line of code you need would be: 

Manager.Desktop.KeyBoard.KeyPress(Keys.F2, 50, 1);

You should consider that in the context of wpf test this will work in the following order - the application will be started, the custom script will be executed and then the execution of the test will start. Would that work for you? 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Jakob
Top achievements
Rank 1
answered on 22 Sep 2016, 03:39 PM

Hi Elena

 

Thank you for trying, but this will not work (we tried it just be sure, but no). We are already using the keypress(Keys.F2), problem is that we need it to take place before or at the same time as the application starts, because we need it to interrupt the normal login step. 

 

Regards,
Jakob

0
Elena
Telerik team
answered on 26 Sep 2016, 01:32 PM
Hi Jakob,

I am sorry to hear my suggestion did not work for you. I understand what you actually require however I am not sure this could be obtained. Though I have one more idea that might work. At the beginning of the test you could add a coded step in which you could kill the started application and start it in code again but this time in the context of the execution. Would that be possible? 

Please keep me posted. 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Jakob
Top achievements
Rank 1
Answers by
Elena
Telerik team
Jakob
Top achievements
Rank 1
Share this question
or