SlideShare a Scribd company logo
1 of 33
How to create cross browser test
automation using Coded UI Testing
Agenda
Test automation with visual Studio 2012
Coded UI tests
       Technologies supported
       How does CodedUI find the objects?
       Multi browser support
Maintainability of your tests
       BDD style testing and MTM
       BDD style testing and CodedUI
       Page object pattern
       BDD style testing and CodedUI revisited
Running your test automation from MTM and the build
Summary
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
Introduction into CodedUI

Microsoft Framework to implement Test autmation
CodedUI tests are based on the MSTest Framework
It supports different UI technologies
      Web Browser
      WPF applications
      WinForms applications
      Silverlight applications
      (Microsoft Visual Studio UI Test Plugin for Silverlight)
Searching for controls

CodedUI uses the search properties of the control first to find the control
relative to the specified parent control
If a Search results in multiple controles then the Filter Properties are
applied
If a Search results in 1 control, then search properties are ignored

Search of controls works best if they can be easily identified
Best practice:
For web controls always give controls an “id” attribute
For other technologies, add an AutomationPeer to the control
Supported technologies

IE8, 9 & 10 on Windows 7, 8
Chrome, firefox
Silverlight 4 & 5 in IE 8,9 & 10
Windows forms 2.0
WPF fully supported
SharePoint
Dynamics CRM
Test automation with Visual Studio 2012

Cross browser support:
”Selenium components for Cross Browser “:
http://bit.ly/vs2012crossbrowser
Wait for specific events

WaitForControlReady              The methods return true if the
WaitForControlEnabled            wait is successful and false if the
                                 wait failed.
WaitForControlNotExist
                                 •The implicit timeout for the wait
WaitForControlPropertyEqual      operation is specified by
WaitForControlPropertyNotEqual   WaitForReadyTimeout property
WaitForControlCondition
(Predicate)                      use the Playback.Wait() instead
WaitForCondition (Predicate)     of Thread.Sleep() API
Data Driven tests

Data sets can be used to drive the UITests
Different Data Sources available
      CSV
      XML
      Excel
      Test Case in MTM
      SQL Server

Use the TestContext to get the data rows
string paramVal = TestContext.DataRow["Input1"]
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 Driver
Excel   (*.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]
BDD
BDD

Context    Given

Event      When

Response   Then
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 cart

Given a customer added an article to his shopping cart
When the customer navigates to the shopping cart
Then he should be able to remove the item from the basket

Scenario 2: Wrong number of items should be correctable
Given a customer added an article to his shopping cart
And he increased the quantity of the article
When the customer navigates to the shopping cart
Then he should be able to decrease the quantity of the article
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
Making test readable & reusable

Page Objects
     = UIMap
Create 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
Code first - extensions

http://codeduicodefirst.codeplex.com/
BDD - frameworks

http://www.specflow.org
BDD - frameworks

http://www.specflow.org
BDD - frameworks

http://www.specflow.org
BDD - frameworks

http://www.specflow.org
How to enable cross browser testing
Data driven or using MTM configurations
MTM has the notion of
Configurations
Autmated run in MTM pushes data to
TestContext.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
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;
               }
           }
       }
Summary
Test automation with visual Studio 2012
Coded UI tests
        Technologies supported
        How does CodedUI find the objects?
        Multi browser support
Maintainability of your tests
        BDD style testing and MTM
        BDD style testing and CodedUI
        Page object pattern
        BDD style testing and CodedUI revisited
Running your test automation from MTM and the build
Call to Action
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross browser test automation using Coded UI Testing

More Related Content

What's hot

Coded ui - lesson 1 - overview
Coded ui - lesson 1 - overviewCoded ui - lesson 1 - overview
Coded ui - lesson 1 - overviewOmer Karpas
 
Coded ui in a nutshell
Coded ui in a nutshellCoded ui in a nutshell
Coded ui in a nutshellOmer Karpas
 
Technical meeting automated testing with vs2010
Technical meeting automated testing with vs2010Technical meeting automated testing with vs2010
Technical meeting automated testing with vs2010Clemens Reijnen
 
Automation Testing with TestComplete
Automation Testing with TestCompleteAutomation Testing with TestComplete
Automation Testing with TestCompleteRomSoft SRL
 
Automating UI testing
Automating UI testingAutomating UI testing
Automating UI testingAdam Siton
 
[XCode] Automating UI Testing
[XCode] Automating UI Testing[XCode] Automating UI Testing
[XCode] Automating UI TestingPhineas Huang
 
User Interface Testing. What is UI Testing and Why it is so important?
User Interface Testing. What is UI Testing and Why it is so important?User Interface Testing. What is UI Testing and Why it is so important?
User Interface Testing. What is UI Testing and Why it is so important?Maveryx
 
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLCUI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLCJim Lane
 
Qtp 9.2 tutorials
Qtp 9.2 tutorialsQtp 9.2 tutorials
Qtp 9.2 tutorialsmedsherb
 
Visual Studio 2010 for testers
Visual Studio 2010 for testersVisual Studio 2010 for testers
Visual Studio 2010 for testersArpit Dubey
 
Overview of Visual Studio Team System 2010
Overview of Visual Studio Team System 2010Overview of Visual Studio Team System 2010
Overview of Visual Studio Team System 2010joycsc
 
Visual studio Team system 2012
Visual studio Team system 2012Visual studio Team system 2012
Visual studio Team system 2012kunnathust
 
SwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made EasySwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made EasyAnkit Goel
 
Functional Testing made easy with SWTBot for Developers and Testers
Functional Testing made easy with SWTBot for Developers and TestersFunctional Testing made easy with SWTBot for Developers and Testers
Functional Testing made easy with SWTBot for Developers and TestersAurélien Pupier
 
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016Dusan Lukic
 
Testing project (basic)
Testing project (basic)Testing project (basic)
Testing project (basic)Lokesh Singrol
 
ASP.Net MVC 4 [Part - 2]
ASP.Net MVC 4 [Part - 2]ASP.Net MVC 4 [Part - 2]
ASP.Net MVC 4 [Part - 2]Mohamed Abdeen
 
TestComplete 7.50 New Features
TestComplete 7.50 New FeaturesTestComplete 7.50 New Features
TestComplete 7.50 New FeaturesVlad Kuznetsov
 

What's hot (20)

Coded ui - lesson 1 - overview
Coded ui - lesson 1 - overviewCoded ui - lesson 1 - overview
Coded ui - lesson 1 - overview
 
Coded ui in a nutshell
Coded ui in a nutshellCoded ui in a nutshell
Coded ui in a nutshell
 
Technical meeting automated testing with vs2010
Technical meeting automated testing with vs2010Technical meeting automated testing with vs2010
Technical meeting automated testing with vs2010
 
Active x
Active xActive x
Active x
 
Automation Testing with TestComplete
Automation Testing with TestCompleteAutomation Testing with TestComplete
Automation Testing with TestComplete
 
Automating UI testing
Automating UI testingAutomating UI testing
Automating UI testing
 
[XCode] Automating UI Testing
[XCode] Automating UI Testing[XCode] Automating UI Testing
[XCode] Automating UI Testing
 
User Interface Testing. What is UI Testing and Why it is so important?
User Interface Testing. What is UI Testing and Why it is so important?User Interface Testing. What is UI Testing and Why it is so important?
User Interface Testing. What is UI Testing and Why it is so important?
 
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLCUI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
 
Qtp 9.2 tutorials
Qtp 9.2 tutorialsQtp 9.2 tutorials
Qtp 9.2 tutorials
 
Visual Studio 2010 for testers
Visual Studio 2010 for testersVisual Studio 2010 for testers
Visual Studio 2010 for testers
 
Overview of Visual Studio Team System 2010
Overview of Visual Studio Team System 2010Overview of Visual Studio Team System 2010
Overview of Visual Studio Team System 2010
 
Visual studio Team system 2012
Visual studio Team system 2012Visual studio Team system 2012
Visual studio Team system 2012
 
SwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made EasySwtBot: Unit Testing Made Easy
SwtBot: Unit Testing Made Easy
 
Functional Testing made easy with SWTBot for Developers and Testers
Functional Testing made easy with SWTBot for Developers and TestersFunctional Testing made easy with SWTBot for Developers and Testers
Functional Testing made easy with SWTBot for Developers and Testers
 
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
 
Testing project (basic)
Testing project (basic)Testing project (basic)
Testing project (basic)
 
Winrunner
WinrunnerWinrunner
Winrunner
 
ASP.Net MVC 4 [Part - 2]
ASP.Net MVC 4 [Part - 2]ASP.Net MVC 4 [Part - 2]
ASP.Net MVC 4 [Part - 2]
 
TestComplete 7.50 New Features
TestComplete 7.50 New FeaturesTestComplete 7.50 New Features
TestComplete 7.50 New Features
 

Viewers also liked

Whatever happened to building community
Whatever happened to building communityWhatever happened to building community
Whatever happened to building communityLouisville Digital
 
Advanced Visual Test Automation with Selenium
Advanced Visual Test Automation with SeleniumAdvanced Visual Test Automation with Selenium
Advanced Visual Test Automation with Seleniumadamcarmi
 
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.js
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.jsPayPal's NemoJS and Applitools Eyes - Visual Testing with Node.js
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.jsApplitools
 
Sauce Labs+Applitools - Automated Visual Testing in the Cloud
Sauce Labs+Applitools - Automated Visual Testing in the CloudSauce Labs+Applitools - Automated Visual Testing in the Cloud
Sauce Labs+Applitools - Automated Visual Testing in the CloudSauce Labs
 
Advanced Cross-Browser Visual Testing with Applitools Eyes and HP LeanFT
Advanced Cross-Browser Visual Testing with Applitools Eyes and HP LeanFTAdvanced Cross-Browser Visual Testing with Applitools Eyes and HP LeanFT
Advanced Cross-Browser Visual Testing with Applitools Eyes and HP LeanFTadamcarmi
 
Connected Solutions for the Future
Connected Solutions for the FutureConnected Solutions for the Future
Connected Solutions for the FutureLouisville Digital
 
Advanced Automated Visual Testing
Advanced Automated Visual TestingAdvanced Automated Visual Testing
Advanced Automated Visual Testingadamcarmi
 
Intro to Visual Test Automation with Applitools Eyes
Intro to Visual Test Automation with Applitools Eyes Intro to Visual Test Automation with Applitools Eyes
Intro to Visual Test Automation with Applitools Eyes Applitools
 
Selenium-based Visual Test Automation
Selenium-based Visual Test AutomationSelenium-based Visual Test Automation
Selenium-based Visual Test AutomationApplitools
 
How to level-up your Selenium tests with Visual Testing #SeleniumCamp
How to level-up your Selenium tests with Visual Testing #SeleniumCampHow to level-up your Selenium tests with Visual Testing #SeleniumCamp
How to level-up your Selenium tests with Visual Testing #SeleniumCampmoshemilman
 
SeConf2015: Advanced Automated Visual Testing With Selenium
SeConf2015: Advanced Automated Visual Testing With SeleniumSeConf2015: Advanced Automated Visual Testing With Selenium
SeConf2015: Advanced Automated Visual Testing With Seleniumadamcarmi
 
Test automation - What? Why? How?
Test automation - What? Why? How?Test automation - What? Why? How?
Test automation - What? Why? How?Anand Bagmar
 
Grading the Quality of Selenium Tests
Grading the Quality of Selenium TestsGrading the Quality of Selenium Tests
Grading the Quality of Selenium TestsMarcus Merrell
 
De la idea al proyecto. Como transformar ideas en proyectos de forma agil
De la idea al proyecto. Como transformar ideas en proyectos de forma agilDe la idea al proyecto. Como transformar ideas en proyectos de forma agil
De la idea al proyecto. Como transformar ideas en proyectos de forma agilgedpro project management experts
 

Viewers also liked (18)

Crowdsourced Media
Crowdsourced MediaCrowdsourced Media
Crowdsourced Media
 
Drive Down
Drive DownDrive Down
Drive Down
 
Whatever happened to building community
Whatever happened to building communityWhatever happened to building community
Whatever happened to building community
 
Neuropersuasion
NeuropersuasionNeuropersuasion
Neuropersuasion
 
Advanced Visual Test Automation with Selenium
Advanced Visual Test Automation with SeleniumAdvanced Visual Test Automation with Selenium
Advanced Visual Test Automation with Selenium
 
Becoming a measurement ninja
Becoming a measurement ninjaBecoming a measurement ninja
Becoming a measurement ninja
 
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.js
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.jsPayPal's NemoJS and Applitools Eyes - Visual Testing with Node.js
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.js
 
Sauce Labs+Applitools - Automated Visual Testing in the Cloud
Sauce Labs+Applitools - Automated Visual Testing in the CloudSauce Labs+Applitools - Automated Visual Testing in the Cloud
Sauce Labs+Applitools - Automated Visual Testing in the Cloud
 
Advanced Cross-Browser Visual Testing with Applitools Eyes and HP LeanFT
Advanced Cross-Browser Visual Testing with Applitools Eyes and HP LeanFTAdvanced Cross-Browser Visual Testing with Applitools Eyes and HP LeanFT
Advanced Cross-Browser Visual Testing with Applitools Eyes and HP LeanFT
 
Connected Solutions for the Future
Connected Solutions for the FutureConnected Solutions for the Future
Connected Solutions for the Future
 
Advanced Automated Visual Testing
Advanced Automated Visual TestingAdvanced Automated Visual Testing
Advanced Automated Visual Testing
 
Intro to Visual Test Automation with Applitools Eyes
Intro to Visual Test Automation with Applitools Eyes Intro to Visual Test Automation with Applitools Eyes
Intro to Visual Test Automation with Applitools Eyes
 
Selenium-based Visual Test Automation
Selenium-based Visual Test AutomationSelenium-based Visual Test Automation
Selenium-based Visual Test Automation
 
How to level-up your Selenium tests with Visual Testing #SeleniumCamp
How to level-up your Selenium tests with Visual Testing #SeleniumCampHow to level-up your Selenium tests with Visual Testing #SeleniumCamp
How to level-up your Selenium tests with Visual Testing #SeleniumCamp
 
SeConf2015: Advanced Automated Visual Testing With Selenium
SeConf2015: Advanced Automated Visual Testing With SeleniumSeConf2015: Advanced Automated Visual Testing With Selenium
SeConf2015: Advanced Automated Visual Testing With Selenium
 
Test automation - What? Why? How?
Test automation - What? Why? How?Test automation - What? Why? How?
Test automation - What? Why? How?
 
Grading the Quality of Selenium Tests
Grading the Quality of Selenium TestsGrading the Quality of Selenium Tests
Grading the Quality of Selenium Tests
 
De la idea al proyecto. Como transformar ideas en proyectos de forma agil
De la idea al proyecto. Como transformar ideas en proyectos de forma agilDe la idea al proyecto. Como transformar ideas en proyectos de forma agil
De la idea al proyecto. Como transformar ideas en proyectos de forma agil
 

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

Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power pointjustmeanscsr
 
automation framework
automation frameworkautomation framework
automation frameworkANSHU GOYAL
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Ukraine
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testingdrewz lin
 
Visual Studio 2010 Testing Overview
Visual Studio 2010 Testing OverviewVisual Studio 2010 Testing Overview
Visual Studio 2010 Testing OverviewSteve Lange
 
Full Testing Experience - Visual Studio and TFS 2010
 Full Testing Experience - Visual Studio and TFS 2010 Full Testing Experience - Visual Studio and TFS 2010
Full Testing Experience - Visual Studio and TFS 2010Ed Blankenship
 
Getting Started with Coded UI Testing: Building Your First Automated Test
Getting Started with Coded UI Testing: Building Your First Automated TestGetting Started with Coded UI Testing: Building Your First Automated Test
Getting Started with Coded UI Testing: Building Your First Automated TestImaginet
 
Unit Testing DFC
Unit Testing DFCUnit Testing DFC
Unit Testing DFCBlueFish
 
Binary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code TestingBinary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code TestingBinary Studio
 
Unit Testing Documentum Foundation Classes Code
Unit Testing Documentum Foundation Classes CodeUnit Testing Documentum Foundation Classes Code
Unit Testing Documentum Foundation Classes CodeBlueFish
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchMats Bryntse
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsAbhijeet Vaikar
 
Udvid din test portefølje med coded ui test og cloud load test
Udvid din test portefølje med coded ui test og cloud load testUdvid din test portefølje med coded ui test og cloud load test
Udvid din test portefølje med coded ui test og cloud load testPeter Lindberg
 
1.microsoft visual studio 2010 test manager
1.microsoft visual studio 2010  test manager1.microsoft visual studio 2010  test manager
1.microsoft visual studio 2010 test managerAshwin Jujgar
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Hazem Saleh
 

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

Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
automation framework
automation frameworkautomation framework
automation framework
 
Csharp dot net
Csharp dot netCsharp dot net
Csharp dot net
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
 
Visual Studio 2010 Testing Overview
Visual Studio 2010 Testing OverviewVisual Studio 2010 Testing Overview
Visual Studio 2010 Testing Overview
 
Full Testing Experience - Visual Studio and TFS 2010
 Full Testing Experience - Visual Studio and TFS 2010 Full Testing Experience - Visual Studio and TFS 2010
Full Testing Experience - Visual Studio and TFS 2010
 
Getting Started with Coded UI Testing: Building Your First Automated Test
Getting Started with Coded UI Testing: Building Your First Automated TestGetting Started with Coded UI Testing: Building Your First Automated Test
Getting Started with Coded UI Testing: Building Your First Automated Test
 
Unit Testing DFC
Unit Testing DFCUnit Testing DFC
Unit Testing DFC
 
NET Code Testing
NET Code TestingNET Code Testing
NET Code Testing
 
Binary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code TestingBinary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code Testing
 
Unit Testing Documentum Foundation Classes Code
Unit Testing Documentum Foundation Classes CodeUnit Testing Documentum Foundation Classes Code
Unit Testing Documentum Foundation Classes Code
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
 
Coding Naked 2023
Coding Naked 2023Coding Naked 2023
Coding Naked 2023
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium tests
 
Udvid din test portefølje med coded ui test og cloud load test
Udvid din test portefølje med coded ui test og cloud load testUdvid din test portefølje med coded ui test og cloud load test
Udvid din test portefølje med coded ui test og cloud load test
 
Coding Naked
Coding NakedCoding Naked
Coding Naked
 
1.microsoft visual studio 2010 test manager
1.microsoft visual studio 2010  test manager1.microsoft visual studio 2010  test manager
1.microsoft visual studio 2010 test manager
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012
 

More from Microsoft Developer Network (MSDN) - Belgium and Luxembourg

More from Microsoft Developer Network (MSDN) - Belgium and Luxembourg (20)

Code in the Cloud - Ghent - 20 February 2015
Code in the Cloud - Ghent - 20 February 2015Code in the Cloud - Ghent - 20 February 2015
Code in the Cloud - Ghent - 20 February 2015
 
Executive Summit for ISV & Application builders - January 2015
Executive Summit for ISV & Application builders - January 2015Executive Summit for ISV & Application builders - January 2015
Executive Summit for ISV & Application builders - January 2015
 
Executive Summit for ISV & Application builders - Internet of Things
Executive Summit for ISV & Application builders - Internet of ThingsExecutive Summit for ISV & Application builders - Internet of Things
Executive Summit for ISV & Application builders - Internet of Things
 
Executive Summit for ISV & Application builders - January 2015
Executive Summit for ISV & Application builders - January 2015Executive Summit for ISV & Application builders - January 2015
Executive Summit for ISV & Application builders - January 2015
 
Code in the Cloud - December 8th 2014
Code in the Cloud - December 8th 2014Code in the Cloud - December 8th 2014
Code in the Cloud - December 8th 2014
 
Adam azure presentation
Adam   azure presentationAdam   azure presentation
Adam azure presentation
 
release management
release managementrelease management
release management
 
cloud value for application development
cloud value for application developmentcloud value for application development
cloud value for application development
 
Modern lifecycle management practices
Modern lifecycle management practicesModern lifecycle management practices
Modern lifecycle management practices
 
Belgian visual studio launch 2013
Belgian visual studio launch 2013Belgian visual studio launch 2013
Belgian visual studio launch 2013
 
Windows Azure Virtually Speaking
Windows Azure Virtually SpeakingWindows Azure Virtually Speaking
Windows Azure Virtually Speaking
 
Inside the Microsoft TechDays Belgium Apps
Inside the Microsoft TechDays Belgium AppsInside the Microsoft TechDays Belgium Apps
Inside the Microsoft TechDays Belgium Apps
 
TechDays 2013 Developer Keynote
TechDays 2013 Developer KeynoteTechDays 2013 Developer Keynote
TechDays 2013 Developer Keynote
 
Windows Phone 8 Security Deep Dive
Windows Phone 8 Security Deep DiveWindows Phone 8 Security Deep Dive
Windows Phone 8 Security Deep Dive
 
Deep Dive into Entity Framework 6.0
Deep Dive into Entity Framework 6.0Deep Dive into Entity Framework 6.0
Deep Dive into Entity Framework 6.0
 
Applied MVVM in Windows 8 apps: not your typical MVVM session!
Applied MVVM in Windows 8 apps: not your typical MVVM session!Applied MVVM in Windows 8 apps: not your typical MVVM session!
Applied MVVM in Windows 8 apps: not your typical MVVM session!
 
Building SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.jsBuilding SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.js
 
Deep Dive and Best Practices for Windows Azure Storage Services
Deep Dive and Best Practices for Windows Azure Storage ServicesDeep Dive and Best Practices for Windows Azure Storage Services
Deep Dive and Best Practices for Windows Azure Storage Services
 
Building data centric applications for web, desktop and mobile with Entity Fr...
Building data centric applications for web, desktop and mobile with Entity Fr...Building data centric applications for web, desktop and mobile with Entity Fr...
Building data centric applications for web, desktop and mobile with Entity Fr...
 
Bart De Smet Unplugged
Bart De Smet UnpluggedBart De Smet Unplugged
Bart De Smet Unplugged
 

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

  • 1. How to create cross browser test automation using Coded UI Testing
  • 2.
  • 3. Agenda Test automation with visual Studio 2012 Coded UI tests Technologies supported How does CodedUI find the objects? Multi browser support Maintainability of your tests BDD style testing and MTM BDD style testing and CodedUI Page object pattern BDD style testing and CodedUI revisited Running your test automation from MTM and the build Summary
  • 4. 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
  • 5. Introduction into CodedUI Microsoft Framework to implement Test autmation CodedUI tests are based on the MSTest Framework It supports different UI technologies Web Browser WPF applications WinForms applications Silverlight applications (Microsoft Visual Studio UI Test Plugin for Silverlight)
  • 6. Searching for controls CodedUI uses the search properties of the control first to find the control relative to the specified parent control If a Search results in multiple controles then the Filter Properties are applied If a Search results in 1 control, then search properties are ignored Search of controls works best if they can be easily identified Best practice: For web controls always give controls an “id” attribute For other technologies, add an AutomationPeer to the control
  • 7. Supported technologies IE8, 9 & 10 on Windows 7, 8 Chrome, firefox Silverlight 4 & 5 in IE 8,9 & 10 Windows forms 2.0 WPF fully supported SharePoint Dynamics CRM
  • 8. Test automation with Visual Studio 2012 Cross browser support: ”Selenium components for Cross Browser “: http://bit.ly/vs2012crossbrowser
  • 9.
  • 10. Wait for specific events WaitForControlReady The methods return true if the WaitForControlEnabled wait is successful and false if the wait failed. WaitForControlNotExist •The implicit timeout for the wait WaitForControlPropertyEqual operation is specified by WaitForControlPropertyNotEqual WaitForReadyTimeout property WaitForControlCondition (Predicate) use the Playback.Wait() instead WaitForCondition (Predicate) of Thread.Sleep() API
  • 11. Data Driven tests Data sets can be used to drive the UITests Different Data Sources available CSV XML Excel Test Case in MTM SQL Server Use the TestContext to get the data rows string paramVal = TestContext.DataRow["Input1"]
  • 12. 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 Driver Excel (*.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]
  • 13.
  • 14. BDD
  • 15. BDD Context Given Event When Response Then
  • 16. 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 cart Given a customer added an article to his shopping cart When the customer navigates to the shopping cart Then he should be able to remove the item from the basket Scenario 2: Wrong number of items should be correctable Given a customer added an article to his shopping cart And he increased the quantity of the article When the customer navigates to the shopping cart Then he should be able to decrease the quantity of the article
  • 17. 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
  • 18.
  • 19.
  • 20. Making test readable & reusable Page Objects = UIMap Create 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
  • 21. Code first - extensions http://codeduicodefirst.codeplex.com/
  • 26. How to enable cross browser testing Data driven or using MTM configurations
  • 27. MTM has the notion of Configurations
  • 28. Autmated run in MTM pushes data to TestContext.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
  • 29. 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; } } }
  • 30.
  • 31.
  • 32. Summary Test automation with visual Studio 2012 Coded UI tests Technologies supported How does CodedUI find the objects? Multi browser support Maintainability of your tests BDD style testing and MTM BDD style testing and CodedUI Page object pattern BDD style testing and CodedUI revisited Running your test automation from MTM and the build Call to Action

Editor's Notes

  1. - Hoe is dit nu verwerkt in de Visual Studio product stack?