Telerik Forums
Testing Framework Forum
4 answers
165 views
Hello,

I have a couple of issues I'm currently wresting with. 

To start, I'm writing "code only" tests - I only have access to the API, not the full Test Studio. So please, code-only responses.

I have a Silverlight application. It consists of many individual pages with Silverlight (and custom and 3rd party) controls on them. I'm writing a "smoke test" that just iterates through the pages of the application (each URI is kept in the database. In my test I open a connection to the database, read the URI column from the Menu table, construct the full path to the resource and use ActiveBrowser.navigateTo(URI) to go to that page) - the issue is twofold: 

If a page has an exception on it (which is what I'm testing for - pages that throw exceptions when you attempt to load them) it will bring up a dialog box with the exception info on it. How do I capture that dialog and retrieve information from it? It's hard to explain the exact nature of this dialog box - it's not a custom dialog box that we wrote, it's just the 'generic' Silverlight "Error Occured" dialog box which has the exception and a 'drop down button' which, when clicked, opens up a text area with the full exception description on it. Another way of looking at it is: I want to trap (or list or write to Console) every page that throws this type of dialog so I know when pages fail to load (or throw an exception) in my app. Like I said, this is a "smoke test" that simply loads each page in our application and makes sure there are no exceptions encountered. When I do encounter an exception, how do I "mark" it as such or extract information from it?

The second part of the question also has to do with dialog boxes - this time, we have certain pages that, when you navigate to them, the first thing they do is bring up a modal dialog box (actually it's just a control, not of type Modal Dialog box or anything) - basically it can be thought of as just a Modal Silverlight window that is brought up upon page load - I know which pages do this (they all have a certain string present in their URI which I can code for in the test and have already done so) and can attach an event handler or something upon encountering one... but the code I copped from your web site doesn't quite work for me: 

public void DoCustomDialogHandlingForBuiltInDialogs()
 {
    AlertDialog myAlertDialog = new AlertDialog(ActiveBrowser, DialogButton.OK);
    myAlertDialog.HandlerDelegate = new DialogHandlerDelegate(MyCustomAlertHandler);
   
    // Add dialog to monitor and start monitoring
    Manager.DialogMonitor.AddDialog(myAlertDialog);
    Manager.DialogMonitor.Start();
   
    Actions.InvokeScript("InvokeAlert()");
   
 }
   
///<summary>
/// Custom dialog handler delegate
///</summary>
///<param name="dialog">The dialog to handle</param>
///<returns></returns>
public bool MyCustomAlertHandler(IDialog dialog)
{
    // Simply close the dialog
    dialog.Window.Close();
   
    try
    {
         // Wait until it is closed
         dialog.Window.WaitForVisibility(false, 50);
         Log.WriteLine("Alert Handled!");
         return true;
    }
    catch
    {
         Log.WriteLine("Failed to handle alert!");
         // return false if the dialog did not close as expected
         return false;
    }
}

I have connived this into my code but not sure what I've done is correct - I also had to change the return type of the Delegate to be "void" as the compiler complained that the method had the wrong return type. I just commented out the return statements.

Any help is appreciated as always. 

Thanks,

Jess

Jess
Top achievements
Rank 1
 answered on 03 Apr 2012
3 answers
107 views

<Hello,

 

I have a ASP.net project that uses also RadControls from Teletik.

I need to create an Automated GUI Test project that will be able to recognize both Telerik and simple HTML controls that ASP creates.

 

Please recommend a solution to create a Hybrid Test project that integrates both

“VS Test Project” (VS2010 default) and “VSUnit” (from Telerik WebAii Testing Framework)

For using in Automated GUI tests.

 

Best Regards.>

Cody
Telerik team
 answered on 02 Apr 2012
2 answers
168 views
Hello,

When I debug my tests I cannot see the value of various variables at runtime - I get a cryptic message:

"Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation."

I have this piece of code I'm testing:

foreach (TreeViewItem item in items)
            {
                //Find an item by its text content and expand the node
                if (item.Text == "TextContent")
                {
                    ToggleButton button = item.Find.ByType<ToggleButton>();
                    button.User.Click();
                }
            }

I set a break point on the if statement. I enter into debug mode, it hits my breakpoint and I hover over the item.Text but get that message described above.

The other reason I ask is that this test if failing - not sure if I need to replace the string "TextContent" with a value from the control I'm working with or if this is the actual condition I'm testing for - I took this code from another Telerik forum question on Tree controls that I have to test... so a bit unclear on that... I basically want to trigger a user selection on an element in a TreeView - "click" the "drop down arrow" next to an element in a TreeView. 


Any help on either of these two issues (or both) is appreciated.

Thanks in advance,

J

Jess
Top achievements
Rank 1
 answered on 29 Mar 2012
23 answers
417 views
I have the following code in an NUnit test:

var settings = new Settings {
    Web = new Settings.WebSettings {
        Browser = BrowserExecutionType.Chrome,
        BaseUrl = "http://localhost:19736/",
  EnableSilverlight = true
    }
};
 
var manager = new Manager(settings);
manager.Start();
manager.LaunchNewBrowser();
manager.ActiveBrowser.NavigateTo("/Default.htm");
var app = manager.ActiveBrowser.SilverlightApps()[0];

The test runs (using resharper runner), and a browser opens (saying "Preparing browser for automation..."). I get an timeout:

Uncategorized: DialogMonitor.Start() : Using: ArtOfTest.WebAii, Version=2011.1.712.0, Culture=neutral, PublicKeyToken=4fd5f65be123776c
Uncategorized: DialogMonitor.Start() : OS: Microsoft Windows NT 6.1.7601 Service Pack 1
DialogPlayback: Manager.SetupDialogMonitoring() : Beginning monitoring for dialogs from the set {}.
UIAutomation: UIAutomationWindowMonitor.get_Instance() : Added a(n) WindowPatternIdentifiers.WindowOpenedProperty handler on element System.Windows.Automation.AutomationElement scope Descendants.
Framework: DialogMonitor.Start() : The current ActiveBrowser is either invisible or disconnected.
DialogPlayback: UIAutomationWindowMonitor.HandleAutomationEvent() : New window detected, but not considered a dialog (Text = "WebUI - Google Chrome", ClassName = "Chrome_WidgetWin_0").
-> error: Wait for condition has timed out

Now I switch to Internet explorer browser, I get a blank IE window and:

Uncategorized: DialogMonitor.Start() : Using: ArtOfTest.WebAii, Version=2011.1.712.0, Culture=neutral, PublicKeyToken=4fd5f65be123776c
Uncategorized: DialogMonitor.Start() : OS: Microsoft Windows NT 6.1.7601 Service Pack 1
DialogPlayback: Manager.SetupDialogMonitoring() : Beginning monitoring for dialogs from the set {}.
UIAutomation: UIAutomationWindowMonitor.get_Instance() : Added a(n) WindowPatternIdentifiers.WindowOpenedProperty handler on element System.Windows.Automation.AutomationElement scope Descendants.
Framework: DialogMonitor.Start() : The current ActiveBrowser is either invisible or disconnected.
Framework: InternetExplorerActions.LaunchNewBrowserInstance() : Process launched (ID=4848, Path="C:\Program Files (x86)\Internet Explorer\iexplore.exe", Arguments="-nomerge about:blank").
Framework: Manager.LaunchNewBrowser() : Attempting to attach on IE frame (HWND=4263410)...
Error: [unknown]() : Unable to open key HKLM\SOFTWARE\Telerik
-> error: Exception thrown attempting to launch Internet Explorer. Please make sure Internet Explorer is properly installed and you are able to launch it.

Using Firefox:

Uncategorized: DialogMonitor.Start() : Using: ArtOfTest.WebAii, Version=2011.1.712.0, Culture=neutral, PublicKeyToken=4fd5f65be123776c
Uncategorized: DialogMonitor.Start() : OS: Microsoft Windows NT 6.1.7601 Service Pack 1
DialogPlayback: Manager.SetupDialogMonitoring() : Beginning monitoring for dialogs from the set {}.
UIAutomation: UIAutomationWindowMonitor.get_Instance() : Added a(n) WindowPatternIdentifiers.WindowOpenedProperty handler on element System.Windows.Automation.AutomationElement scope Descendants.
Framework: DialogMonitor.Start() : The current ActiveBrowser is either invisible or disconnected.
Framework: FireFoxActions.FindFireFoxInstallation() : Valid Firefox 4.0.0.1 installation found at "C:\Program Files (x86)\Mozilla Firefox\firefox.exe".
-> error: Wait for condition has timed out

What am I doing wrong? I've tried installing the test framework again

Thanks,
Jon


Cody
Telerik team
 answered on 26 Mar 2012
1 answer
142 views

We use WebAii on a small team for our (HTML) website automation. After recently upgrading from version 2010.3.1421.0 to 2011.2.1305.0 and having a mostly issue-free experience, we have run into a blocking issue for one person on our team. The new version is having trouble communicating with the browser after it launches and the page loads -- this is only on a single tester's machine. Other testers run his same code with the same build and it works without issue. If he changes his references to point back at the old version, the issue does not happen.

When I trace it as far as I can, we make a call into the Click() method on a link element and 5 minutes later the below exception comes back. Are there any known issues that could cause the following exception?

ExecuteCommand failed!
BrowserCommand (Type:'Action',Info:'NotSet',Action:'Click',Target:'ElementId (tagName: 'a',occurrenceIndex: '10')',Data:'',ClientId:'Client_6ca9905c-e6c3-418c-a61f-f0cc631792fd',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'False',Response:'')
InnerException: System.IO.IOException: Pipe is broken.
at System.IO.Pipes.PipeStream.WinIOError(Int32 errorCode)
at System.IO.Pipes.PipeStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.Pipes.PipeStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at ArtOfTest.WebAii.Messaging.Process.PipeCommunication.WriteCommandToPipe(PipeCommand command, PipeStream pipe, Boolean waitForDrain)
at ArtOfTest.WebAii.Messaging.Process.BrowserRemoted.ProcessBrowserRequest(BrowserCommand command, String requestId)
at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)

The machine is Windows Server 2008 R2 with IE9 installed; we all run the same versions of Windows, IE, and Visual Studio. There were no code changes associated with the switch to the new version that we had to revert, so nothing in our stack has changed.

Let me know if there is a way to collect more detailed logs for investigating this issue.

Regards,
Nick

Cody
Telerik team
 answered on 23 Mar 2012
3 answers
106 views
After installing latest release, user.Click() doesn't work on silverlight app in browser. I have turned on anotator ant it shows that it clicks in right place. Can anyone help me?
Ivaylo
Telerik team
 answered on 22 Mar 2012
7 answers
373 views
Hey all,

I have another problem with my deployment of my WebAii.  It seems I've lost control of my mouse (and keyboard) events.  I can see the Annotation telling me that it's clicking the element on my screen, but the click isn't respected.

Any ideas as to what can be going wrong?

I've tried a few suggestions based on my research:
manager.Desktop.Mouse.Click(MouseClickType.LeftClick, System.Drawing.Rectangle.Round(element.GetScreenRectangle()));
element.User.Click(MouseClickType.LeftDown);
Thread.Sleep(50);
element.User.Click(MouseClickType.LeftUp);

I always see the annotation telling me it's being clicked, and it's on the correct element, but again, nothing happens.
Asta
Top achievements
Rank 1
 answered on 21 Mar 2012
5 answers
134 views
I have a 3rd party DataGrid (ComponentOne) that I need to extract the values of it's cells using the Test Framework. Not sure how to go about it. I'm somewhat new to the Test Framework so bear with me. I have used the FrameworkElement before and have used AutomationProperty to get a field off a 3rd party control before but am not sure how to work it with the DataGrid as it returns a Collection that I want to iterate over and get values off the individual cells. They're text cells so they're not holding anything fancy. 

Thanks!!

Anthony
Telerik team
 answered on 21 Mar 2012
12 answers
744 views
Currently using a while loop to check for a variable to not be null and using thread.sleep(250) to wait after checking if it is.  Cannot find a better way to do this, does anyone have any ideas?

[CodedStep(@"Find and click on course link")]
  public void FindAndClickOnCourseLink()
  {
                  string textContent = ((string)(System.Convert.ChangeType(Data["CourseName"], typeof(string))));       
        
                  HtmlAnchor expectedLink = null;
       
                  var attempts = 0;
       
                  while (expectedLink == null)
                  {
                      var rows = Find
                          .ById("activitiesTable")
                          .As<HtmlTable>()
                          .AllRows;
       
                      expectedLink = rows
                          .Select(row => row.Cells[0].Find.AllByContent<HtmlAnchor>(textContent).FirstOrDefault())
                          .Where(a => a != null)
                          .FirstOrDefault();
       
                      attempts++;
                       
                      //TODO: This is not very elegant but it works, needs something better.
 
                      if (attempts > 20)
                      {
                          break;
                      }
       
                      System.Threading.Thread.Sleep(250);
                  }
       
                  expectedLink.Click();
              }
  }
Cody
Telerik team
 answered on 20 Mar 2012
1 answer
110 views
i have a recorded test for Sliverlight application (clicking by  menu item ,surfing on sub-menu ).time after time application shows modal dialog window with button "Save" and "Discard" , for example, there is autosaving or data was changed by another user.And test is stucking on this stage, application is waiting for confirmation.how i can close showing dialog windows after every step, or clicking "SAve" at this dialog?
Anthony
Telerik team
 answered on 20 Mar 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?