I am using , Junit , Web driver and have JDBC connection

I have a with below scenario
Scenario Outline: Fill out the ATS Registration Form

When Click on SignUp
And first name is ”
And last name is ”
And username is ”
And phone is ”
And Email is ”
And companyname is ”
And companytype is ”
And address is ”
And country is ”
And province is ”
And city is ”
And Postal code is ”
And reference is ”
And ecommunications is Yes
And termsandcondition is enabled
And click on submit
Then verify the successmessage
And check the new user in database

Examples:

|firstname  | lastname   | username          | phonenumber  |    emailaddress      | companyname |companytype  | address    |country     | province    |   city      | postalcode   | reference   |
| Ram       |   Sita     |  kaka1123456 |  64189523    |[email protected] | AAAACCCC    |  Architect  |  AAAAA     |  Canada    |  Ontario    |   Toronto   |     M9V3G2   |    Other    |

I have a step definition which map to this feature and page object model.

I have one class for jdbc connection.

 package ca.test.utils;

import java..*;

public class Jdbcdemo {

    ConfigReader reader = new ConfigReader();

    public void jdbcdemo(){

        try {
            // Get a connection to database
            Connection myConn = DriverManager.getConnection("NA" , "NA", "NA");

            // Create a statement
            Statement mystatement = myConn.createStatement();

            //Execute 
            ResultSet myRs = mystatement.executeQuery("select * from `user` u  where u.username = ('kaka1123456')");

            //process the result
            while (myRs.next()){
               String actual =  myRs.getString("username");
                       System.out.println("username" + actual );
            }
            myRs.close();
            mystatement.close();
            myConn.close();
        }
        catch (Exception exc){
            exc.printStackTrace();
        }
    }

}

The result is printing on console

Is there any way to compare the feature file ( username ) with sql ? if not then how can i compare the ?



Source link https://sqa.stackexchange.com/questions/34736/is-there-any-way-to--sql-data-with-cucumber-feature-file-data

LEAVE A REPLY

Please enter your comment!
Please enter your name here