Things certainly have changed. I remember a day when testing meant writing up a set of scenarios to manually test, or having a checklist of features to repeatedly test against on deployment day. Now, with modern tools, there are lots more ways to test your code. Automation can repeatedly test those scenarios for you, and ensure you didn’t break your code when new changes are made. You can use these automation tests in lots of different ways, along with some basic things to keep in mind to ensure those tests are as valuable as possible.
Basic Types of Automation
- Unit Testing with Code Coverage – Write reusable test cases that test your functions, methods, and classes. Integrate them into your automated build pipeline, and measure how much of your code is tested. Aim for 100%, but expect a bit less. Some unit testing tools are jUnit, nUnit, CA LISA, Rhino Mocks, and many more.
- Functional / System Testing – Write tests from your customer’s perspective. walk through your application in the browser, fill in the fields with predefined values, and submit. Test if the data is correct, if the validations worked, if the data was submitted. Common tools for this are Selenium, Cucumber, CA Lisa, Rhino Mocks, etc.
- Browser and Device Testing – The Browser Wars may be over, but we still have a fragmented landscape of browsers used, and you have to test them all – Chrome, Edge, IE, Safari, Firefox, Android, iOS, phones, tablets, desktops… To cover them all, you can automate your tests and integrate with tools like BrowserStack, SauceLabs, Selenium, etc.
- Beta / Acceptance Testing – You need to ensure that you have built a quality project that meets the requirements of the business and the customer. This is usually a set of manual tests completed by your customer before and / or after launch.
- Install Testing – This subset of existing automation tests ensures you exercise as much of your codebase as possible in a new environment, particularly production, to ensure your server installation has completed properly.
- Smoke Testing – A small subset of existing automation tests, most probably used in other cases, that ensures any environment changes have not had an impact on your codebase and its functionality. These tests usually follow the happy paths (or red routes).
- Regression Testing – a complete and thorough suite of tests that exercise all of your code, new features and old, happy path and all known edge cases, including past and present bugs, ensuring you are prepared for a launch to production.
- Performance / Load / Stress Tests – Identify break points and thresholds in your software and hardware, and improve. Common tools include jMeter, LoadRunner, Silk Performer, and many others.
- Security / Penetration tests – Make your code more secure, prevent hacking and attacks. Tools include SonarQube, OWASP ZAP, Nexpose, WireShark, Retina, Aquila, and many more.
Tips To Keep In Mind
- Keep your code simple – Keep your code focused on solving one problem at a time. This makes it easier to read and understand, code correctly, debug, and maintain.
- Pair Programming – Two heads are better than one. Write your code cleaner, faster, and with less bugs. This method comes with built in code reviews.
- Use Design Patterns and Architecture Patterns – Follow these, and you are using proven methods that other developers will understand. The Gang of Four is a good place to start learning design patterns, and there are many others. MVC, MVP, MVVM, and VIPER are some common architecture patterns that you can use to organize your code at an application level.
- Comment and Document your Code – Do this as close to the code as possible. This makes your code easier to read and understand. One way I like to do this is write pseudocode first, then fill in with actual code. Then the pseudocode becomes natural code commenting.
- Automated Builds and Continuous Integration – Run your code and test cases as often as possible, make sure they all work together. Jenkins is the most common way to achieve this. Another common tool is Bamboo.
- Demos – this forces you to think holistically about your code, how you will communicate your solution to others, and gather feedback from your audience. If you follow an agile methodology, chances are this is already part of your process.
Pingback: 300 Level Testing – Test Case Design Techniques | Pixelated Blog
Pingback: 400 Level Testing – 20 Advanced Topics | Pixelated Blog