Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced Web Automation Using Selenium

Similar presentations


Presentation on theme: "Advanced Web Automation Using Selenium"— Presentation transcript:

1 Advanced Web Automation Using Selenium
Portnov Computer School Advanced Web Automation Using Selenium Test Automation For Web-Based Applications Presenter: Ellie Skobel

2 JDBC Data Driven Testing
Day 2 JDBC Data Driven Testing

3 Data Driven Testing Testing of application by means of re-usable test logic to reduce maintenance and improve test coverage Test scripts are executed and verified based on the data values stored in one or more central data sources

4 JDBC API The industry standard for database- independent connectivity between the Java programming language and a wide range of databases. Lets you: Establish a connection with a database Send SQL statements Process the results

5 Background Created by SUN in partnership with an array of companies
Rapidly established as the industry-standard, open interface for Java applications to access databases. Supported by mySQL, Oracle, Sybase, HP, IBM, etc.

6 Advantages of JDBC Zero Configuration for Network Computers
No configuration is required on the client side. All the information needed to make a connection is completely defined by the JDBC URL or by a DataSource object No Installation A pure JDBC technology-based driver does not require special installation; As simple as adding a jar.

7 Using JDBC Before we begin we will need to import the content from java.sql package. Create a Connection with the DB server Create a SQL Statement to retrieve the data Collect the ResultSet Process the Result into a Collection

8 Create Database Connection
Information you will need: URL = jdbc:mysql://p3plcpnl0912.prod.phx3.secureserver .net:3306/ Database name = seleniumminutes Driver = com.mysql.jdbc.Driver Username = student Password = Student2015 Add the following code to Environment.java Class.forName(driver).newInstance(); Connection conn = DriverManager.getConnection(url + dbName, userName, password);

9 Create a SQL Statement & Collect the ResultSet
Let’s create a SQL statement using form: SELECT * FROM TABLE String query = “Select * From Calculator_Data”; Now we are ready to create a statement: Statement stmt = conn.createStatement(); Collect the ResultSet: ResultSet rs = stmt.executeQuery(selectString);

10 Process the Result To process each row in the ResultSet, we use the next() method. This method moves the pointer through the rows of data. The ResultSet maintains a cursor pointing to the current row. Because this cursor is initially positioned before the first row, we must call next() before we can see any rows at all. while (rs.next()) { int num1 = rs.getInt("num1"); Object[] singleTest = {num1, oper, num2, exp_result}; data.add(singleTest); }

11 What comes up, must come down!
Cleanup What comes up, must come down! Before we are done, we must close all open threads. Close all threads in the reverse order of which they were opened. Close the statement: Statement stmt.close(); Close the connection Environment.closeMySQLConnection();


Download ppt "Advanced Web Automation Using Selenium"

Similar presentations


Ads by Google