Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Maintainable UI Tests with Selenium and C#

484 views

Published on

In this session I describe how to create UI Tests using Selenium, MSTest, and C# on Visual Studio 2017. I also describe PageObjects, which allow me to create more readable tests.

Published in: Technology
  • D0WNL0AD FULL ▶ ▶ ▶ ▶ http://1lite.top/cBTAl ◀ ◀ ◀ ◀
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • D0WNL0AD FULL ▶ ▶ ▶ ▶ http://1lite.top/cBTAl ◀ ◀ ◀ ◀
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Maintainable UI Tests with Selenium and C#

  1. 1. MaintainableUITests withSelenium andC# Jon Limjap Microsoft MVP forVisual Studio and DevelopmentTechnologies Philippine Software Industry Association –Tech Council Member
  2. 2. About Me  Microsoft MVP forVisual Studio and Development Technologies  Lead, Philippine .NET Users Group  PSIATechnical Council Member  http://jonlimjap.net  @lattex | jonlimjap@gmail.com
  3. 3. Philippine .NET UsersGroup (PHINUG) facebook.com/groups/phinug
  4. 4. What is Selenium Selenium basics Improving Selenium tests with PageObjects
  5. 5. SeleniumOverview
  6. 6. What is Selenium? Quite simply, “Selenium automates browsers” Originally started in 2004 by Jason Huggins as an internal tool at ThoughtWorks Written in Java Useful not only for testing but for automated tasks, webpage scraping, etc.
  7. 7. Testing frameworks powered by Selenium  Java  JUnit  TestNG  .NET  NUnit  MSTest  JavaScript  WebdriverJS  WebdriverIO  NightwatchJS  PHP  Behat + Menk  Ruby  RSpec  Python  Robot Framework  PyUnit  Py.Test
  8. 8. Selenium Basics
  9. 9. Selenium Basics WebDrivers WebElements Find Element By Wait
  10. 10. WebDrivers DifferentWebdriver for different browsers Native implementation  Firefox Third Party implementations  Chrome  IE  Opera  Safari  Edge  PhantomJS  Etc…
  11. 11. WebElement One node of an HTML document Can contain childWebElements Properties  Enabled (bool)  Selected (bool)  TagName (string)  Text (string)  Etc…
  12. 12. WebElement Action Methods  Clear  Click  SendKeys  Submit Other Userful Methods  FindElement / FindElements  GetAttribute  GetCssValue
  13. 13. Find Elements By FindElement/FindElements returns a WebElement object These are filtered using the “By” object  ClassName  CssSelector  Name  Id  LinkText  PartialLinkText  TagName  Xpath Chrome DeveloperTools is your friend  Copy Selector  Copy XPath
  14. 14. Find Elements By Chrome DeveloperTools is your friend  Copy Selector  Copy XPath
  15. 15. Selenium in VisualStudio Third parties found ways to support Selenium as early asVisual Studio 2005 via NUnit and Selenium.NET MSTest support added inVisual Studio 2013  You can still use NUnit or other test runners Vastly easier nowadays due to Nuget
  16. 16. Demo Selenium inVisual Studio using MSTest + C#
  17. 17. ImprovingSelenium tests with PageObjects Making tests look saner
  18. 18. PageObjects Create a class representing each page to be tested Create properties forWebElements in the page Make methods for repeatedly called routines
  19. 19. Demo PageObjects
  20. 20. Q &A |Thank you! Join PHINUG’s Facebook Group facebook.com/groups/phinug

×