Zum Inhalt springen

Just about .Net

It's just a blog about .Net…

Archiv

Kategorie: MS Test

A colleague of mine asked me this week how he can emulate special keys in Coded UI Tests. I knew that I wrote that in my book but actually did not find the official reference in the MSDN. That’s why I will provide it here again.

The Keyboard class provides different methods with which you can send texts or key codes to the UI element currently selected. Some of these methods also allow the use of modifier keys like Ctrl or Alt.

Keyboard.SendKeys(“Message{ENTER}”);
Keyboard.SendKeys(“{F4}”, ModifierKeys.Alt);

All special keys are shown in the following list. They are usually surrounded by curly braces and can be part of any string (see also the example above).

Key Code
Backspace {BACKSPACE}, {BS} or {BKSP}
Pause {BREAK}
Capslock {CAPSLOCK}
Delete {DELETE} or {DEL}
End {END}
Return {ENTER} or ~
Esc {ESC}
Help {HELP}
Pos1 {HOME}
Insert {INSERT} or {INS}
Numlock {NUMLOCK}
Page Down {PGDN}
Page Up {PGUP}
Print {PRTSC}
Scrollock {SCROLLLOCK}
Tab {TAB}
F1… {F1}
Cursor up {UP}
Cursor down {DOWN}
Cursor left {LEFT}
Cursor right {RIGHT}
Addition (num block) {ADD}
Subtraction (num block) {SUBTRACT}
Multiplication (num block) {MULTIPLY}
Division (num block)) {DIVIDE}

2010/2011 Roy Osherove wrote in his blog a sentence which summarizes an opinion you can still find in many other blogs: „MSTest is the IE6 of Unit Test Frameworks.“ . He basically says, that MS Test has a lack of functionality when it comes to unit testing and I agree with him with one exception:  I think it is not primarily a unit testing framework, it is a test automation framework but lets start with a comparison.

Continue reading “„MS Test the IE6 of Unit Test Frameworks?“” »

Do you know how to separate the knowing from the naive, the pros from the amateurs and the men from boys? It’s just by their reaction in certain situations. It’s the cold shivering and slight cough they get if you just whisper a single word, a word like “DeploymentItem”.

So what causes these reactions? Mortals would call it an attribute in MS Test. The most demonic one I have to add. If used, it defines external resources which shall be provided during a test run. Following test case shows the basic idea behind it. You say: “Deploy the file.” and Visual Studio deploys it for you, at least it should…

Continue reading “DeploymentItem - A tale of the unexpected…” »