DEV Community

Cover image for Testing
Gabrielle Easton for Our Time For Tech

Posted on • Edited on

Testing

Testing is very challenging for me. My Week 3 was about understanding the importance of testing and exploring various testing frameworks and approaches to test the software. I welcomed the challenge and would like to summarize my learning in today’s post.

Let's define tests. Automated tests are scripts that output whether or not your code works as intended. They
verify that the program works now and will continue to work in the future without manually testing it. Once you write a test, you should be able to reuse it for the lifetime of the code it tests. Your tests can change as expectations of your application change. Tests catch bugs sooner, preventing them from ever being deployed.

TDD vs. BDD

Test-driven development involves writing a test for a specific piece of functionality, running the test to see if it fails, and then writing the code to make the test pass.
Behavior-driven development involves a developer, QA engineer, and product manager. The group meets to come up with examples of acceptance criteria in a user story. These examples are described using a domain-specific language and put into a feature file. The feature file is converted into a specification where developers can then write an actual executable test.

Happy path vs. unhappy path

The happy paths are what users are supposed to do when using an application. The unhappy paths are many ways that users can break your software.

Testing in Rails

As we continue developing our application, Shiftwork, we will be adding tests to the Models and Controllers with MiniTest. MiniTest is a library for TDD, BDD, mocking, and benchmarking. MiniTest is a powerful yet underappreciated testing framework in the Rails community. It comes with the Rails application, so it's available right away, no need to install anything else.
MiniTest has been designed to be a small and fast testing framework. As I learn how to write tests, I will write about it from my practical perspective in my other posts.

One of the standards for developing a solid software application is writing tests early and making sure all parts of the app are tested well. Testing is an essential skill, and it's worth spending time to learn how to write well-structured tests. I accept the challenge!

Photo by Hans Reniers on Unsplash

Top comments (2)

Collapse
 
aritdeveloper profile image
Arit Developer

And I know you will ACE the challenge of learning testing!

Collapse
 
gabrielleeaston profile image
Gabrielle Easton

With the tutorials you made available for us, we will rock the testing. 🦩