locked
CUIT, UIMap not saving in Coded UI Test Editor or building with Coded UI Test Builder RRS feed

  • Question

  • Hello,

    As stated in the subject, I have a UIMap that is not saving when I try to edit it using the Coded UI Editor. The error I'm getting when I try to save the .uitest in the Coded UI Editor is "Value cannot be null. Parameter name: key".

    When I ran into this error I thought to myself no big deal I'll just make the changes using the Coded UI Test Builder. When I try to use the Coded UI Test builder to make my changes I get an error when I'm trying to identify the properties of any item on an IE page. The error causes the tool to crash and launch a debugger for the CodedUITestBuilder. 

    I did modify the XML of the UIMap.uitest directly to make some bulk changes(all I did was add a conditional operator for each link(Href,PageURL, etc) so the code would account for different environments of the system I'm testing. 

    I cannot seem to find any similar issues to this which s why I'm creating this post. Please let me know if I need to provide any additional information to help.

    I will post the Stack trace associated with the Coded UI Test builder debugger.

       at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Delegate.DynamicInvokeImpl(Object[] args)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at Microsoft.VisualStudio.TestTools.UITest.CodedUITest.CodedUITestBuilder.Program.Main(String[] args)

    Thanks for any help,

    Matt

    Tuesday, April 9, 2013 4:10 PM

Answers

  • The uimap.uitest file is XML. Possibly the file is corrupt, there may be a missing attribute or field in the file. Could the file have been edited using a text editor?

    Do you have old versions of the file, in backups or configuration control? If yes then you could try to find an old version that can be edited and saved. Next compare that as a text file against the version that will not save. Ideally compare versions that have the smallest number of changes between 'will save' and 'will not save' versions.

    If no old versions available then (make sure you save plenty of backups while doing this) using the uimap editor delete half the contents of the uimap.test file and try to save it. If the save works then the faulty area has been deleted. Restore from the save and only delete half of what was previously deleted. Save again. If the save fails then the fault is in the part still there. Delete some more and try again. Keep deleteing, saving, restoring as necessary until you find a small change between 'will save' and 'will not save' versions. Compare the corresponding XML files and compare the differences against sections of XML that save OK. Hopefully you will find some faulty XML.

    Regards

    Adrian

    • Marked as answer by Matt Stoker Wednesday, April 10, 2013 6:36 PM
    Wednesday, April 10, 2013 4:13 PM

All replies

  • Hello,

    Thank you for your post.

    If you restart your PC and re-open the VS as Admin, and create a new coded UI test project and record the action for this app, and then you change the similar thing in Coded UI Test Editor or Coded UI Test Builder, whether it has the same issue? Maybe you could try to record the test for a simple app, for example the “Calculator”, and then check the result.

    If all apps have the same issue, I doubt that it is related to your VS, then I suggest that you try to repair VS. But if just the specific app has this issue, I’m afraid that it is related to your APP. Of course, if you have different Environment, you could try to record the test for the same APP with another PC and narrow down this issue.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 10, 2013 6:16 AM
  • Hi Amanada,

    I am able to edit any other UIMap.uitest files just fine and have everything work. I am only having issues with this particular UIMap.uitest. Unfortunately recording the entire App again would be a large amount of work and I would like to avoid that if possible which is why I'm searching for a solution. So we seemingly have eliminated the possibility that it is a PC or App problem. 

    Edit: When using the Coded UI Test Builder and I hit the generate code button(without actually making any changes) I get the same error: "Value cannot be null. Parameter name: key". 

    It also appears that the UIMap.Designer file hasn't been updated to reflect the changes I added via the XML version of UIMap.uitest. Not sure how the UIMap.Designer gets updated but I assume something isn't happening correctly when I made the changes to the XML.

    Any other suggestions?

    Thanks for the help thus far,

    Matt

     
    • Edited by Matt Stoker Wednesday, April 10, 2013 2:35 PM
    Wednesday, April 10, 2013 2:01 PM
  • The uimap.uitest file is XML. Possibly the file is corrupt, there may be a missing attribute or field in the file. Could the file have been edited using a text editor?

    Do you have old versions of the file, in backups or configuration control? If yes then you could try to find an old version that can be edited and saved. Next compare that as a text file against the version that will not save. Ideally compare versions that have the smallest number of changes between 'will save' and 'will not save' versions.

    If no old versions available then (make sure you save plenty of backups while doing this) using the uimap editor delete half the contents of the uimap.test file and try to save it. If the save works then the faulty area has been deleted. Restore from the save and only delete half of what was previously deleted. Save again. If the save fails then the fault is in the part still there. Delete some more and try again. Keep deleteing, saving, restoring as necessary until you find a small change between 'will save' and 'will not save' versions. Compare the corresponding XML files and compare the differences against sections of XML that save OK. Hopefully you will find some faulty XML.

    Regards

    Adrian

    • Marked as answer by Matt Stoker Wednesday, April 10, 2013 6:36 PM
    Wednesday, April 10, 2013 4:13 PM
  • Adrian,

    That was very helpful and an idea I had not thought of! I found the Control items that were in fact having issues and was able to go in and fix them through the UI Editor.

    What caused the issue in the first place was during my Find and Replace of environment specific names I removed some Friendly Names and ID's in a specific control. As soon as these were replaced everything started working just fine again. Thanks for the help!

    All the best,

    Matt

    Wednesday, April 10, 2013 6:36 PM