KEMBAR78
Automated software testing using Selenium WebDriver | PPTX
Automated software testing
using Selenium WebDriver
(Testimi i automatizuar i software-it
tuj’ përdorë Selenium WebDriver)
Kush o’ ky djal??
• Kush? – Ilir Sadik Kosumi
• Qka? (titujt)
1. “Njeri”
2. “Senior” Software Tester (QA)
3. PhD. n’lëminë e sarkazmit
4. Proud Gamer
5. Edhe plot tituj tjer’ që s’i nxen sllajdi (...qe spo m’bin n’men)
• Qa ka t’kryme? – Inxhinieri Mekanike, n’Teknik – UP
• Social
– Twitter: @ilirkosumi
– Goodreads: https://www.goodreads.com/user/show/26042912-ilir-kosumi
– GitHub: https://github.com/illyric
– Steam: http://steamcommunity.com/id/illyricanking
• Fjalia e urtë e preferuar:
“ If A is success in life, then A = x + y + z
x is work,
y is play, and
Z is keeping your mouth shut. ”
– Albert Einstein
Unë jom k’tu për me fol, ju jeni për me
ndegju!1
1 Po rrej!
No one in the brief history of computing has
ever written a piece of perfect software.
― Andrew Hunt,
The Pragmatic Programmer: From Journeyman to Master
What is Software Testing
(and why it rocks)?
• Most people think it’s just running test (by
executing software). This is one part of testing,
but not the big picture!
• Process: Testing is a process rather than a single
activity.
• Software testing shows the presence of bugs. It
does not show that there are none. (1st testing
principle in the Holy book of ISTQB Foundation
Level Sylabus)
• Testing Software is sometimes fun (esp. when you
find critical bugs)
How I see myself as a Software Tester
How devs (usually) see Software
Testers
Would you press the button?
Would you press the button? (2)
Regression Testing – Long live test
automation!
• Regression testing is a way of re-testing what
you already know should work (because there
was an update in the system-under-test that
might have affected the stuff you tested it in
the past which you knew did work back then)
• Manual regression testing is the most boring
task in Software Testing!
• As a software tester, test automation saves
not only my day but also my nerves...
Selenium
• Selenium ≠ testing tool
• Selenium is more like an open-source
community where everyone can contribute,
an organization (like Mozilla), a philosophy
etc.
• WebDriver = open-source testing tool that
automates/simulates user interactions with
the werb-browser
A brief history of Selenium
(na ishte njehere...)
• Started in 2004 at
ThoughtWorks in Chicago
• Jason Huggins – first started
selenium
• Selenium 1 (RC)
• Selenium 2 (WebDriver)
• The name, Selenium, was
selected because selenium
mineral supplements serve
as a cure for mercury
poisoning, Huggins
explained.*
*http://www.techworld.com/news/apps/open-source-selenium-web-app-test-suite-to-support-iphone-and-android-3272444/
Selenium 1 (RC - Remote Control)
• UI automation library, allowing developers and
testers to automate their interactions with a Web
Application Under Test (WAUT) by providing
them with the necessary libraries, supported in
multiple languages, to program.
• Generic JavaScript named Selenium Core to drive
the WAUT on a browser
• Selense commands
• Same-Origin Policy ☹
Selenium RC diagram (2)
Selenium 2 (WebDriver)
• WebDriver has come into existence for the
following reasons:
– Give a better control on the browser by
implementing browser-specifi
implementations.
– To give a better programming experience to the
developer by adhering more
closely to the object-oriented programming
fundamentals
WebDriver Implementations
• FirefoxDriver
• ChromeDriver
• SafariDriver
• AndroidDriver & IphoneDriver (Appium)
• HtmlUnitDriver
• InternetExplorerDriver
Selenium WebDriver diagram
Download WebDriver
• Download all jar files and add include them in
your project classpath as .jar dependencies
• If you use maven, you can add the maven
dependencies to get WebDriver
Maven dependencies2
• All dependencies:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.46.0</version>
</dependency>
• Browser-specific dependencies (ex. Firefox Driver):
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.46.0</version>
</dependency>
2 Thanks to Modest for presenting maven: http://prijug.org/?p=12&lang=en
Googling “Google” (manually)
• TC1 – Googling Google:
– Precondition:
• User has internet access
• User has an internet browser (preferably Firefox, or Chrome... In this example we are using
Firefox)
– Steps
1. Launch Firefox
2. Navigate to “http://www.google.com/”
3. Enter “the Google search engin” in the search textbox and search
– Expected results:
• User will see the correct spelling of the word “engine” preceded by “Showing results for the
Google search”
• User will see “Google Search - Wikipedia, the free encyclopedia” as the first search result
• The title of the Firefox browser window will show “the Google search engin – Google
Search”
• User will see on the left side a side-meny with the title “Google” and a brief description of
the company
Googling “Google” (automated)
LET’S GET OUR HANDS DIRTY!
What could go wrong?
• Improper resource
staffing
• Taking shortcuts***
• Abandoning
documentation
• A fool with a tool is still
a fool
References
• Selenium website: http://www.seleniumhq.org/
• The Pragmatic Programmer: From Journeyman to Master - Andrew Hunt: http://www.amazon.com/The-
Pragmatic-Programmer-Journeyman-Master/dp/020161622X
• Selenium WebDriver Practical Guide – Satya Avasarala: https://www.packtpub.com/web-development/selenium-
webdriver-practical-guide
• ISTQB Foundation Level Sylabus: http://www.istqb.org/downloads/finish/16/15.html
• (Good Old) Wikipedia:
– https://en.wikipedia.org/wiki/Software_testing
– https://en.wikipedia.org/wiki/Selenium_(software)
• Techworld.com: http://www.techworld.com/news/apps/open-source-selenium-web-app-test-suite-to-support-
iphone-and-android-3272444/
• Appium: http://appium.io/index.html?lang=en
• PriJUG maven meetup: http://prijug.org/?p=12&lang=en
• GitHub project: https://github.com/illyric/selenium-presantation-demo
• Pictures:
– http://www.dumpaday.com/wp-content/uploads/2014/01/sarcasm-3.jpg
– http://pubs.usgs.gov/of/2006/1184/1184.jpg
– http://2.bp.blogspot.com/-H77MQZVhxw8/T0JNCjiqo_I/AAAAAAAAAco/-YzaIT2rDH4/s1600/124+How+a+developer+feels.png
– https://upload.wikimedia.org/wikipedia/commons/8/8e/The_Big_Red_Button_(3085157011).jpg
– http://www.instantcheckmate.com/crimewire/wp-content/uploads/2013/05/DIY-Investigating-On-Reddit.jpg
– https://maribiella.files.wordpress.com/2014/05/signpost.jpg
– http://freedompreneur.com/wp-content/uploads/2014/07/upside-down-rocket.jpg
– http://www.sindhud.info/files/2009-11-25-webdriver/api-uml.png
Thank you for your attention!
(rrehni shuplaka se u kry)

Automated software testing using Selenium WebDriver

  • 1.
    Automated software testing usingSelenium WebDriver (Testimi i automatizuar i software-it tuj’ përdorë Selenium WebDriver)
  • 2.
    Kush o’ kydjal?? • Kush? – Ilir Sadik Kosumi • Qka? (titujt) 1. “Njeri” 2. “Senior” Software Tester (QA) 3. PhD. n’lëminë e sarkazmit 4. Proud Gamer 5. Edhe plot tituj tjer’ që s’i nxen sllajdi (...qe spo m’bin n’men) • Qa ka t’kryme? – Inxhinieri Mekanike, n’Teknik – UP • Social – Twitter: @ilirkosumi – Goodreads: https://www.goodreads.com/user/show/26042912-ilir-kosumi – GitHub: https://github.com/illyric – Steam: http://steamcommunity.com/id/illyricanking • Fjalia e urtë e preferuar: “ If A is success in life, then A = x + y + z x is work, y is play, and Z is keeping your mouth shut. ” – Albert Einstein
  • 3.
    Unë jom k’tupër me fol, ju jeni për me ndegju!1 1 Po rrej!
  • 4.
    No one inthe brief history of computing has ever written a piece of perfect software. ― Andrew Hunt, The Pragmatic Programmer: From Journeyman to Master
  • 5.
    What is SoftwareTesting (and why it rocks)? • Most people think it’s just running test (by executing software). This is one part of testing, but not the big picture! • Process: Testing is a process rather than a single activity. • Software testing shows the presence of bugs. It does not show that there are none. (1st testing principle in the Holy book of ISTQB Foundation Level Sylabus) • Testing Software is sometimes fun (esp. when you find critical bugs)
  • 6.
    How I seemyself as a Software Tester
  • 7.
    How devs (usually)see Software Testers
  • 8.
    Would you pressthe button?
  • 9.
    Would you pressthe button? (2)
  • 10.
    Regression Testing –Long live test automation! • Regression testing is a way of re-testing what you already know should work (because there was an update in the system-under-test that might have affected the stuff you tested it in the past which you knew did work back then) • Manual regression testing is the most boring task in Software Testing! • As a software tester, test automation saves not only my day but also my nerves...
  • 11.
    Selenium • Selenium ≠testing tool • Selenium is more like an open-source community where everyone can contribute, an organization (like Mozilla), a philosophy etc. • WebDriver = open-source testing tool that automates/simulates user interactions with the werb-browser
  • 12.
    A brief historyof Selenium (na ishte njehere...) • Started in 2004 at ThoughtWorks in Chicago • Jason Huggins – first started selenium • Selenium 1 (RC) • Selenium 2 (WebDriver) • The name, Selenium, was selected because selenium mineral supplements serve as a cure for mercury poisoning, Huggins explained.* *http://www.techworld.com/news/apps/open-source-selenium-web-app-test-suite-to-support-iphone-and-android-3272444/
  • 13.
    Selenium 1 (RC- Remote Control) • UI automation library, allowing developers and testers to automate their interactions with a Web Application Under Test (WAUT) by providing them with the necessary libraries, supported in multiple languages, to program. • Generic JavaScript named Selenium Core to drive the WAUT on a browser • Selense commands • Same-Origin Policy ☹
  • 14.
  • 15.
    Selenium 2 (WebDriver) •WebDriver has come into existence for the following reasons: – Give a better control on the browser by implementing browser-specifi implementations. – To give a better programming experience to the developer by adhering more closely to the object-oriented programming fundamentals
  • 16.
    WebDriver Implementations • FirefoxDriver •ChromeDriver • SafariDriver • AndroidDriver & IphoneDriver (Appium) • HtmlUnitDriver • InternetExplorerDriver
  • 17.
  • 18.
    Download WebDriver • Downloadall jar files and add include them in your project classpath as .jar dependencies • If you use maven, you can add the maven dependencies to get WebDriver
  • 19.
    Maven dependencies2 • Alldependencies: <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>2.46.0</version> </dependency> • Browser-specific dependencies (ex. Firefox Driver): <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-firefox-driver</artifactId> <version>2.46.0</version> </dependency> 2 Thanks to Modest for presenting maven: http://prijug.org/?p=12&lang=en
  • 21.
    Googling “Google” (manually) •TC1 – Googling Google: – Precondition: • User has internet access • User has an internet browser (preferably Firefox, or Chrome... In this example we are using Firefox) – Steps 1. Launch Firefox 2. Navigate to “http://www.google.com/” 3. Enter “the Google search engin” in the search textbox and search – Expected results: • User will see the correct spelling of the word “engine” preceded by “Showing results for the Google search” • User will see “Google Search - Wikipedia, the free encyclopedia” as the first search result • The title of the Firefox browser window will show “the Google search engin – Google Search” • User will see on the left side a side-meny with the title “Google” and a brief description of the company
  • 22.
  • 23.
    LET’S GET OURHANDS DIRTY!
  • 24.
    What could gowrong? • Improper resource staffing • Taking shortcuts*** • Abandoning documentation • A fool with a tool is still a fool
  • 25.
    References • Selenium website:http://www.seleniumhq.org/ • The Pragmatic Programmer: From Journeyman to Master - Andrew Hunt: http://www.amazon.com/The- Pragmatic-Programmer-Journeyman-Master/dp/020161622X • Selenium WebDriver Practical Guide – Satya Avasarala: https://www.packtpub.com/web-development/selenium- webdriver-practical-guide • ISTQB Foundation Level Sylabus: http://www.istqb.org/downloads/finish/16/15.html • (Good Old) Wikipedia: – https://en.wikipedia.org/wiki/Software_testing – https://en.wikipedia.org/wiki/Selenium_(software) • Techworld.com: http://www.techworld.com/news/apps/open-source-selenium-web-app-test-suite-to-support- iphone-and-android-3272444/ • Appium: http://appium.io/index.html?lang=en • PriJUG maven meetup: http://prijug.org/?p=12&lang=en • GitHub project: https://github.com/illyric/selenium-presantation-demo • Pictures: – http://www.dumpaday.com/wp-content/uploads/2014/01/sarcasm-3.jpg – http://pubs.usgs.gov/of/2006/1184/1184.jpg – http://2.bp.blogspot.com/-H77MQZVhxw8/T0JNCjiqo_I/AAAAAAAAAco/-YzaIT2rDH4/s1600/124+How+a+developer+feels.png – https://upload.wikimedia.org/wikipedia/commons/8/8e/The_Big_Red_Button_(3085157011).jpg – http://www.instantcheckmate.com/crimewire/wp-content/uploads/2013/05/DIY-Investigating-On-Reddit.jpg – https://maribiella.files.wordpress.com/2014/05/signpost.jpg – http://freedompreneur.com/wp-content/uploads/2014/07/upside-down-rocket.jpg – http://www.sindhud.info/files/2009-11-25-webdriver/api-uml.png
  • 26.
    Thank you foryour attention! (rrehni shuplaka se u kry)