It's not surprising that some developers see testing as a necessity that drains their time and energy testing can be difficult or ineffective, as well as too complex.
My first encounter with testing was not a good one. I was part of a group with strict coverage standards. The process was to implement an option, then debug it, and then write tests to ensure that the feature has complete coverage of the code. The team did not have integration tests; only unit tests that had a lot of mocks manually set up and most unit tests test simple manual mappings using a library to create automated mappings. Each test attempted to prove every property that was available, and every modification broke hundreds of tests.
I was not a fan of working on tests due to the fact that they were seen as time-consuming. However, I didn't give up. The assurance testing offered by confidence tests and the automated checking for every minor change caught my curiosity. I began reading and practicing and discovered that tests if done properly, can be beneficial and fun.
This article will share five test automation best practices I would have liked to know right from the beginning.
1. Automate gradually
Automate as you would any agile project in your application. Separate the task into tests, prioritize them and then work through the list gradually. This isn't meant to be a single-issue solution that will take you from no automation one day to the complete automation you'll need in the next. It's an ongoing process that you continue to work on and improve. Begin small and concentrate on scoring small wins. Establish the rules and build confidence to ensure that tests are completed quickly and frequently.
However, let me make it clear it's not a matter of starting at a low level and then slowing to a complete halt. Many teams fail precisely because of this. They dip their toes in the water but do not move on to designing automated tests. In the end, they do not get enough that they can see any tangible benefits. According to my experience, you have to invest in the process to automatize enough testing so that you get a boost in the manual regression testing, and keep working on the most important items to keep that benefit.
If you're beginning an entirely brand new program, your aim is in-sprint automation. This means testing automation happens in the same sprint the feature is being developed. It's the ideal however it's not always possible. Don't create an unreasonable requirement that makes stories don't work. Additionally, with a brand new project, the UI is usually not being built or altered frequently so don't introduce too many features early on. The goal is to get your team jogging and speeding up by putting up quick wins and at a steady speed.
Our suggestion is to begin by sprinting plus one or sprint and one or sprint plus.
Complete the functional user narrative and determine the possible scenarios that can be automated.
QA will then make a separate report for the automation. If the automation is not up to par with the stories, they will be accumulated in the backlog, and the testing debt can be easily quantifiable.
2. Test your apps by tailoring them to your needs
We suggest different methods depending on whether you're developing your own application or making changes to an existing application.
Here's a brief overview of each situation:
It is best to adopt an approach from the bottom up when working on greenfield projects. This means that you start to create tests from a functional perspective. Then, in the end, combine these feature tests in order to make end-to-end testing. In the beginning, APIs are changing quite some, particularly during the initial few cycles. This is why you need to be agile in terms of automation. Develop a test automation system that is lightweight that you can modify depending on the development of the application.
Keep in mind that during the initial weeks the user interface might not be fully developed yet. So you shouldn't place as much focus on the end-user or UI tests right now. Focus on the API and unit-level tests first, and then move up when the UI gets more stable.
In this scenario, it is important to concentrate on creating end-to-end tests -- those pleasant paths that run throughout the software. The aim is to test as many functions as you can in order to provide complete coverage and the smallest number of tests to boost your confidence to use the solution to its fullest extent.
This method is perfect for applications that are already in development, and it is necessary to fill the gaps in your application by expanding the scope of testing. If you have an application that is ready for deployment, concentrate on integrating the automation into fully-developed features.
3. Prioritize test strategy and plan
Automation isn't the only solution. The project may still be a struggle with no plan to assure that the application is of high quality throughout the life cycle for the software. The lesson is an effective design strategy is crucial and must be identified at an early stage, usually at the end of sprint zero.
What makes an excellent design? It is made up of the following elements:
Definition of Done - makes sure that everyone understands exactly what is expected from what the team must do.
Test Data Management - helps to determine how you'll manage test data. If tests must be repeated at every check-in, for instance, what can you do to make sure that the test data can be replicated?
Prioritization based on risk - this approach to automated testing allows you to identify the features and functions of Software that you consider to be most impactful and are more likely to suffer from defects. You should test the areas of greatest concern.
As I said earlier, the primary objective of testing automation is to build confidence. However, don't take this as a given. If tests fail, individuals are less confident in the automated system. This is the reason why failures in tests should be the top priority for everyone. Take a break and figure out the issue and then fix it. It could be that there was a requirement modification, or the developer made a mistake, or there's problems with our data. Find out the problem fast and fix it. Then move to the next one so that you can keep your confidence levels high in the automated software suite.
4. Run Your Tests Automatically
Imagine a scenario in which you've completed some tests, and then when you pull your repo a couple of months later, you find these tests aren't passing.
This is a reminder that tests are codes, and as with any other piece code, they should be kept up to date. The best time to do this is just when you think you've completed your work and you want to check if the tests are still working as you intended. There is all the information required and can correct the code or modify the tests that are failing more quickly than someone else who is working on a completely different subsystem. The moment you are in is in your head, so the most popular method to run tests is following pushing the development branch, or after making a pull request.
So, your primary branch will remain in a good state and you'll at the very least have a clear understanding of the state of your branch. Automated building and testing pipeline, or CI pipeline - can be helpful in:
Verify that code is buildable.
Eliminate the possibility of "It does not work on my machine" issues.
Offer runnable guidelines on how to create an environment for development.
The process of setting up this pipeline can take time however, the pipeline may expose a variety of issues before they are able to reach clients or users even if you're your sole developer.
When it's the test is running, CI also reveals new problems before they have an opportunity to expand in size. This is why I prefer to configure it immediately after writing the initial test. It is possible to place your code in an individual repository hosted on GitHub and then set it to use GitHub Actions. If your repo is publicly accessible You have greater choices over GitHub Actions. For example, my automated test plan is run on AppVeyor for projects that have a database as well as three kinds of tests.
I like to structure my pipeline of production projects in the following manner:
Transpilation or compilation
Unit tests are fast and don't need dependence on any other software.
Initialization and setup of databases or any other service
Integration tests require dependencies that aren't part of your code, however, they're more efficient than functional tests.
Functional tests: once the additional steps are successfully completed complete the application
There aren't any canary tests as well as load testing. Due to their particulars as well as requirements, these tests must be performed by hand.
5. Write Only Necessary Tests
Writing unit tests across all your codes is a typical strategy however, it can waste time and energy, and does not provide you with any assurance. When you've been familiar with"testing pyramids" or the "testing pyramid" idea, you may think that all your code needs to be covered with unit tests, and only a portion that is covered by more advanced tests.
There is no reason to write a unit test that makes sure that mocked dependencies are accessed in the correct order. This would require setting several mocks, and then verifying every call, however, it won't guarantee that the module works. Usually, I create an integration test that makes use of real dependencies, and then checks the results; this provides me with some assurance that the pipeline within the module that I tested is functioning in a proper manner.
In general, I write tests that simplify my life when I implement functionality and then support it later on.
In most cases, striving to achieve 100% coverage can result in a lot of time and effort and also takes away the pleasure of working with tests and programming generally. For more information on tests automation solutions like ROI in testing, salesforce testing automation, go to bqurious.
Note: This post is originally published at this website: https://sites.google.com/view/test-automation-best-practices/home
コメント