7 Steps to Software Testing Without Pain

< Back to Insights
Insights  <  7 Steps to Software Testing Without Pain

Testing code is not something that gets most developers excited, nor is it something that a business owner is excited about pouring hours and hours of effort and cost into. The reason is simple: a test produces no real value, it only confirms the value of the feature which is being tested. Nonetheless, everyone on the team, both the team building the software and the team ready to use the software, assumes that code will be tested, right? In other words, testing is something we know is important that someone else should do.

Why Test?

Yes, of course, tests need to be conducted for obvious reasons. Testing maintains a high level of quality in the product and ensures that software does what it is expected to do. But equally important is the ability to increase the velocity with which a team can release code to the people who will actually use it. In my experience working with clients, technology teams are frequently perceived of as “too slow.” These teams labor over the design of new features which are requested by the business, and then wring their hands over whether or not the code is working and whether it impacts any other aspects of the software.  In the end, these teams sit on an ever increasing pile of work whose velocity to the users (the client or customer) slows to a crawl. The root cause?  They can’t be sure it works because they don’t have a test plan.

So how can you implement a test plan and get your valuable software out the door?  Follow these steps:

Write Unit Tests – Unit tests are functions written by developers which exercise a component which the team has written.  Unit Tests can be run automatically.  When planning for unit tests, it is important to design the system such that your code is separated into testable units.  That leads me to the next point.

Know What Needs Unit Tests, and What Doesn’t – Often times I see unit tests that are testing database functions, such as inserts, updates and selects. You shouldn’t need to test your data access code. Instead, you should be testing components which perform the logic of your solution, using data provided to it. For example, my team uses Microsoft’s Entity Framework libraries for data access, and separates business logic into a set of components which follows a “Unit of Work” pattern. EF itself does not need to be tested; a third party (Microsoft) wrote it. However, the code that runs the Unit of Work, your custom logic, does.

Create a Lab Environment – a lab environment is an environment where you test – call it your Test Area, or “QA” for Quality Assurance. Make sure you have one and make sure you have duplicated the target environment closely. For on-premises software, the cost of provisioning a second environment, used only for testing, often prohibited teams from creating one. This is because it doubles the initial hardware investment of the project, doubles the software license investment and doubles the maintenance time required. With Cloud Computing, Infrastructure as a Service can be leveraged to provision a test environment quickly, then turn the environment off when testing has been completed. This saves money and reduces attack surface, because you don’t have machines running continually which can be hacked.

Document Your Acceptance Criteria – When you were in school, did you ever ask your teacher “Will this be on the test?” For me, it’s has always been easier to focus on a task if I know what is expected of me. By documenting the expected behavior of the software, you’re giving the team the answers to the test in order to help them be successful. If you are a Microsoft shop and you have MSDN licenses for your team, I recommend you check out the test planning tools found in Visual Studio Online. It allows you to document planned tests and success criteria for each feature and work item. Developers working on a feature can see these plans right in Visual Studio where the work will be performed.

Record Manual tests, then run them – Microsoft Test Manager, which comes with Visual Studio 2013, has the ability to connect to Visual Studio Online and review, create and edit test plans. One little known feature is the Test Runner, which has the ability to record tests and even steps within a test for future runs. This is extremely handy for regression tests, which test to ensure that new functionality does not break existing functionality.  Once recorded, you should find that you have much more confidence in you changes, and time to test takes minutes, not days.

Automate Your Builds – When a developer creates a new piece of functionality for the team, they write code to perform the work, and then they integrate that code into the existing solution. If you are using a Source Code Control system (and I hope you are) then this means “Checking the code in.” What should happen next? If your intent is to get the feature into the hands of someone who can use it, then what are you waiting for? Build it, test it, deploy it. Visual Studio Online provides a Hosted Build Controller, which is essentially a build service for code checked into projects managed there. With the VSO Build Controller, you can ensure that new code compiles properly, and even run unit tests directly after a successful build to ensure a high level of quality.

Generate Coded UI Tests – A Coded User Interface test allows you to fully automate tests which would otherwise require a person supervise. As in Steps 1 and 4, you have to devise the test, and walk through it one more time. This is easy with Visual Studio 2013, which has tools to record actions taken by a tester and then write the test out in code for you. Once the test is recorded in code, the test can be run automatically in a lab environment by the Microsoft Test Runner.

Testing does not need to be painful. It requires commitment from the team to writing testable code, a ruthless pursuit of automation and a recognition that software delivers no value until it is tested and deployed. If you are a Microsoft shop, I highly recommend you talk to blumshapiro about how to improve your testing processes. Visual Studio Online and Visual Studio 2013 provide all of the tools you need to get this process up and running.

Continue the Conversation with Our Team
Get in touch with us.

Contact Us