How to do Data driven testing in Selenium without excel file or Database

0 votes
In a recent interview, I was asked how I would conduct data-driven testing in Selenium without using an Excel spreadsheet or database. You cannot utilize an Apache POI and JDBC connection, the interviewer stated. I informed him that after that, we could create a configure.properties file and use the values from it by reading it in the base class' function Object() { [native code] } and using it throughout our project. (I am aware that that was not at all a compelling response, and the interviewer did not appear to be either.) I tried searching StackOverflow for this, but I was unable to discover anything related to it. I have three years of experience using Java as a binding language in selenium automation, so I was taken aback by the query. Please assist me with this. Is there really any way to conduct data-driven testing without using Excel and a database? This implies that our data must come from somewhere.
Oct 16, 2022 in Others by Kithuzzz
• 27,740 points
149 views

1 answer to this question.

0 votes

Try this:

Yes you can , just give data set into your tests by Dataprovider annotation
 // create 2 d array if you you have 2 data fields like uname and password

    @Dataprovider(name="Testdata")
 Public Object[][]  getData()
{
  // creating 2 data sets
Object[][] data=new Object[2][2];
data[0][0]="username1"
data[0][1]="username2"
data[1][0]="password1"
data[1][1]="password2"`enter code here`
return data;
 }
answered Oct 16, 2022 by narikkadan
• 51,240 points

Related Questions In Others

0 votes
0 answers

Data Driven Framework -- how to read and write in excel sheet using Selenium WebDriver with java

I'm using this code to read something, ...READ MORE

Oct 31, 2022 in Others by Kithuzzz
• 27,740 points
109 views
0 votes
1 answer

How to import excel file in Oracle SQL live

Hello, there are a few steps You'll ...READ MORE

answered Feb 18, 2022 in Others by gaurav
• 22,940 points
718 views
0 votes
0 answers
0 votes
1 answer
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
9,598 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
7,673 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
5,446 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
6,744 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP