Foundation selenium java

  • 2,136 views
Uploaded on

Foundation Selenium Java Course

Foundation Selenium Java Course

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,136
On Slideshare
0
From Embeds
0
Number of Embeds
3

Actions

Shares
Downloads
2
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Foundation Selenium Webdriver (java) 2 days training
  • 2. Who is the training for? • Ideal for manual testers wanting to move into automation testing • No programming knowledge required • Testers involved with website testing • Testers wanting to gain technical skills !2 www.time2test.co.uk
  • 3. High level • • • • TestNG and jUnit Selenium configuration • ANT • Cross Browser XPATHS and CSS Selectors • • Selenium overview • • Firebug and Firepath • Website testing Selenium IDE Selenium RC Java for Selenium • Java OOP concepts • Forms and Webdriver • Eclipse IDE and Maven • Excel and Webdriver !3 www.time2test.co.uk
  • 4. What will you learn? • Selenium overview and configuration • Test Frameworks - testNG and jUnit Frameworks • Selenium IDE ( user extensions, record, playback, JavaScript, IDE to Webdriver) • ANT integration with Webdriver • Cross Browser testing using Webdriver • XPATHS and CSS location strategies • Firebug and Firepath • Website testing using Webdriver ( hyperlinks, Buttons, Input boxes, attachments) • Forms and Webdriver • Excel and Webdriver • • • • Selenium RC ( cross browser testing, start and stop, command line usage ) Java for Selenium (SDK, features, variables, functions, loops, constructors, interfaces) Java OOP concepts (Class, Objects in Java, Inheritance in Java, Java Packages, exception handling) Eclipse IDE ( download, versions, common jars, installation) and MAVEN !4 www.time2test.co.uk
  • 5. schedule Day 1 Day 2 • Selenium IDE and RC • Webdriver • Java • jUnit and testNG • Java OOP • cross browser • Environment • xpaths and css • Eclipse and Maven • firebug and firepath !5 www.time2test.co.uk
  • 6. What’s new? “We have raised the learning bar for our foundation level training with more emphasis on Selenium Webdriver and Java.” • More focus on Webdriver API • More focus on Java for Web-driver • Less focus on Selenium IDE and Selenium RC • More focus on ANT and jUnit !6 www.time2test.co.uk
  • 7. Environment
  • 8. overview • Eclipse IDE • JDK - versions • Java version • Maven • installation and configuration !8 www.time2test.co.uk
  • 9. download and use • We need to use many different software components on a variety of different hardware and operating systems. !9 www.time2test.co.uk
  • 10. Eclipse IDE • Editor • Let the magic of Eclipse help with programming !10 www.time2test.co.uk
  • 11. maven • manages the software package dependencies and versions. • we will use Eclipse’s built in maven support • can be used via command line !11 www.time2test.co.uk
  • 12. maven • dependencies • pom file !12 www.time2test.co.uk
  • 13. Java
  • 14. Aim • Aim is to learn enough Java for Testers that will allow you to develop Webdriver test scripts. • too much detail at the Java level will deter you from moving to Webdriver. !14 www.time2test.co.uk
  • 15. overview • Variables • Functions • Loops • Constructors • Interfaces !15 www.time2test.co.uk
  • 16. High level terms • objects - has behaviours/states - a web page has states - links, buttons, forms, images and behaviours like form submission, link navigation • class - blueprint that describes behaviours/states for an object • methods - are behaviours • instance variables - values assigned to instance variables !16 www.time2test.co.uk
  • 17. Basics • case sensitive • class names - start with upper case • method names - start with lower case • saving files - save as the class name ( eclipse will do this) • main() - mandatory for java program ( not if you use jUnit) !17 www.time2test.co.uk
  • 18. Basics 2 • java identifiers - variables, classes, methods use names - begin with character or underscore • java modifiers • • • access - default, protected, private, public non access - final, abstract java variables • local • class ( static) • instance ( non static) !18 www.time2test.co.uk
  • 19. java keywords abstract assert boolean break byte case catch char class const continue default do doubleelse final finally float instanceof for goto if int interface long enum extend implements import native newpackage private protected public return short static strictfp super switch synchronized this transient try void !19 throw throws volatilewhile www.time2test.co.uk
  • 20. Say Hello • Very First Java Program • what does it mean? ! public class HelloWorld { ! public static void main(String[] args) { ! System.out.println("Hello to java for Webdriver"); } ! } !20 www.time2test.co.uk
  • 21. simple case study • class • objects • constructors • instance variables !21 www.time2test.co.uk
  • 22. Date Date d = new Date(); // will give you the date and time !22 www.time2test.co.uk
  • 23. variables • integer • double • string • char !23 www.time2test.co.uk
  • 24. methods - functions • without a return value - void • with return values • take inputs as parameters !24 www.time2test.co.uk
  • 25. arrays • integer array • string array • object array !25 www.time2test.co.uk
  • 26. multi arrays String x[][] = new String[3][4]; !26 www.time2test.co.uk
  • 27. conditions • greater than, less than… > ,< , <=, >=, ! • comparators - and &&, or ||, equals == !27 www.time2test.co.uk
  • 28. statements • if , then , • if, then, else if • switch statement !28 www.time2test.co.uk
  • 29. loops • while • for • do while !29 www.time2test.co.uk
  • 30. loops - while • while(expression) • { //block of code to run • • } !30 www.time2test.co.uk
  • 31. loops - for • for(initialization; expression; update_statement) • { //block of code to run • • } !31 www.time2test.co.uk
  • 32. loops - do while • do • { • • //block of code to run } while(expression); !32 www.time2test.co.uk
  • 33. random • Random inputs for forms based testing !33 www.time2test.co.uk
  • 34. exceptions example • catch those exceptions and print them out !34 www.time2test.co.uk
  • 35. comments • multiple /* */ • single line // !35 www.time2test.co.uk
  • 36. Java OOP
  • 37. overview • • constructors • inheritance • packages • getter and setter methods objects • • class exceptions !37 www.time2test.co.uk
  • 38. class // field, constructor, and // method declarations !38 www.time2test.co.uk
  • 39. constructors Constructor declarations look like method declarations—except that they use the name of the class and have no return type !39 www.time2test.co.uk
  • 40. getter and setter methods • Define methods which allow you to read the values of the instance variables and to set them. These methods are called setter and getter. !40 www.time2test.co.uk
  • 41. objects A typical Java program creates many objects, which interact by invoking methods. !41 www.time2test.co.uk
  • 42. overriding If a class inherits a method from its super class, then there is a chance to override the method provided that it is not marked final. !42 www.time2test.co.uk
  • 43. inheritance • class extends an existing class !43 www.time2test.co.uk
  • 44. encapsulation • encapsulation is also referred to as data hiding. !44 www.time2test.co.uk
  • 45. abstraction • Abstraction refers to the ability to make a class abstract in OOP. An abstract class is one that cannot be instantiated. !45 www.time2test.co.uk
  • 46. interfaces An interface is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface. !46 www.time2test.co.uk
  • 47. polymorphism Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. !47 www.time2test.co.uk
  • 48. packages • folder structure !48 www.time2test.co.uk
  • 49. exceptions • Large topic area - lets focus on what we need for web driver and appreciate high level • try • catch • finally • throw !49 www.time2test.co.uk
  • 50. try - catch • Do something and attempt to catch the exception. • View the java docs to see what type of exceptions can be caught !50 www.time2test.co.uk
  • 51. enum • An enum type is a special data type that enables for a variable to be a set of predefined constants. • Use them to reduce potential errors in your code ! public enum Day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } ! !51 www.time2test.co.uk
  • 52. jUnit
  • 53. overview • background • integration with Eclipse • notation • assertions • maven • examples !53 www.time2test.co.uk
  • 54. notation • @Test - Mark your test cases with @Test annotations • @Before and @After - use for “setup” and “tearDown” methods respectively. They run before and after every test case. • @BeforeClass and @AfterClass - Use for class wide “setup” and “tearDown” respectively. They run for one time before and after all test cases. • @Ignore - ignore a test case !54 www.time2test.co.uk
  • 55. Assertions • assertEquals([String message], expected, actual) - Tests that two values are the same. Note: for arrays the reference is checked not the content of the arrays. • assertTrue([message], boolean condition) - Checks that the boolean condition is true. !55 www.time2test.co.uk
  • 56. testNG
  • 57. overview • integration with Eclipse • notation • maven • examples • @DataProvider and @Parameters • differences between jUnit and testNG !57 www.time2test.co.uk
  • 58. annotations • @BeforeClass - oneTimeSetUp • @BeforeMethod - setUp • @Test - testEmptyCollection • @AfterMethod - tearDown • @BeforeMethod - setUp • @Test - testOneItemCollection • @AfterMethod - tearDown • @AfterClass - oneTimeTearDown !58 www.time2test.co.uk
  • 59. @Parameters • xml files to grab parameters for tests !59 www.time2test.co.uk
  • 60. @DataProviders • test data as inputs !60 www.time2test.co.uk
  • 61. Test Results TestNG by default generates a different type of report for its test execution. This includes an HTML and an XML report output. !61 www.time2test.co.uk
  • 62. ant
  • 63. overview • what is ant? • command line usage • benefits • ant and testNG !63 www.time2test.co.uk
  • 64. Webdriver
  • 65. overview • more details coming soon !65 www.time2test.co.uk
  • 66. locating webelements
  • 67. overview • more details coming soon !67 www.time2test.co.uk
  • 68. alerts and cookies
  • 69. overview • more details coming soon !69 www.time2test.co.uk
  • 70. wait strategies
  • 71. overview • more details coming soon !71 www.time2test.co.uk
  • 72. cross browser
  • 73. overview • more details coming soon !73 www.time2test.co.uk
  • 74. data driven • Excel spreadsheets or CSV files to seed your tests !74 www.time2test.co.uk
  • 75. know how
  • 76. overview • more details coming soon !76 www.time2test.co.uk
  • 77. Selenium IDE and RC
  • 78. overview • Selenium IDE! • • javascript functions and random variables • • install and use record and playback Selenium RC! • download and use • cross browser !78 www.time2test.co.uk
  • 79. Jenkins
  • 80. overview • more details to follow !80 www.time2test.co.uk
  • 81. Conclusions
  • 82. goals and objectives • Review your goals. • Have we met your expectations? • Email us and we will setup a follow up Skype session !82 www.time2test.co.uk
  • 83. Thank you • From the Time2test Team !83 www.time2test.co.uk