ArticleslgStudy

science

Database testing

Database testing is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Database testing rather than just read about it. In short: Database testing usually consists of a layered process, including the user interface (UI) layer, the business layer, the data access layer and the database itself. The UI layer deals with the interface design of the database, while the business layer includes databases supporting business strategies.

Database testing — main illustration
Database testing — illustration

Key takeaways

  • Database testing belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Database testing to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Database testing from memory before moving on to harder problems.

Reference excerpt

Database testing usually consists of a layered process, including the user interface (UI) layer, the business layer, the data access layer and the database itself. The UI layer deals with the interface design of the database, while the business layer includes databases supporting business strategies.

Purposes Databases, the collection of interconnected files on a server, storing information, may not deal with the same type of data, i.e. databases may be heterogeneous. As a result, many kinds of implementation and integration errors may occur in large database systems, which negatively affect the system's performance, reliability, consistency and security. Thus, it is important to test in order to obtain a database system which satisfies the ACID properties (Atomicity, Consistency, Isolation, and Durability) of a database management system. One of the most critical layers is the data access layer, which deals with databases directly during the communication process. Database testing mainly takes place at this layer and involves testing strategies such as quality control and quality assurance of the product databases. Testing at these different layers is frequently used to maintain the consistency of database systems, most commonly seen in the following examples:

Data is critical from a business point of view. Companies such as Google or Symantec, who are associated with data storage, need to have a durable and consistent database system. If database operations such as insert, delete, and update are performed without testing the database for consistency first, the company risks a crash of the entire system. Some companies have different types of databases, and also different goals and missions. In order to achieve a level of functionality to meet said goals, they need to test their database system. There may need to be more than the current approach of testing in which developers formally test the databases. However, this approach is not sufficiently effective since database developers are likely to slow down the testing process due to communication gaps. A separate database testing team seems advisable. Database testing mainly deals with finding errors in the databases so as to eliminate them. This will improve the quality of the database or web-based system. Database testing should be distinguished from strategies to deal with other problems such as database crashes, broken insertions, deletions or updates. Here, database refactoring is an evolutionary technique that may apply.

Types of testings and processes

The figure indicates the areas of testing involved during different database testing methods, such as black-box testing and white-box testing.

Black-box Black-box testing involves testing interfaces and the integration of the database, which includes:

Mapping of data (including metadata) Verifying incoming data Verifying outgoing data from query functions Various techniques such as Cause effect graphing technique, equivalence partitioning and boundary-value analysis. With the help of these techniques, the functionality of the database can be tested thoroughly. Pros and Cons of black box testing include: Test case generation in black box testing is fairly simple. Their generation is completely independent of software development and can be done in an early stage of development. As a consequence, the programmer has better knowledge of how to design the database application and uses less time for debugging. Cost for development of black box test cases is lower than development of white box test cases. The major drawback of black box testing is that it is unknown how much of the program is being tested. Also, certain errors cannot be detected.

White-box White-box testing mainly deals with the internal structure of the database. The specification details are hidden from the user.

It involves the testing of database triggers and logical views which are going to support database refactoring. It performs module testing of database functions, triggers, views, SQL queries etc. It validates database tables, data models, database schema etc. It checks rules of Referential integrity. It selects default table values to check on database consistency. The techniques used in white box testing are condition coverage, decision coverage, statement coverage, cyclomatic complexity. The main advantage of white box testing in database testing is that coding errors are detected, so internal bugs in the database can be eliminated. The limitation of white box testing is that SQL statements are not covered.

The WHODATE approach

While generating test cases for database testing, the semantics of SQL statement need to be reflected in the test cases. For that purpose, a technique called WHite bOx Database Application Technique "(WHODATE)" is used. As shown in the figure, SQL statements are independently converted into GPL statements, followed by traditional white box testing to generate test cases which include SQL semantics.

Four stages Set fixture Test run Outcome verification Tear down A set fixture describes the initial state of the database before entering the testing. After setting fixtures, database behavior is tested for defined test cases. Depending on the outcome, test cases are either modified or kept as is. The "tear down" stage either results in terminating testing or continuing with other test cases. For successful database testing the following workflow executed by each single test is commonly executed:

Clean up the database: If the testable data is already present in the database, the database needs to be emptied. Set up fixture: A tool like PHPUnit will then iterate over fixtures and do insertions into the database. Run test, Verify outcome and then Tear down: After resetting the database to empty and listing the fixtures, the test is run and the output is verified. If the output is as expected, the tear down process follows, otherwise testing is repeated.

… excerpt ends here. Continue reading the full article.

Illustrations

Database testing: WHODATE approach for SQL statement transformation
WHODATE approach for SQL statement transformation

Worked examples

Example 1 — a first encounter with Database testing

Start with the simplest possible case. Write down what Database testing claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Database testing before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Database testing ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Database testing

In research
Database testing appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Database testing in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Database testing is common in secondary-school and first-year university syllabi. It links to neighbouring topics Database engines, Database normalization, so understanding it makes those chapters shorter.
In everyday life
Look for Database testing outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Database testing” →

How to study Database testing in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Database testing means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Database testing out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Database testing in simple terms?

Database testing usually consists of a layered process, including the user interface (UI) layer, the business layer, the data access layer and the database itself. The UI layer deals with the interface design of the database, while the business layer includes databases supporting business strategie…

Why does Database testing matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Database testing?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Database testing.

Tags

  • Database engines
  • Database normalization

Keep exploring