I am using cucumber , Junit , Selenium Web driver and have JDBC connection
I have a feature 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 file and page object model.
I have one class for jdbc connection.
package ca.test.utils;
import java.sql.*;
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 sql
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 data ( username ) with sql data ? if not then how can i compare the data?