Firstly I am using VS2013 Winforms .net 4.0.
After excluding all other possibilities (from my set of possibilities) the culprit appears to be Me.close() in one specific form. After the me.close() method executes the coded-ui-test application seems to freeze and does not give any feedback about the buttons i am pressing or text i am entering. When I ask it to generate the code it goes as long as 1 hour before I decide to give up and kill the process. When I try the same test without the me.close it works as expected. Does anyone have any idea how to fix this bug in the automated ui testing? If not can you suggest any alternatives please?
Edit: This does not happen when I simply press the forms 'X' button in the top right. This is very strange.
Edit2: I have tried this in a fresh project. It is indeed me.close that causes the coded ui test application to 'freeze' such that I cannot generate the automated code and I will end up stuck at the 'please wait' loading bar.
Edit3: It appears to be specific to calling me.close in an infragistics click handler of a ultrabutton. Wow, here is example.
Designer
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class closemepls Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.UltraButton1 = New Infragistics.Win.Misc.UltraButton() Me.SuspendLayout() ' 'UltraButton1 ' Me.UltraButton1.Location = New System.Drawing.Point(45, 47) Me.UltraButton1.Name = "UltraButton1" Me.UltraButton1.Size = New System.Drawing.Size(232, 157) Me.UltraButton1.TabIndex = 0 Me.UltraButton1.Text = "UltraButton1" ' 'closemepls ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(284, 262) Me.Controls.Add(Me.UltraButton1) Me.Name = "closemepls" Me.Text = "closemepls" Me.ResumeLayout(False) End Sub Friend WithEvents UltraButton1 As Infragistics.Win.Misc.UltraButton End Class Code
Public Class closemepls Private Sub UltraButton1_Click(sender As Object, e As EventArgs) Handles UltraButton1.Click Me.Close() End Sub End Class If I call closemepls.showdialog() and click the button the coded ui test application freezes! Infragistics FTW.
This is the result, it does not complete even after 1 hour.
3 Answers
Answers 1
I had problems like that in WPF before.
Here's how I found it: Comment everything out then find the code that causes the problem by adding blocks back one by one.
It's something that is binded (anything though, not data and more than likely a control) not being released.
Answers 2
I haven't tried mixing CodedUI and VB much, but I was hoping this question may help you:
Alone, that doesn't mean much, right? But in conjunction with how CodedUI works it may provide a clue. Remember that when you're running a test you're technically initiating a UITesting.Playback, which is a process. You may want to add something to your TestCleanup method that makes sure all the processes are terminated, like so (Keep in mind that this is for a browser test):
/// <summary> /// Closes the test browser and ends test playback /// </summary> [TestCleanup]//The decorator is what makes this a method a test cleanup public void CleanTest() { if (Playback.IsInitialized) //This is the important part. { Playback.Cleanup(); } if (browserWindow.Exists) { browserWindow.Close(); } } This is just a shot in the dark and I may even be misunderstanding what you need, really but I'm assuming that in both your real and example areas you're closing the entire application? This may be a question for Infragistics at the end of the day. Good luck!
Answers 3
This might be the same issue I've experienced when using MTM, on a few machines if they were running any form of capture for the resulting test. They where trying to save it to a illegal path(Found in Event Viewer). After performing a repair on VS thus MTM to was repaired and it worked for some machines. Others only seamed to be fixed when going to update 4.
But code wise I would suggest trying to click the close button on the form itself to see if you get a different behavior.
Dim closeButton = New WinButton(YourWindow); closeButton.SearchProperties(UITestControl.PropertyNames.Name) = "Close"; Mouse.Click(closeButton);
0 comments:
Post a Comment