Skip to main content

Posts

Showing posts from July, 2018

Oracle DB Testing with Selenium

1. For Database Verification in To use Selenium Webdriver, we need to use the JDBC ("Java Database Connectivity"). Its API provides following classes and interfaces: Driver Manager Connection Statement ResultSet SQLException 2. In order to test our Database using Selenium, we need to perform the following steps: a. Make a connection to the Database. Syntax is: Connection DB_Con= DriverManager.getConnection(URL, "USERID", "PASSWORD" ) And load JDBC Driver class using the syntax: Class.forName("oracle.jdbc.driver.OracleDriver"); b. Execute Queries to the Database Statement stmt = DB_Con.createStatement(); stmt.executeQuery(select *  from employee;); ResultSet rs= stmt.executeQuery(query); c. Process the result set based on your need: while (rs.next()){ String FisrtName= rs.getString(1);          String LastName= rs.getString(2); System.out.println("First Name is: " +FisrtName); System.out.p

Re-run failed test cases in Cucumber with TestNG

How to re-run your failed test cases in Cucumber with TestNG? 1. Add rerun:target/rerun.txt in your Cucumber plugin Option like: plugin = {"rerun:target/rerun.txt" } 2. Once you execute you main Runner class it will create "rerun.txt" file in "target" folder which will have your failed test cases like: OrderFlow 4:4  LoginFlow 21:21 3. You need to take this "rerun.txt" and bind it with features option of Cucumber in a new Runner class say "FailedScenarios" like: features = "@target/rerun.txt" Your TestRunner (Main) class will be like: @CucumberOptions( features = "src\\main\\java\\com\\qa\\feature", glue = { "stepDefinitions" }, plugin = { "com.cucumber.listener.ExtentCucumberFormatter:", "rerun:target/rerun.txt" }, monochrome = true, strict = true, dryRun = false, tags = { "@Regress