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
Automated browser testing with Selenium and C#
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
Why browser automation?Primarily for testingMaybe also to script boring repetitive tasks
WebDriver protocolUses HTTP as a transportBindings for different languages, emit HTTP callsWebDriver drivers (servers) accept HTTP calls & actually drive the browser
What does Selenium API look like?
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=> BDD (Behaviour Driven Design)SpecFlow feature files
SpecFlow behind the curtain
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?)
Wait, how can a condition satisfy itself???
ActionBasedCondition implements ICondition
Example of an ActionBasedCondition
and another one with preconditions
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
How does Kumara use WebDriver?
Commonly, by CSS:
Then your tests can be all like
The awesomest thing about Selenium is
Review past tests, watch videos:https://saucelabs.com/tests/69f48decbb234e3b8adadf2a3205eebe
Run in any combination of OS and browser
Also awesome: PhantomJSVery fast!Runs locally, so less network latency for WebDriver calls,bloating out the test runtime
Build it into your CI flow, for early feedback