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
• 38,000 points
1,258 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
• 63,600 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
• 38,000 points
650 views
0 votes
1 answer

How do I stop python from appending data to the same row in excel?

There is no indication in your code ...READ MORE

answered Mar 25, 2023 in Others by narikkadan
• 63,600 points
531 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
• 23,260 points
2,141 views
0 votes
0 answers
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
13,673 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
9,142 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,910 points
7,221 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
7,874 views
0 votes
1 answer
0 votes
1 answer

How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office?

You can use OLEDB to create and ...READ MORE

answered Jan 3, 2023 in Others by narikkadan
• 63,600 points
1,600 views
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