SlideShare a Scribd company logo
USING AN SQL COVERAGE MEASUREMENT FOR
TESTING DATABASE APPLICATION
PUBLISHED BY: PRESENTED BY:
MARÍA JOSÉ SUÁREZ-CABAL KHALID KHAN
JAVIER TUYA
INTRODUCTION
• Testing is very expensive process.
 Around 30% of resources are committed to this.
 Not adequate tool available for testing databases
• Software applications use database for accessing the content they offer.
• It uses SQL queries to access the database.
• The automation of software testing is only for programs written in imperative and structured
languages.
• It is not applied to SQL queries embedded in application code.
• The main focus of this research paper is to test the SQL queries and the database.
OBJECTIVES
The main objectives of the research are:
• To define a measurement of coverage for SQL SELECT queries in database loaded
with test data
• To present an algorithm that automates the calculation of coverage
• To guide the expert with respect to how the database tuples might be changed to
increase the obtained coverage value, if possible.
RELATED WORK
- RESEARCH
Microsoft Research (1998) :. The aim was
to evaluate DBMS with SQL statements
and compare the outputs.
1998
Hong Kong University: White box testing
is used on application which uses DMBS.
SQL queries were translated into
imperative languages.
1999
At first international workshop of
Automated Program Analysis, Test data is
generated, SQL queries are executed and
state of database is verified.
2000
RELATED WORK - COMMERCIAL
• In commercial area, there are small number of generators of database instances, e.g. TestByte,
TestBase, DataTect which generate random information depending on the type of fields.
 The problem is that user must know the database structure in order to use these tools.
• SQLUnit is another tool that facilitates testing of stored procedure and SQL statements.
SOFTWARE TESTING WITH DATABASES
There are several problems attached with testing of software application which uses DBMS
through SQL queries, which makes this testing difficult for the following reasons:
• Selection of initial instances of the test database is one of the most important steps
• Combination of tuples must be taken into account to cover all the SQL query situations
• Test data should be useful for the greatest possible number of queries
• As in imperative languages, SQL statements may be parameterized by variables and
constants, so these inputs must be considered.
EXAMPLE
sup_code sup_name
001 sup1
002 sup2
SUPPLIER ORDER
ord_num sup_code
1 001
2 001
3 002
ord_num sup_name
1 sup1
2 sup1
3 sup2
SELECT sup_name, ord_num
FROM Supplier s LEFT JOIN Order o
ON (s.sup_code = o.sup_code)
DETECTING FAULTS IN SELECT QUERIES
The problems detected are:
 There may exist a supplier with no orders, but this situation is not represented by the test
data.
 Impossible to know whether the query always return the information required.
Hence, we can affirm that an adequate SELECT coverage is not obtained with these test data.
DETECTING FAULTS IN SELECT QUERIES
sup_code sup_name
001 sup1
002 sup2
003 sup3
SUPPLIER ORDER
ord_num sup_code
1 001
2 001
3 002
ord_num sup_name
1 sup1
2 sup1
3 sup2
sup3
SELECT sup_name, ord_num
FROM Supplier s LEFT JOIN Order o
ON (s.sup_code = o.sup_code)
COVERAGE OF SELECT QUERIES
The solution for automated search of SQL query situations covered with the data stored in the
database is to evaluate the conditions of SELECT queries:
 When they are in FROM clause
 When they include JOIN clause
 When they are in WHERE clause
Also, the null values of field should be verified at the same time as the condition is evaluated.
COVERAGE OF SELECT QUERIES - EVALUATION OF CONDITIONS
Conditions are evaluated between sets of values, information in each field corresponds to a
column from a table to several rows in the database. During an evaluation of a condition,
 Each value in the first field must be compared with each one in the second field
 Each value in the second field must be compared with each one in the first field
COVERAGE OF SELECT QUERIES - COVERAGE TREE
A tree structure, called coverage tree, is created prior to coverage evaluation, in which each level
of represents a condition of the query:
 Beginning with the condition of JOIN clause (if it exists)
 Those with the WHERE clause
in the same order, in which they are found in the query.
Each node of the tree will store:
 Whether the condition is true for values of the fields,
 Whether the condition is false for values of the fields,
 Whether there are null values in condition field,
EVALUATION OF CONDITIONS (CONT’D)
The evaluation of a condition:
• The grammar:
• A condition will be true (T) if it is verified for a pair of values from the field to compare.
• A condition will be false from left to right (Fl), if none of the values from second field verifies
the condition with a value from the first field.
EVALUATION OF CONDITIONS (CONT’D)
• A condition will be false from right to left (Fr), if none of the
values from first field verifies the condition with a value from
the second field.
• A condition will have null values (Nl) when a value from the first field is null.
• A condition will have null values (Nr) when a value from the second field is null.
• A condition will have null values (Nb) when a value from the first and second fields are null.
COVERAGE TREE
Nl Nb Nr
N N N
s.sup_code = o.sup_code
Fl T Fr
N Y N
EVALUATION OF COVERAGE TREE
The complete evaluation of the query is carried out by crossing over the tuples of the tables
participating in the condition at each level of the coverage tree.
 The evaluation finishes when the coverage is 100% or there are no more values for
comparing.
After evaluating the coverage tree, two different coverage measures are established:
 Theoretical Coverage: It takes into account every possible situation at every node.
 Schema Coverage: It takes into account the database schema constraint by excluding impossible
situation due to these constraints.
THEORETICAL COVERAGE
Problem: It is not usually possible to reach 100% theoretical coverage, because of forbidden
null values or referential integrity constraint.
Solution: Schema Coverage
SCHEMA COVERAGE
 It takes into account the database schema constraint by excluding impossible situation due to
these constraints
 Due to referential integrity, an order always had a supplier, Fr, Nb and Nr will never be
verified (X)
Nl Nb Nr
N X X
s.sup_code = o.sup_code
Fl T Fr
N Y X
THE TOOL
The schema of the tool developed for measuring the coverage of SELECT query.
CONCLUSION AND FUTURE WORK
 The most important aim considered: two different coverage measures for the coverage of SQL queries
have been established, i.e. Theoretical and Schema Coverage.
 The number of tuples in the database may be simplified by tracing the coverage tree. This is useful for
creating smaller databases and for detecting information that would have to be inserted to make them
complete.
For future work,
 SQL Queries, which were analyzed, were simple and isolated. There is a plan to increase the complexities
of queries by including the parameters in it.
 It will be necessary to integrate SQL coverage criteria with other criteria for imperative languages for
stored procedures to be tested.
Thank You

More Related Content

PPT
Query processing-and-optimization
PPTX
Query evaluation and optimization
PPTX
Use cases - agentMET4FOF
PDF
Query trees
PPT
Business Research Methods Chap017
PDF
8 query processing and optimization
PPT
Business Research Methods Chap008
PPTX
Query processing
Query processing-and-optimization
Query evaluation and optimization
Use cases - agentMET4FOF
Query trees
Business Research Methods Chap017
8 query processing and optimization
Business Research Methods Chap008
Query processing

What's hot (20)

PDF
C054
PPT
Chapter15
PPTX
Query processing and optimization (updated)
PPT
Query Decomposition and data localization
PPTX
PPTX
Cost estimation for Query Optimization
PPTX
Query processing and Query Optimization
PPT
13. Query Processing in DBMS
PPTX
Query-porcessing-& Query optimization
PDF
SQL Joins and Query Optimization
PPTX
Analysis Of Attribute Revelance
PPT
Overview of query evaluation
PPTX
Data What Type Of Data Do You Have V2.1
PPTX
Multivariate data analysis
PPTX
Excel Database Function
PPT
Query optimization
PPT
Stat2 25 09
PPTX
Query Optimization
C054
Chapter15
Query processing and optimization (updated)
Query Decomposition and data localization
Cost estimation for Query Optimization
Query processing and Query Optimization
13. Query Processing in DBMS
Query-porcessing-& Query optimization
SQL Joins and Query Optimization
Analysis Of Attribute Revelance
Overview of query evaluation
Data What Type Of Data Do You Have V2.1
Multivariate data analysis
Excel Database Function
Query optimization
Stat2 25 09
Query Optimization
Ad

Similar to Using an SQL coverage measurement for testing database application (20)

PDF
SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343
PPTX
Introduction to formal methods lecture notes
PPTX
Lecture 5.pptx
PDF
Database applicationtesting
PPT
Db2 sql tuning and bmc catalog manager
PDF
Parameter Estimation User Guide
PPT
probabilistic ranking
PPTX
Software Testing Foundations Part 4 - Black Box Testing
PPTX
Test design techniques
PPT
Dynamic analysis in Software Testing
PDF
NCTU ppt 2023-2024_WEEK3-DataTypes-Clauses-Operators.pdf
PPT
CROSS-VALIDATION AND MODEL SELECTION (1).ppt
PPTX
SE UNIT 5 part 2 (1).pptx
PDF
Tutorial databasetestingusingsql
PPTX
Query processing and optimization on dbms
PDF
Data warehousing testing strategies cognos
PPTX
RQP reverse query processing it's application 2011.pptx
PDF
Survey on classification algorithms for data mining (comparison and evaluation)
PDF
Coverage-Criteria-for-Testing-SQL-Queries
PDF
MODULE 1.pdf foundations of data science for final
SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343
Introduction to formal methods lecture notes
Lecture 5.pptx
Database applicationtesting
Db2 sql tuning and bmc catalog manager
Parameter Estimation User Guide
probabilistic ranking
Software Testing Foundations Part 4 - Black Box Testing
Test design techniques
Dynamic analysis in Software Testing
NCTU ppt 2023-2024_WEEK3-DataTypes-Clauses-Operators.pdf
CROSS-VALIDATION AND MODEL SELECTION (1).ppt
SE UNIT 5 part 2 (1).pptx
Tutorial databasetestingusingsql
Query processing and optimization on dbms
Data warehousing testing strategies cognos
RQP reverse query processing it's application 2011.pptx
Survey on classification algorithms for data mining (comparison and evaluation)
Coverage-Criteria-for-Testing-SQL-Queries
MODULE 1.pdf foundations of data science for final
Ad

Recently uploaded (20)

PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
history of c programming in notes for students .pptx
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
top salesforce developer skills in 2025.pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Digital Systems & Binary Numbers (comprehensive )
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
ai tools demonstartion for schools and inter college
PPTX
Computer Software and OS of computer science of grade 11.pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Reimagine Home Health with the Power of Agentic AI​
How to Choose the Right IT Partner for Your Business in Malaysia
Upgrade and Innovation Strategies for SAP ERP Customers
Designing Intelligence for the Shop Floor.pdf
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
history of c programming in notes for students .pptx
Wondershare Filmora 15 Crack With Activation Key [2025
Design an Analysis of Algorithms II-SECS-1021-03
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
top salesforce developer skills in 2025.pdf
Softaken Excel to vCard Converter Software.pdf
Digital Systems & Binary Numbers (comprehensive )
VVF-Customer-Presentation2025-Ver1.9.pptx
ai tools demonstartion for schools and inter college
Computer Software and OS of computer science of grade 11.pptx

Using an SQL coverage measurement for testing database application

  • 1. USING AN SQL COVERAGE MEASUREMENT FOR TESTING DATABASE APPLICATION PUBLISHED BY: PRESENTED BY: MARÍA JOSÉ SUÁREZ-CABAL KHALID KHAN JAVIER TUYA
  • 2. INTRODUCTION • Testing is very expensive process.  Around 30% of resources are committed to this.  Not adequate tool available for testing databases • Software applications use database for accessing the content they offer. • It uses SQL queries to access the database. • The automation of software testing is only for programs written in imperative and structured languages. • It is not applied to SQL queries embedded in application code. • The main focus of this research paper is to test the SQL queries and the database.
  • 3. OBJECTIVES The main objectives of the research are: • To define a measurement of coverage for SQL SELECT queries in database loaded with test data • To present an algorithm that automates the calculation of coverage • To guide the expert with respect to how the database tuples might be changed to increase the obtained coverage value, if possible.
  • 4. RELATED WORK - RESEARCH Microsoft Research (1998) :. The aim was to evaluate DBMS with SQL statements and compare the outputs. 1998 Hong Kong University: White box testing is used on application which uses DMBS. SQL queries were translated into imperative languages. 1999 At first international workshop of Automated Program Analysis, Test data is generated, SQL queries are executed and state of database is verified. 2000
  • 5. RELATED WORK - COMMERCIAL • In commercial area, there are small number of generators of database instances, e.g. TestByte, TestBase, DataTect which generate random information depending on the type of fields.  The problem is that user must know the database structure in order to use these tools. • SQLUnit is another tool that facilitates testing of stored procedure and SQL statements.
  • 6. SOFTWARE TESTING WITH DATABASES There are several problems attached with testing of software application which uses DBMS through SQL queries, which makes this testing difficult for the following reasons: • Selection of initial instances of the test database is one of the most important steps • Combination of tuples must be taken into account to cover all the SQL query situations • Test data should be useful for the greatest possible number of queries • As in imperative languages, SQL statements may be parameterized by variables and constants, so these inputs must be considered.
  • 7. EXAMPLE sup_code sup_name 001 sup1 002 sup2 SUPPLIER ORDER ord_num sup_code 1 001 2 001 3 002 ord_num sup_name 1 sup1 2 sup1 3 sup2 SELECT sup_name, ord_num FROM Supplier s LEFT JOIN Order o ON (s.sup_code = o.sup_code)
  • 8. DETECTING FAULTS IN SELECT QUERIES The problems detected are:  There may exist a supplier with no orders, but this situation is not represented by the test data.  Impossible to know whether the query always return the information required. Hence, we can affirm that an adequate SELECT coverage is not obtained with these test data.
  • 9. DETECTING FAULTS IN SELECT QUERIES sup_code sup_name 001 sup1 002 sup2 003 sup3 SUPPLIER ORDER ord_num sup_code 1 001 2 001 3 002 ord_num sup_name 1 sup1 2 sup1 3 sup2 sup3 SELECT sup_name, ord_num FROM Supplier s LEFT JOIN Order o ON (s.sup_code = o.sup_code)
  • 10. COVERAGE OF SELECT QUERIES The solution for automated search of SQL query situations covered with the data stored in the database is to evaluate the conditions of SELECT queries:  When they are in FROM clause  When they include JOIN clause  When they are in WHERE clause Also, the null values of field should be verified at the same time as the condition is evaluated.
  • 11. COVERAGE OF SELECT QUERIES - EVALUATION OF CONDITIONS Conditions are evaluated between sets of values, information in each field corresponds to a column from a table to several rows in the database. During an evaluation of a condition,  Each value in the first field must be compared with each one in the second field  Each value in the second field must be compared with each one in the first field
  • 12. COVERAGE OF SELECT QUERIES - COVERAGE TREE A tree structure, called coverage tree, is created prior to coverage evaluation, in which each level of represents a condition of the query:  Beginning with the condition of JOIN clause (if it exists)  Those with the WHERE clause in the same order, in which they are found in the query. Each node of the tree will store:  Whether the condition is true for values of the fields,  Whether the condition is false for values of the fields,  Whether there are null values in condition field,
  • 13. EVALUATION OF CONDITIONS (CONT’D) The evaluation of a condition: • The grammar: • A condition will be true (T) if it is verified for a pair of values from the field to compare. • A condition will be false from left to right (Fl), if none of the values from second field verifies the condition with a value from the first field.
  • 14. EVALUATION OF CONDITIONS (CONT’D) • A condition will be false from right to left (Fr), if none of the values from first field verifies the condition with a value from the second field. • A condition will have null values (Nl) when a value from the first field is null. • A condition will have null values (Nr) when a value from the second field is null. • A condition will have null values (Nb) when a value from the first and second fields are null.
  • 15. COVERAGE TREE Nl Nb Nr N N N s.sup_code = o.sup_code Fl T Fr N Y N
  • 16. EVALUATION OF COVERAGE TREE The complete evaluation of the query is carried out by crossing over the tuples of the tables participating in the condition at each level of the coverage tree.  The evaluation finishes when the coverage is 100% or there are no more values for comparing. After evaluating the coverage tree, two different coverage measures are established:  Theoretical Coverage: It takes into account every possible situation at every node.  Schema Coverage: It takes into account the database schema constraint by excluding impossible situation due to these constraints.
  • 17. THEORETICAL COVERAGE Problem: It is not usually possible to reach 100% theoretical coverage, because of forbidden null values or referential integrity constraint. Solution: Schema Coverage
  • 18. SCHEMA COVERAGE  It takes into account the database schema constraint by excluding impossible situation due to these constraints  Due to referential integrity, an order always had a supplier, Fr, Nb and Nr will never be verified (X) Nl Nb Nr N X X s.sup_code = o.sup_code Fl T Fr N Y X
  • 19. THE TOOL The schema of the tool developed for measuring the coverage of SELECT query.
  • 20. CONCLUSION AND FUTURE WORK  The most important aim considered: two different coverage measures for the coverage of SQL queries have been established, i.e. Theoretical and Schema Coverage.  The number of tuples in the database may be simplified by tracing the coverage tree. This is useful for creating smaller databases and for detecting information that would have to be inserted to make them complete. For future work,  SQL Queries, which were analyzed, were simple and isolated. There is a plan to increase the complexities of queries by including the parameters in it.  It will be necessary to integrate SQL coverage criteria with other criteria for imperative languages for stored procedures to be tested.