What is a Dry Run Test ?
Tags: python, testing, software, code
Published: 2024-03-14 07:41:07

## **What is a Dry Run Test in Software Engineering?**

A DRY run test helps us know if the software developed fulfills the intended purpose and if lines of code perform the intended task before code deployment.

It is in the testing phase of SDLC(A framework or process that helps to develop high quality software.).

Dry run testing is part of a series of tests, here are other tests done while programming and developing software: walkthrough testing, white box testing, integration testing, alpha testing, blackbox testing, beta testing, stub testing, resources testing, unit testing, smoke testing, acceptance testing, and other testing procedures.
These tests save you the risk of malfunction of the software before, after, and during deployment.

> Dry run test is like reading aloud your code to spot mistakes and bugs encountered when writing the code. In other niches other than Software Engineering, They refer to it as practice run tests.



**Why it is called a DRY run test ?**
According to reports, the term dry run originated among US fire departments. The firefighters would carry out fire brigade dispatches without pumping water for practice. A wet run was referred to as one that had real fire and water. The term dry run has since spread to other areas including military, aviation, and other fields. It is used to describe a rehearsal or practice without the real consequences of the event. Dry runs are an important part of preparing for the real thing.
The dry run test helps developers implement features and updates when running. This procedure helps us trace and follow up on values and variables in our code. Reduces repetition and helps us maintain a good control flow of our code and software process.


**Why do we need it? Benefits of conducting the Dry run Test.**

1. To avoid repetition. - Helps implement the DRY principle(Don't repeat yourself).
2. Avoid potential bugs during production. - Unprecedented code behaviors.
3. Review code quality and performance. - This helps increase the quality of the software.
4. Pave way for more product testing. - It is important to initially direct the coder/programmer to productive testing.
5. Remove unnecessary code breakages. - The test helps counter bottlenecks that may arise during code execution.
6. Ensure Functionality - This test helps in discovering underlying issues before selling or deploying the software. This is crucial with critically important systems. This acts as a rehearsal.
7. Save time - This test mitigates potential errors and modifications in the future.
8. Uncover potential errors - Errors that may be imminent - logical errors, syntax errors, conditional errors, loop errors, typographical errors, etc.

>  Sometimes the developer can print the code to check on logic, and execution errors that may arise during the execution of code or deployment of the software. It helps validate logic and syntax.



**Dry Run Test Examples in Software Engineering**

1. Rsync - This is a utility for transferring and synchronizing data between networked computers or storage drives. It has a dry-run option.
2. Algorithm Scan- this is a mental walk-through of code and algorithm to confirm if it is logically valid.



![performing a dry run test image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v5f98hpsf04glp49qycl.jpg)
**How to perform a dry run test.**

Here are ways way to perform a dry run test,
_**Here are some tips to make it successful.**_

1. Read the code aloud - go line by line commenting and write the pseudo-code.
2. Use trace tables - check the value of a variable from line to line and record instances when it changes.
3. Use friends or teams to debug and dry run.
4. Logging out all the values and issues. You can print out the errors.
5. Use comments and descriptions on expressions and functions.
6. Use a test case to simulate possible outcomes by using dummy data.

**Let's use a Trace Table:**

_Here is a sample code._

![Dry Run Test Sample Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r9hh8f5us681vwac4lty.png)

_Here is the Trace table tracking a variable and showcasing the right expected outcome._


![dry run test trace table](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3tjwbqbtlek3bw3eg177.png)

We can verify/Validate the variables. If there was an error, you could have easily spotted the location the error occurred by printing out the variable after each modification.

![Trace table verification and validation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ccv4ylg8cy2m26hh4gbz.png)

We can easily track any modifications and changes the variable undergoes. This means that our code has passed the dry run test. 
In large projects, developers develop a framework and system that helps them test the project as a whole.
Programming languages have their testing frameworks and systems for efficiency.




**Where and when you should consider implementing a dry run testing:**

1. **When performing version control operations** - you can always use <u>git diff</u> before merging to highlight any conflicts that may arise while merging.
2. **When Using Configuration Management and Build Tools** -  This helps you to avoid software crashing and malfunctions. Some CGM tools offer testing or simulating spaces to view how the deployment will look like.
Most build tools offer a deployment stage for dry running a test for the application before production. They have a dry run mode or plugins that help you do the dry run.
3. **When Doing database migrations** -  This helps you know any occurrences that might be made before making any crucial database changes.
_NB:_ in the Django Rest framework, there is a  <u>makemigrations</u> command that highlights possible changes made, and the set query made to the database.
```
python manage.py makemigrations
```



**Dry run testing Limitations.**
1. It is not easy to implement for large-scale projects. 
2. It is time-consuming since the tester has to review line-by-line tracking of a variable.


**Conclusion**
The dry-run testing methodology of testing is very efficient. It ensures developers become effective in understanding the logic behind the product. It helps answer the question, "Is the product doing the intended task or solving the intended purpose?"

It makes zero-day vulnerabilities a new vocabulary when developing and deploying software products. Every single developer should consider using a dry run test to increase productivity and prepare them for the next phases of testing. 


<u>Link Up For More:</u>
[twitter/x](https://twitter.com/Moses_Morrisdev).
[linkedIn](https://www.linkedin.com/in/moses-njuguna-m/).

&#128522;I would be glad if you Dropped a comment!!!