Friday, August 24, 2012

Pixel and color friendly Firefox Addons

This 2 tools are of huge help when you need to validate colors and sizes in a pixel perfect application :

1. https://addons.mozilla.org/en-US/firefox/addon/measureit/
- you can see code behind
- you can see a cool 3D layered image of your application

2. https://addons.mozilla.org/en-us/firefox/addon/pixelzoomer/
- perfect for measuring sizes
- accurate color picker

Thursday, August 23, 2012

Coded UI - Find link in browser page

Imagine the following scenario:

You need to get all links in a page that share a Property value.


 this.TestRunner.UIMap.UIMozillaWindow.UIItemList.UIHyperlink.WaitForControlExist();
 UITestControl window = this.TestRunner.UIMap.MozillaWindow;            
 window.SearchProperties.Add(BrowserWindow.PropertyNames.ClassName, "MozillaWindowClass");

WinEdit section = new WinEdit(window);
section.SearchProperties.Add(WinEdit.PropertyNames.ControlType, "Edit", PropertyExpressionOperator.Contains);


UITestControlCollection links = section.FindMatchingControls();
foreach (UITestControl x in links)
{                
 // anything you need to do
 MessageBox.Show(x.Name.ToString());
}


Tuesday, August 21, 2012

Coded UI - Close process by process name


This is an example to close Firefox, but can be used for any other process:

//close Firefox
            Process[] processes = Process.GetProcessesByName("firefox");
            foreach (Process process in processes)
            {
                process.Kill();
                process.WaitForExit();
            }  

Coded UI - Add messages in Results

If you need messages in Results:

Assert.Fail("Login page not available"); - test will fail and the message will be displayed in Results
this.TestContext.WriteLine("Login page available"); - test will pass and the message will be displayed in Results

Coded UI - Select text and replace


This is useful sometimes:

Mouse.Click(this.TestRunner.Login.UIMozillaWindow.UIItemDocument.UIGeneralPasswortEdit);
Keyboard.SendKeys(this.TestRunner.Login.UIMozillaWindow.UIItemDocument.UIGeneralPasswortEdit, "A", ModifierKeys.Control);
Keyboard.SendKeys("1234567");   

Monday, August 20, 2012

"Conversation in the Cathedral" by Mario Vargas Llosa


    It's been a while since I wrote about books. Maybe too long, I've read 2 books, but found no time to write about them.

    Chronologically, "Conversation in the Cathedral" by Mario Vargas Llosa is the first.

    This was one of my personal, hardest to read, books. Many times I found myself lost in the action and had to return few paragraphs to confirm what was happening.
The story is like a puzzle, only that Llosa connected the pieces in a long straight line. Try to see the final picture J
Even if it is a book of not so many pages, it took the longest to read. It was a busy period for me too, but still.

    How about if I liked it? Well… that’s also hard to say.
There are 2 leading characters Zavalita and Ambrosio.
Zavalita(Santiago Zavala) is the son of don Fermin (a wealthy man during the Odria dictatorship) and Ambrosio is one of don Fermin’s drivers.
The story starts at the end, when the 2 meet at “The Cathedral” pub. They start talking about the past and how their lives turned out.
About here the maze starts.

    Born in a wealthy family, Santiago refuses the benefits all his life. He denies his family and goes into the world on his own, living in mediocrity.
Somehow, I got the feeling he was mostly happy with his decisions.

    Ambrosio, on the other hand, as don Fermin’s driver, is thrown deeply in the high society intrigues.
He knows about all the ugly stuff. The political manipulation and deceits, about the whores and illegal luxury, about the killers and the dark secrets of his employer.
One lives in his ignorance and the other in fear.

    It is an interesting book, if you consider the way it’s written. It’s not pleasant to read if you consider the action and the characters.
In the end you feel disappointment; of the world Llosa presents or of the world we live in, I don’t know.

    This is the point where I’ll take a break from Mario Vargas Llosa, cool down and read some fantasy.
Something like “Song of ice and fire” series by George R. R. Martin. I have already read the first book “A Game of Thrones”. When I get some time I will write about it.

Keep reading! :)