This is a migrated thread and some comments may be shown as answers.

Sample testcase: SilverlightHealthcareSample.cs crash when running in FireFox 12.0

2 Answers 50 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
kwee
Top achievements
Rank 1
kwee asked on 19 May 2012, 12:33 AM
 Hi,

 I just installed the latest Telerik Testing Framework (2012.1.411) and changed a line in
 SilverlightHealthcareSample.cs so that I can use app.config to switch browsers.

 line 136 from the hard coded InternetExplorer to the app.config's browser settings
      | //            Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
      |       Manager.LaunchNewBrowser(Manager.Settings.DefaultBrowser);

 When set to FireFox, the test crashes in the searchScroll.InvokeMethod line.

      | SilverlightHealthcareSample.cs:line 279 searchScroll.InvokeMethod(scrollVert, 2000);

Error Message:
      | Test method QuickStarts_VSTS_CS.SilverlightHealthcareSample.HealthCareDemo threw exception:
      | ArtOfTest.WebAii.Silverlight.ExecuteSilverlightCommandException: [Silverlight Extension Error] Details: System.NullReferenceException: Object reference not set to an instance of an object.
      |    at ArtOfTest.WebAii.Silverlight.AutomationMethod.ReturnsAutomationPeer()
      |    at Telerik.TestingFramework.XamlExtension.ClientProcessor.ProcessCommand(String command)
      |  

Error Stack Trace:
      | ArtOfTest.WebAii.Silverlight.SilverlightProxy.ExecuteSLCommand(SilverlightCommand cmd)
      | ArtOfTest.WebAii.Silverlight.SilverlightProxy.InvokeMethod(AutomationMethod method, IAutomationPeer peer)
      | ArtOfTest.WebAii.Silverlight.AutomationObject`1.InvokeMethod(AutomationMethod method, Object[] parameters)
      | QuickStarts_VSTS_CS.SilverlightHealthcareSample.HealthCareDemo() in C:\programs\x86\ttf2012.1.411\Samples\Testing Framework\QuickStarts_VSTS_CS\Tests\SilverlightHealthcareSample.cs: line 279
      |

I hope you can reproduce and find a fix.

Thanks,

2 Answers, 1 is accepted

Sort by
0
kwee
Top achievements
Rank 1
answered on 19 May 2012, 12:38 AM
Also confirmed same failure for IE 8.
0
Plamen
Telerik team
answered on 22 May 2012, 08:15 AM
Hello Kwee,

Thank you for reporting the issue. To overcome this simply change the return type argument passed to the AutomationMethod constructor. Change it like this:
// Find the scroll viewer
ScrollViewer searchScroll = app.FindName("patientSearchScroller").Find.ByType<ScrollViewer>();
 
AutomationMethod scrollVert = new AutomationMethod("ScrollToVerticalOffset", typeof(object));
searchScroll.InvokeMethod(scrollVert, 2000);
 
// Assert scrolling position.
Assert.IsTrue(searchScroll.VerticalOffset == 2000);


You can also invoke the "ScrollToVerticalOffset" method without instantiating the AutomationMethod class. Here's the code:
// Find the scroll viewer
ScrollViewer searchScroll = app.FindName("patientSearchScroller").Find.ByType<ScrollViewer>();
 
// Invoke method
searchScroll.InvokeMethod("ScrollToVerticalOffset", 2000);
 
// Assert scrolling position.
Assert.IsTrue(searchScroll.VerticalOffset == 2000);

Give it a try and let me know if you require further assistance on this.

Greetings,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
kwee
Top achievements
Rank 1
Answers by
kwee
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or