whatsapp
top_banner_img

Backend Testing Tutorial: A detailed guide

Web App Testing

Friday February 22, 2019

What is the Backend Testing?

The backend testing ensures that your application works fine at the server-side and it assures the quality of the database.

The data that we enter in the front-end, is finally stored at the backend, using one of the many available databases like MySQL, Oracle, SQL Server, etc.

Assuring that the data we enter is properly and timely stored and retrieved from the database is done by backend testing. 

backend testing

Types of backend testing

  • Structural testing deals with metadata. In the structural backend, testing involves testing of objects that cannot be used by the users directly like Tables, Keys, Columns, Schema, Indexes, Functions, Triggers, etc.
  • Functional testing tests how the data is mapped between the backend and front-end. For eg. Considering an e-commerce website, if we ask for the price of any product, the front-end should map with the correct table and return the valid data.
  • Non-functional testing can be seen as a performance, load, and stress testing where the testers test the performance of the database for unexpected loads. Security testing is also a part of non-functional testing.

 Tools categories:

#1) Interfaces: interfaces are those that allow you to execute your queries for the database like TOAD, PHPMyAdmin, etc.

#2) DB load and performance benchmarking tools like SLOB, hammerDB, etc.

Importance of Backend Testing

Data is an important aspect of all computer applications. Most of the applications are loaded with a huge amount of data.

If you own a data hefty software, testing the backend becomes very vital for you. Assuring that data is properly stored and retrieved when required is very important to assure the best quality of your product.

Not only that, data security, accuracy, integrity, etc. are also major concerns of all the software.

Failing in either of your software can fail miserably in the market. the process also prevents complications like data corruption, deadlock, data loss, etc.

Backend testing test cases

  • A separate set of test cases is required to test the back end of any application
  • it’s a type of grey box testing
  • Data mapping sheet would make the database testing easier
  • Check values of columns
  • Add operation log
  • Check numeric fields with negative values for acceptance and non-acceptance
  • Check whether the data is committed to the database
  • Table indexes should be created and tested
  • Check for all functionalities of buttons and drop-down buttons are saved in a database
  • Check if the databases are designed with the correct design and length
  • Test stored procedure with the right data
  • Check whether null values are allowed in the primary key column
  • Check for table constraints

Do you wish to know about grey/gray box testing? Read here

Pros of Backend Testing

1.    Helps you test databases, servers, and API.

2.    It detects bugs at an early stage thus reducing the cost of fixing them.

3.    Help you test your application more comprehensively, providing you complete control over the test coverage.

4.    Evade deadlock and data loss issues.

5.    Enhances the system’s functional constancy and sturdiness.

6.    Enhances data quality.

Cons of Backend Testing

•    To conduct manual backend testing you are required to have deep database knowledge.

•    It can add to your organizational cost.

Backend Testing Validation Mechanism:

Backend Testing includes validating Keys and Indexes, Sequence testing, data integrity testing, Stored procedures testing, Database server validations, Functions testing, Performance check, Database tables, Triggers, etc.

Skills Required For Backend Testing:

Being a backend tester, you should have a good knowledge of database concepts like normalization and SQL queries for backend testing.

Backend Testing Elements:

Depending upon the features of your application, backend testing may include many communication protocols, network configurations, databases, servers, etc. 

Backend Database Testing

The database is an important part of your application. Seamless interaction between the GUI and the database is very important for the proper working of your application.

Any kind of discrepancies can cause performance bottlenecks and security issues. Hence Backend database testing is the most important. 

How to do Backend Testing?

The process is no different from other types of testing and follows more or less the same procedure

•   Prepare a testing strategy, test plan, test cases, and set up an environment.

•    Execute test plans.

•    Calculate the results.

•   Validate the results with anticipated results and the business requirements.

•    Report any defects or any issues.

For example, if we consider a train ticket booking website, it asks users to create their profile and also uses various online payment methods to book train tickets.

These websites use backend testing to assure the highest security and efficient working. The process ensures that profile information like name, address, payment method, etc. are stored in their designated database tables and no information is missed.

A proper test should be carried out to ensure that the data are timely and correctly retrieved. For all the monetary transactions, ACID properties should be properly tested. 

Common practices while performing backend testing

  • Test early, it helps reducing fixing costs considerably
  • Focus on test coverage to test the system thoroughly.
  • Try to keep yourself at bay with issues like deadlock and data loss.
  • Focus on the application’s functional stability and robustness.

Backend Testing Tools:

Here are some of the tools used for the process

•    Data Factory

•    Data Generator

•    Test Data Generator

•    AETG

•    TurboData

How to deal with common mistakes in backend testing:

While performing the process, many testers generally make a few mistakes to reduce the testing cost. Dealing with such issues is very important. Here is how 

  1. Inadequate testing approach

it is not very easy and requires good knowledge of databases. if your team is not very skilled and efficient they might end up doing only black-box testing, which can lead to inadequate coverage and can leave many bugs undetected.

Hence always rely on an experienced and skilled backend tester who has a good knowledge of databases and can accurately cover the test cases and can also perform white box testing.

So, your solution is easy to hire an experienced backend tester.

  1. Depending on simulated data

To save time and effort, testers many times depend on simulated data for testing, this can lead to many bugs being unidentified. Hence it is always advised to use more realistic data, which can save you a lot of cost of finding bugs at a later stage and fixing them.

  1. Randomly picking up automation tools

Companies many times pick up any automation tool without realizing the cost it can incur in the future. To save costs they many times pick free tools that might not be suitable for their testing requirements. Such scenarios can lead to unrealized costs at the later stages. Hence it is advisable to make a wise choice of your automation tool.

Focus areas when testing a database in backend testing

While testing a database, apart from checking the connections and the security, here are the other things that must be included in your tests.

  1. Validating the schema: schema mapping is how the objects in the UI are related to the database. They help in storing and retrieve data values from one function/module to another. It is important to check that each object in the UI is mapped to the c0rrect data in dB.
  2. Database tables: the data in a dB is arranged in tables, it is important to check the data is stored in the correct tables with the expected key value and is also access control as per the requirements.
  3. Columns: checking the columns would include checking the data types, length of data it can take, and even the mapping between primary and foreign keys.
  4. Key and index: Indexing and keys help to retrieve the data faster from a huge database and are especially true for big data or Hadoop that deals with huge data. In testing, you check the index and keys to ensure you can fetch the required data in less time.
  5. Stored Procedures: simply put, a stored procedure is a set of SQL queries that can be saved and run in a sequence to achieve the required operation. These stored procedures need to be tested with different combinations of input parameters to confirm the viability of these procedures.
  6. Triggers: Triggers are actions performed on the table when any add/edit/delete or truncate operation is performed on the dB. For testing these triggers, the SQL query in the trigger is executed standalone and the results are noted down. Next, the trigger is executed as a set and the results are compared with the standalone results.
  7. Database server validations: The validations at the server level mainly deal with the security and access control as per the business needs. Some fields in the dB should be read-only, some should be accessible only for a certain user group, some others may be a one-time edit, and so on. This business logic for a server needs to be tested thoroughly.
  8. Data duplications: As the name suggests, tests need to be performed to ensure there is no data duplication. Duplicate data not only creates confusion during the data update but could also lead to incorrect results and more burden on the dB. It is very important to avoid these duplications.
  9. Data masking: Some data need to be masked as these would be related to the personal information of the customers or some other very secure data. It is very important to check that while saving and retrieving these data, they are masked and can not be accessed by unauthorized personnel at any level. In many cases, even legal action can be taken if data masking is done and the information gets leaked out.

API Backend Testing

In the most simple terms, an API is an interface that offers some sort of service to another application or software. API testing is also a form of backend testing since we do not need a UI to test these and they are triggered when one or more actions are performed on the UI.

For testing the API, we need to know the endpoints where these APIs hits when called, the expected response code, the number of retries, and the error message returned for an unsuccessful call. All these parameters are tested as part of the API testing.

Some tools commonly used for API automation and testing are:

  • SoapUI
  • JMeter
  • Postman
  • REST Assured
  1. Poor communication

Communication is an important factor while conducting backend testing. There should be an open and free flow of communication between the team so that testers have a clear picture of what changes and additions are made to the database. Poor communication can lead to testers missing on many test cases that could have evolved with the changes in the database, hence leading to inadequate testing.

Challenges in Performing the process

  • Testing scope

Testing backend involves databases that many times are very vast. Getting a clear insight into these databases and gathering requirements to build test cases can be a daunting task especially when databases are very big.

  • Short test database

When an application is passed on to the testers for testing, the data in the database is generally very small. It is sufficient only to execute the application. Hence it becomes a challenge for the testers to test the application.

  • Changes in database structure

Changes in databases are very frequent. But it throws a big challenge to the testers testing the application. Supposedly they have prepared the test cases and are executing their test as per their designed test plan and test cases and in the midway, there occurs a database change, which can create many challenges for the tester. So with every structural change in the database, the testers have to modify their test cases to ensure proper testing. Not only that they will also have to rework the test data.

  • Running multiple test cases simultaneously

Another big challenge in the process is that you cannot run multiple test cases simultaneously as it can decrease the performance of your application and can underrate its performance.

  • Complex test plans

It’s is a complex task having to deal with complex databases. Hence, involving complex test plans. It should be ensured to keep test plans as simple as you can.

  • Good understanding of SQL

The process requires you to have a good understanding of SQL, which can help in proper and accurate testing.

How is backend testing different from front-end testing?

Backend Testing

Front-end Testing

1.       It is performed on the database or servers

1. It is always performed on the application GUI

1.       To test the backend, a tester must have good knowledge of SQL, dB connections, and database fundamentals

2.  To test the front end, a test needs to know the business and functionality of the application.

2.      There should be sufficient data in the database before the testing can be done

3. It can be performed with minimum data in the system.

3.      No GUI is required to perform a backend test

4. GUI is mandatory to perform frontend tests.

4.      Types of backend tests are SQL tests, dB tests, API tests, etc

5. Types of frontend testing are functional tests, unit tests, regression tests, smoke tests, etc.

5.      The main aim is to check the integrity of data if it is stored correctly, accessible as per need, any loss, etc.

6. The main aim is to verify the functionality of the application as the customers would use it.

Conclusion

Through backend testing, you can check the ACID properties, schema, etc. The most astounding feature of back end testing is that you don’t require the help of a GUI. You can directly inject data to the database with the help of a browser.

Database testing also helps in testing the business logic of an app. If you wish to know more about why your app needs and how it’s beneficial from a business perspective you can talk to us.

Mail

Whatsapp

Hire

Cost Calc.

Call Us