1 / 27

Automated browser testing with Selenium and C#

Automated browser testing with Selenium and C#. Darren Bruning @ dbruning. Going to cover:. Why browser automation? Why selenium? “Naked” selenium Selenium in a test framework: Kumara Kumara internals More Selenium goodness. Why browser automation? . Primarily for testing

melia
Download Presentation

Automated browser testing with Selenium and C#

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Automated browser testing with Selenium and C# Darren Bruning @dbruning

  2. Going to cover: • Why browser automation? • Why selenium? • “Naked” selenium • Selenium in a test framework: Kumara • Kumara internals • More Selenium goodness

  3. Why browser automation? • Primarily for testing • Maybe also to script boring repetitive tasks

  4. What is selenium? • There are lots of browsers • They all do similar things (go to websites, let you click on things) • There was no consistent API to automate them • Selenium 1: was javascripty, problematic • WebDriver project started at Google • Selenium 2 adopted WebDriver as preferred method to “drive” browsers.

  5. WebDriver protocol • Uses HTTP as a transport • “Bindings” for different languages, emit HTTP calls • WebDriver “drivers” (servers) accept HTTP calls & actually drive the browser

  6. What does Selenium API look like?

  7. Why not write tests directly against Selenium API? • Tests end up with lots of code • “business logic” gets obscured • Tests only readable by devs • Would be more value in the tests if they also served as documentation • => BDD (Behaviour Driven Design)

  8. SpecFlow – feature files

  9. SpecFlow – behind the curtain

  10. SpecFlow is great and all but… • Yaaaay • test readability! • Feature documentation! • Boo • Need plugin for Visual Studio • Can’t use refactoring tools • Becomes a pain to keep the feature file text in sync with the regex

  11. Enter the Kumara! • Nee Calcot • Given – when –then syntax • Given(List<ICondition>) • When(List<Action>) • Then(List<ICondition>) • It’s still just code, but it’s very readable (maybe even by a BA? Or tester?)

  12. ICondition

  13. Wait, how can a condition satisfy itself???

  14. ActionBasedCondition implements ICondition

  15. Example of an ActionBasedCondition

  16. … and another one with preconditions

  17. So basically, with Kumara: • You define some “Root Nouns”(the things you interact with in a test) • You create some IConditions on those root nouns • You write tests using those conditions

  18. How does Kumara use WebDriver?

  19. Commonly, by CSS:

  20. Then your tests can be all like…

  21. The awesomest thing about Selenium is…

  22. Review past tests, watch videos: • https://saucelabs.com/tests/69f48decbb234e3b8adadf2a3205eebe

  23. Run in any combination of OS and browser

  24. Also awesome: PhantomJS • Very fast! • Runs locally, so less network latency for WebDriver calls,bloating out the test runtime

  25. Build it into your CI flow, for early feedback

  26. Questions?

More Related