Example 1: what do we need to test in database testing
In Database testing,
Testing of Data Integrity
Testing of Data Validity
Data base related performance
Testing of functions, procedure and triggers
are necessary to test.
What is Database Black Box Testing?
Database Black Box testing involves:
• Data Mapping
• Data stored and retrieved
• Use of Black Box testing techniques
such as Equivalence Partitioning
and Boundary Value Analysis
Example 2: database testing in framework
For database testing For manual I use Oracle sql developer for producing SQL
queries
FOR AUTOMATION; I use JDBC library to integrate
java by getting a CONNECTION from oracle database
then creating STATEMENTS using SQL queries and
then storing the data into a RESULTSET object.
I use java data structures to use store data inside and
compare them
and since I'm using DATA DRIVEN and CUCUMBER
BDD framework, all of these tests are stored inside feature
files
I have RUNNER classes that helps generate codes from
FEATURE FILE and implement them into a file called b
I also have HOOK class that implements my codes that
run before and after all my tests - this is where I invoke my
TAKESCREENSHOT interface which triggers when I use
scenario interface (when scenario fails)
It takes a picture when you are on the step that failed
StepDefinition - this is where I stored my codes that
based on gherkin language expected value DDT
If I'm working with small amounts of test data, I'm
going to operate with scenario outlines, this where I create
examples and store data using pipeline
In my automation framework I had database utility class
which handles everything related to setting up
connections, closing connections, getting data from
database and storing results from database into
different collections arrays etc. So that I can easily work with
it.
And I use it in my framework by
using Connection interface, with getConnection method(url,username, password)
I’m keeping url, username, password in the configuration
file
url starts with oracle or postgresql, mysql...
url:"jdbc:oracle:thin:@url:1521:xe";
Syntax:
Connection connection = DriverManager.getConnection(url,
username, password) //throws SQL exception:checked
exception
Statement statement = connection.CreateStatement()
//throws SQL exception: checked exception
ResultSet resultSet = statement.executeQuery("Query")
resultSet.getObject/String/int(index)
ResultSetMetaData
resultSetMetaData=resultSet.getMetaData() columns
First,
getConnection -> connection.CreateStatement -> Resultset
resultset
ResultSetMetaData rsm = resultSet.getMetaData();
I can retrieve the column names and counts with the help of
rsm.getColumnName(i)/getColumnCount(),
Make sure you start your loop from 1 until <= last value
How did you do DB testing in your framework?
List
Example 3: database testing
In my company I verify the UI response with database
response as well as api response for database verification
1- I am checking if correct data is getting saved
in the database after successful submit
2- Checking if data is rolled back from database
in case of failed transactions
3-I am checking if data is committed to the database
only when transaction is successful Example: some patients
don't have permission to request refill it has to be thru physician.
4-I am also testing data integrity to check whether
data stored in correct places as planned.
Currently I use Oracle DB to manually verify database
and I use Jdbc to integrate java by getting a
Connection from oracle database then I create
STATEMENTS for using SQL queries and I create
RESULTSET object to store my data. I use
Java data structures to compare results and storing them.
n my framework I have database utility class which
handles everything related to setting up connections,
closing connections, getting data from database and
storing results from database into different collections arrays etc.
So that I can easily work with it.
CONNECTION :
Connection connection = DriverManager.getConnection(url,username, password)
//throws SQL exception:checked exception
Statement statement = connection.CreateStatement()
//throws SQL exception: checked exception
ResultSet resultSet = statement.executeQuery("Query")
Example 4: database testing
JDBC
It is a Java-based data access technology used for Java database connectivity.
It provides classes and interfaces to connect or communicate Java
application with database.
JDBC API is a Java API that can access any kind of data stored in
a Relational Database. It enables Java programs to execute SQL statements.
How did you do DB testing in your framework?
In my automation framework I have DB Utilities class which handles
everything related to setting up connections, closing connections,
getting data from database and storing results from database into
different collections, arrays, etc. So that I can easily work with it.
Example 5: how to do database testing in your framework
For database testing For manual I use Oracle sql developer for producing SQL
queries
FOR AUTOMATION; I use JDBC library to integrate
java by getting a CONNECTION from oracle database
then creating STATEMENTS using SQL queries and
then storing the data into a RESULTSET object.
I use java data structures to use store data inside and
compare them
and since I'm using DATA DRIVEN and CUCUMBER
BDD framework, all of these tests are stored inside feature
files
I have RUNNER classes that helps generate codes from
FEATURE FILE and implement them into a file called b
I also have HOOK class that implements my codes that
run before and after all my tests - this is where I invoke my
TAKESCREENSHOT interface which triggers when I use
scenario interface (when scenario fails)
It takes a picture when you are on the step that failed
StepDefinition - this is where I stored my codes that
based on gherkin language expected value DDT
If I'm working with small amounts of test data, I'm
going to operate with scenario outlines, this where I create
examples and store data using pipeline
In my automation framework I had database utility class
which handles everything related to setting up
connections, closing connections, getting data from
database and storing results from database into
different collections arrays etc. So that I can easily work with
it.
And I use it in my framework by
using Connection interface, with getConnection method(url,username, password)
I’m keeping url, username, password in the configuration
file
url starts with oracle or postgresql, mysql...
url:"jdbc:oracle:thin:@url:1521:xe";
Syntax:
Connection connection = DriverManager.getConnection(url,
username, password) //throws SQL exception:checked
exception
Statement statement = connection.CreateStatement()
//throws SQL exception: checked exception
ResultSet resultSet = statement.executeQuery("Query")
resultSet.getObject/String/int(index)
ResultSetMetaData
resultSetMetaData=resultSet.getMetaData() columns
First,
getConnection -> connection.CreateStatement -> Resultset
resultset
ResultSetMetaData rsm = resultSet.getMetaData();
I can retrieve the column names and counts with the help of
rsm.getColumnName(i)/getColumnCount(),
Make sure you start your loop from 1 until <= last value
How did you do DB testing in your framework?
List