Re: [webdriver] how to do database testing using selenium webdriver.

3,710 views
Skip to first unread message

Krishnan Mahadevan

unread,
Jun 3, 2013, 12:39:32 PM6/3/13
to webd...@googlegroups.com
You CANNOT do database testing using Selenium/WebDriver. WebDriver is ONLY for UI Automation. 

On Monday, June 3, 2013, Malappa K wrote:
Hi All,

           I want to do database testing using selenium webdriver. here i have small doubt after geting database ResultSet data
how to verify on user interface content.

for example:-

I am getting ResultSet data from Student table by using jdbc code.this data can be displayed on userinterface table like

Students Details:-
Sno sname address
1      mahi    HYD
2      subbu KNL
3      madhu Guntur

Here i want to do verify Student ResultSet data with UserInterface StudentDetails content.
Here i want to examine this data is coming from database or not.

This is my urgent requirement. i am waiting for your response.

Thanks,
Malappa.

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

Sandeep R

unread,
Jun 4, 2013, 1:41:56 AM6/4/13
to webd...@googlegroups.com
I think you can do database testing also.. can you please check once again,

Sandeep R


Krishnan Mahadevan

unread,
Jun 4, 2013, 1:47:22 AM6/4/13
to webd...@googlegroups.com
Sandeep,

Does this database testing have anything to do with opening a web application in a browser ? If yes then selenium/WebDriver could be used. If your answer is NO, then am re-iterating what I already stated: WebDriver/Selenium is not the tool you need!

Sandeep R

unread,
Jun 4, 2013, 2:34:58 AM6/4/13
to webdriver
Hi,

The database testing may be used for confirming some condition after an action performed in UI, For eg: A connected to B and B connected to C, if suppose the condition is if we are deleting A in UI, it should delete A and disconnect the relation between B and C, so for checking whether the connection between B and C is disconnected, database testing is needed. It can't be checking in UI. I think selenium can be used for this.

Can you please check with Malappa.K about the use-case he faced

Thanks,
Sandeep

Sandeep R


Krishnan Mahadevan

unread,
Jun 4, 2013, 2:40:46 AM6/4/13
to webd...@googlegroups.com
Sandeep,
Isn't this what I said as well .. that Selenium/WebDriver isn't the tool for Database testing ?

Since the query has got nothing to do with Selenium/WebDriver not sure what is the point in checking the use case with the OP ?

Mark Collin

unread,
Jun 4, 2013, 4:14:12 AM6/4/13
to webd...@googlegroups.com
Lets be 100% clear about this.

Selenium has nothing in its API to connect to a database and perform queries.

Selenium is a *browser* automation tool.

If you are using Selenium to test your database, you are doing it wrong!

No really, you are doing it totally wrong, Selenium is NOT a database testing tool, it is a browser automation tool.

Sandeep R

unread,
Jun 4, 2013, 5:52:13 AM6/4/13
to webd...@googlegroups.com
Ok thanks for the useful info :) , Is it like selenium doesn't works for database testing? and can you tell me how database can be tested?

Thanks,
Sandeep

Sandeep R


Manoj K

unread,
Jun 4, 2013, 1:56:00 PM6/4/13
to webd...@googlegroups.com
Sandeep, as Mark and Krishnan have mentioned Selenium isn't the tool to perform the DB testing.

You can google on the same to get some info..

Regards,
Manoj

Sandeep R





Sandeep R




Sandeep,


Sandeep R




To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+unsubscribe@googlegroups.com.

To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+unsubscribe@googlegroups.com.

To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+unsubscribe@googlegroups.com.

darrell

unread,
Jun 4, 2013, 6:40:51 PM6/4/13
to webd...@googlegroups.com
You have to be careful about the language you use. Database testing is a very specific type of testing to many people. Selenium WebDriver is used to automate tests a person would normally perform on a web application. You can use Selenium to simulate keyboard, mouse and some 'visual' actions. Anything outside of interacting with the web application through the browser does not use or require Selenium.

As a manual tester I have run tests on a web application to confirm the expected data appears in the correct location of the web application. There are a number of scenarios which this situation might be covered. For example,

Case #1: 

Someone gives me a test plan, they seed the application with test data. The test requires me to confirm the right data appears on the appropriate page. When I automate this test, I could hard code the data so it matches the expected seed data. So when the test runs it confirms the expected data is the actual data.

Case #2

Someone gives me a test plan and I'm told the expected data can be found in a database. I load up Squirrel (or some other database client), connect to the database, run the specified SELECT statements. I then confirm the data I got from the SELECT statement matches the data I see in the web application. When I automate this test, I will use JDBC to connect to the database and get a ResultSet. I then use the data from the ResultSet as my expected data and use Selenium to get the actual data. I then use assert statements to confirm the expected data (from database) matches the actual data (from the Web Application).

Case #3

I'm given a test plan, I run the tests then use a database client to examine the database. The test plan tells me what the expected results should be, For example, if you enter the first name "TestUser2093476420" you should expect to see this value in the table XXX. It should only appear once. It should be in column YYY. To automate this I would use Selenium to get the expected data from the web application then I'd use JDBC to get the actual data from the database.


None of this is technically database testing. This is REALLY testing a technology stack (web application & database) to see if things match. Additionally, finding problems sooner in the test cycle is much better. If I (or someone) can write a unit test to catch things, I would use unit tests. Essentially, if the Selenium/JDBC test is equivalent to the unit test, I'd just keep the unit test.

Your example sounds like you are trying to do something like Case #2. Tests tend to break down to actual versus expected. Don't think of it as does the database match the web application. Think of it as one is the expected data and the other is the actual data. You want to assert they are equal.

As for why you REALLY want to test this at the unit level have a read of page 276+ from Lisa Crispin's & Janet Gregory's Agile Testing: A Practical Guide For Testers and Agile Teams. It talks about the Test Triangle and why you want to push things down to the unit level whenever possible.

Darrell
Reply all
Reply to author
Forward
0 new messages