Click here to Skip to main content
12,352,739 members (62,856 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

5K views
Posted

Coded UI tests: Visual Studio Crashed while moving code from UIMap.Designer.cs to UIMap.cs from Coded UI Test Editor

, 10 Dec 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
Few days ago I encountered an error. When I try to move a recorded function from UIMap.designer.cs to UIMap.cs, visual studio got crashed. I was unable to find why it stopped working correctly. After searching on forums etc I still get no clue. Then I begin to inspect my code files and loaded a prev

Few days ago I encountered an error. When I try to move a recorded function from UIMap.designer.cs to UIMap.cs, visual studio got crashed.

I was unable to find why it stopped working correctly. After searching on forums etc I still get no clue.

Then I begin to inspect my code files and loaded a previous version of my solution and compared it to my current version. After few hours I was able to find the root cause.

The code written in the UIMAP.cs file should be in a specific order. The code should start like this.

*******************************************************************************
 namespace Saad.Maps.DMap
{
    using Microsoft.VisualStudio.TestTools.UITesting.WinControls;
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Windows.Input;
    using System.CodeDom.Compiler;
    using System.Text.RegularExpressions;
    using Microsoft.VisualStudio.TestTools.UITest.Extension;
    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
    using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse;
    using MouseButtons = System.Windows.Forms.MouseButtons;
    
    public partial class UIMap

    {

**********************************************************************

and my file was like that….

**********************************************************************
    using Microsoft.VisualStudio.TestTools.UITesting.WinControls;

    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Windows.Input;
    using System.CodeDom.Compiler;
    using System.Text.RegularExpressions;
    using Microsoft.VisualStudio.TestTools.UITest.Extension;
    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
    using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse;
    using MouseButtons = System.Windows.Forms.MouseButtons;
     
namespace Saad.Maps.DMap
{
    public partial class UIMap
    {
***********************************************************************

Yeah, can you note the difference.

The using clause should come under namespace clause. If it is not the case , then coded ui test editor will not be able to move code in that UIMAP.cs file. If you correct the code sequence in the UIMAP.cs file and write using clause under namespace clause then you will be able to move code successfully.

I hope it will help somebody and this post should help Microsoft to remove that bug too.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

joinsaad
Tester / Quality Assurance
Pakistan Pakistan
Working as a Testing Automation Engineer.

You may also be interested in...

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160621.1 | Last Updated 10 Dec 2012
Article Copyright 2012 by joinsaad
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid