Your SlideShare is downloading. ×
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross browser test automation using Coded UI Testing
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross browser test automation using Coded UI Testing

1,782
views

Published on

More info on techdays.be

More info on techdays.be


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,782
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
62
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • - Hoe is dit nu verwerkt in de Visual Studio product stack?
  • Transcript

    • 1. How to create cross browser testautomation using Coded UI Testing
    • 2. AgendaTest automation with visual Studio 2012Coded UI tests Technologies supported How does CodedUI find the objects? Multi browser supportMaintainability of your tests BDD style testing and MTM BDD style testing and CodedUI Page object pattern BDD style testing and CodedUI revisitedRunning your test automation from MTM and the buildSummary
    • 3. Test Automation Pyramid & VS Test Cases & Manual Shared Steps Tests Coded UI Tests GUI Tests Unit Tests Acceptance Tests (API Layer) Unit Tests Unit Tests / Component Tests Maintainable Coded UI Tests (CUITs) met VS2012 4
    • 4. Introduction into CodedUIMicrosoft Framework to implement Test autmationCodedUI tests are based on the MSTest FrameworkIt supports different UI technologies Web Browser WPF applications WinForms applications Silverlight applications (Microsoft Visual Studio UI Test Plugin for Silverlight)
    • 5. Searching for controlsCodedUI uses the search properties of the control first to find the controlrelative to the specified parent controlIf a Search results in multiple controles then the Filter Properties areappliedIf a Search results in 1 control, then search properties are ignoredSearch of controls works best if they can be easily identifiedBest practice:For web controls always give controls an “id” attributeFor other technologies, add an AutomationPeer to the control
    • 6. Supported technologiesIE8, 9 & 10 on Windows 7, 8Chrome, firefoxSilverlight 4 & 5 in IE 8,9 & 10Windows forms 2.0WPF fully supportedSharePointDynamics CRM
    • 7. Test automation with Visual Studio 2012Cross browser support:”Selenium components for Cross Browser “:http://bit.ly/vs2012crossbrowser
    • 8. Wait for specific eventsWaitForControlReady The methods return true if theWaitForControlEnabled wait is successful and false if the wait failed.WaitForControlNotExist •The implicit timeout for the waitWaitForControlPropertyEqual operation is specified byWaitForControlPropertyNotEqual WaitForReadyTimeout propertyWaitForControlCondition(Predicate) use the Playback.Wait() insteadWaitForCondition (Predicate) of Thread.Sleep() API
    • 9. Data Driven testsData sets can be used to drive the UITestsDifferent Data Sources available CSV XML Excel Test Case in MTM SQL ServerUse the TestContext to get the data rowsstring paramVal = TestContext.DataRow["Input1"]
    • 10. Data Source attributes [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|data.csv",CSV "data#csv", DataAccessMethod.Sequential), DeploymentItem("data.csv"), TestMethod] DataSource("System.Data.Odbc", "Dsn=Excel Files;Driver={Microsoft Excel DriverExcel (*.xls)};dbq=|DataDirectory|Data.xls;defaultdir=.;driverid=790;maxbuffersize=2048; pagetimeout=5;readonly=true", "Sheet1$", DataAccessMethod.Sequential), TestMethod]MTM [DataSource("Microsoft.VisualStudio.TestTools.DataSource.TestCase", "http://vlm13261329:8080/tfs/DefaultCo ", "30", DataAccessMethod.Sequential), TestMethod]SQL [DataSource("System.Data.SqlClient", "Data Source=.sqlexpress;Initial Catalog=tempdb; Integrated Security=True", "Data", DataAccessMethod.Sequential), TestMethod]XML [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|data.xml", "Iterations", DataAccessMethod.Sequential), DeploymentItem("data.xml"), TestMethod]
    • 11. BDD
    • 12. BDDContext GivenEvent WhenResponse Then
    • 13. BDD style acceptance test specification In order to correct wrong items in my shopping cart As a customer I should be able to correct items in my shopping car cart.Scenario 1: Wrong selected Items should be removable from shopping cartGiven a customer added an article to his shopping cartWhen the customer navigates to the shopping cartThen he should be able to remove the item from the basketScenario 2: Wrong number of items should be correctableGiven a customer added an article to his shopping cartAnd he increased the quantity of the articleWhen the customer navigates to the shopping cartThen he should be able to decrease the quantity of the article
    • 14. BDD• The language is used by all team members!• Given, when, then... can be seen as keywords for the domain language.• It’s a captured conversation• Simple
    • 15. Making test readable & reusablePage Objects = UIMapCreate multiple (per page for example)Technical interface for interacting with the pages Shared Step Page Object Pagina • UI Control Test Script • UI Action Maintainable Coded UI Tests (CUITs) met VS2012 20
    • 16. Code first - extensionshttp://codeduicodefirst.codeplex.com/
    • 17. BDD - frameworkshttp://www.specflow.org
    • 18. BDD - frameworkshttp://www.specflow.org
    • 19. BDD - frameworkshttp://www.specflow.org
    • 20. BDD - frameworkshttp://www.specflow.org
    • 21. How to enable cross browser testingData driven or using MTM configurations
    • 22. MTM has the notion ofConfigurations
    • 23. Autmated run in MTM pushes data toTestContext.Properties[] __Tfs_IsInLabEnvironment__ True __Tfs_TestRunId__ 22 __Tfs_TestCaseId__ 117 __Tfs_TeamProject__ MyTeamProjectName vsalmffdropsNew Build Definition 1New Build Definition __Tfs_BuildDirectory__ 1_20130222.7 <?xml version=”1.0″ encoding=”utf-16″?><LabEnvironment Id=”5f37b167-ad24-4f7e-bb1e-2e65a3e71a1f” Name=”Windows 7 Client” Uri=”vstfs:///LabManagement/LabEnvironment/2″><LabSys __Tfs_LabEnvironment__ tems><LabSystem Name=”TestClient” ComputerName=”TestClient” Roles=”Desktop Client”><CustomProperties /></LabSystem></LabSystems></LabEnvironment> __Tfs_TestConfigurationId__ 2 __Tfs_TestPlanId__ 4 __Tfs_TestConfigurationName__ Chrome __Tfs_TestPointId__ 12 __Tfs_TfsServerCollectionUrl__ http://vsalm:8080/tfs/fabrikamfibercollection __Tfs_BuildPlatform__ Any CPU __Tfs_BuildNumber__ New Build Definition 1_20130222.7 __Tfs_BuildFlavor__ Debug __Tfs_BuildConfigurationId__ 22
    • 24. Initialize your test[TestInitialize] public void TestInitialize() { if (TestContext.Properties["__Tfs_TestConfigurationName__"] != null) { string selectedBrowser = TestContext.Properties["__Tfs_TestConfigurationName__"].ToString(); Debug.WriteLine(string.Format("Selected browser configuration __Tfs_TEstConfigurationName__ == {0}",selectedBrowser)); if (!string.IsNullOrEmpty(selectedBrowser)) { // check if we selected IE, Firefox or chrome if (selectedBrowser == "IE") return; BrowserWindow.CurrentBrowser = selectedBrowser; } } }
    • 25. SummaryTest automation with visual Studio 2012Coded UI tests Technologies supported How does CodedUI find the objects? Multi browser supportMaintainability of your tests BDD style testing and MTM BDD style testing and CodedUI Page object pattern BDD style testing and CodedUI revisitedRunning your test automation from MTM and the buildCall to Action

    ×