Automated browser testing with Selenium and C#

  • Published on
    23-Feb-2016

  • View
    96

  • Download
    0

Embed Size (px)

DESCRIPTION

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 - PowerPoint PPT Presentation

Transcript

<p>Automated browser testing with Selenium and C#</p> <p>Automated browser testing with Selenium and C#Darren Bruning@dbruningGoing to cover:Why browser automation?Why selenium?Naked seleniumSelenium in a test framework: KumaraKumara internalsMore Selenium goodness</p> <p>Why browser automation?Primarily for testingMaybe also to script boring repetitive tasks</p> <p>What is selenium?There are lots of browsersThey all do similar things (go to websites, let you click on things)There was no consistent API to automate themSelenium 1: was javascripty, problematicWebDriver project started at GoogleSelenium 2 adopted WebDriver as preferred method to drive browsers.</p> <p>WebDriver protocolUses HTTP as a transportBindings for different languages, emit HTTP callsWebDriver drivers (servers) accept HTTP calls &amp; actually drive the browser</p> <p>What does Selenium API look like?</p> <p>Why not write tests directly against Selenium API?Tests end up with lots of codebusiness logic gets obscuredTests only readable by devsWould be more value in the tests if they also served as documentation=&gt; BDD (Behaviour Driven Design)SpecFlow feature files</p> <p>SpecFlow behind the curtain</p> <p>SpecFlow is great and all butYaaaay test readability! Feature documentation!BooNeed plugin for Visual StudioCant use refactoring toolsBecomes a pain to keep the feature file text in sync with the regexEnter the Kumara!Nee CalcotGiven when then syntaxGiven(List)When(List)Then(List)Its still just code, but its very readable (maybe even by a BA? Or tester?)</p> <p>ICondition</p> <p>Wait, how can a condition satisfy itself???</p> <p>ActionBasedCondition implements ICondition</p> <p>Example of an ActionBasedCondition</p> <p> and another one with preconditions</p> <p>So basically, with Kumara:You define some Root Nouns(the things you interact with in a test)</p> <p>You create some IConditions on those root nouns</p> <p>You write tests using those conditions</p> <p>How does Kumara use WebDriver?</p> <p>Commonly, by CSS:</p> <p>Then your tests can be all like</p> <p>The awesomest thing about Selenium is</p> <p>Review past tests, watch videos:https://saucelabs.com/tests/69f48decbb234e3b8adadf2a3205eebe</p> <p>Run in any combination of OS and browser</p> <p>Also awesome: PhantomJSVery fast!Runs locally, so less network latency for WebDriver calls,bloating out the test runtime</p> <p>Build it into your CI flow, for early feedback</p> <p>Questions?</p>

Recommended

View more >