Pages

Monday, January 20, 2014

The old True, False, NULL problem

Say you've got an application where a new check box was added to the screen and a new column was added to the table. The possible values of the check box are are True and False. Maybe the existing rows in the table are set to NULL when the new column is added.

Are existing rows updated?

Does the column have a default value?

Does the application break on rows where the column is set to NULL?

I think existing rows should be set to True or False, but sometimes they're not.

It seems confusing if NULL is being interpreted as True or False.

Just something to check for.

Thursday, January 2, 2014

CodedUI test - check for existence of dialog


If the application has a dialog that is only displayed in certain cases you can write a custom method to execute commands when the dialog exists. This application has a dialog that is only displayed if an add-in could not be loaded.

Execute certain commands when dialog exists:

1. Record the assertion and action on the dialog.

2. Write a new method in UIMap.cs to check for existence of the dialog and execute the recorded assertion and the recorded action.

3. Move calls to the recorded assertion and recorded action from CodedUITest.cs to new method in UIMap.cs.

if (dialog.Exists)
{
    AssertDialogRecorded();
    DialogActionRecorded();
}


4. Add a using statement to UIMap.cs for Microsoft.VisualStudio.TestTools.UITesting.WinControls:


5. Call the custom method from CodedUITest.cs in place of the recorded assertion and the recorded method.
this.UIMap.ClickOKIfDialogExists();


Tuesday, December 31, 2013

TestContext.BeginTimer() not writing to test output in VS2013


I am running Visual Studio 2013 Ultimate and can't get TestContext.BeginTimer("TimerName"); and TestContext.EndTimer("TimerName"); to write to the Output window of a CodedUI Test.

This post has a good solution to the issue.

I want to log the duration for groups of test steps.

First I tried writing a logger class and sending the duration to a text file.

This way seems easier to me:

1. Open the Coded UI Test .cs file and add a using statement for System.Diagnostics;


2. Create new instance of Stopwatch and give it some name (Timer in the example), add Timer.Start(); and Timer.Stop(); statements around actions that you're logging duration of, then add statement to write to test output TestContext.WriteLine("Description: " + SomeName.Elapsed.ToString());


3. Reset the timer next time and you can reuse it:


4. Run the test from Test Explorer, select the CodedUITestMethod in the upper pane under Passed Tests, and then click the Output link in the lower portion to view duration.

5. The output window will also show debug trace messages if EqtTraceLevel is set to 4 in QTAgent32.exe.config. TestContext messages are below the Debug Trace messages.



Wednesday, May 16, 2012

Reset Selected Radio Button using JavaScript


You could use JavaScript to reset a selected radio button and test if a value is required on update. 

Here's a description of running JavaScript in the IE Developer Toolbar to clear a radio button for a web app or web site.
  1. View page source and search for radio to find the element name where checked = True
  2. Copy paste the element name "radio1" text in the JavaScript below
  3. to open Developer Toolbar
  4. Click the Script tab
  5.  Copy paste script to console on the right and click “Run Script” to set the selected radio button to false 

Tuesday, June 14, 2011

Microsoft Test Manager - Test Scribe Power Tool


I read about this Power Tool at Safari Books Online “Software Testing with Visual Studio 2010”.


Requires MS OpenXML SDK 2.0 (installed if missing)

Requires Office 2010 (not installed if missing)

This adds the Tools menu to Test Manager where you can view the test run summary in grid format. Select one or more Test Cases and generate a Test Run Summary Report.