Tag Archives: automation

SOFTWARE TEST AUTOMATION – THE WHYs, WHATs, WHENs and HOWs?

Let me cut the crap and jump over to the actual topic. That’s the least I can do for you J

Why should I think of automating the tests?

The product development has reached a milestone and yet to be enriched with more features. We wish to make sure that the new changes don’t break the existing features. Yes, we can always test them manually during each release. However, there are two major demerits.

Let us assume the releases to the test team are located far apart. During the time gap the product might be updated with many changes. In an agile environment we would like to verify often or when the changes made to the product, that the changes have not broken the existing features than waiting for the next test cycle. It would be impossible to verify often all test cases manually. So a right approach will be to automate the tests for the existing features and run them and report the deviations every release. Verify only those test cases manually which are difficult to automate and we do not wish to automate.

Let us assume the test cycles are not far apart. Over a period the manual test efforts will keep on growing as the more features Test Automation - TestInsaneadded. If we have to keep the test cycle short and unchanged then we would need more manual test hours. While we plan everything in terms of cost and resources (a human is treated as a resource), we forget that it’s living humans who are testing the nonliving product. The tester who has to repeat the same tests every test cycle starts to feel monotony and may not test the product with same keen and attentive state of mind thereby failing to make sure the quality of test. A hard truth! That’s why many complain software testing is boring and non-challenging as there is less time available for him/her to acquire new skills and use them to test the product with fresh mind-set. The solution is to automate them and manually test only the areas which are not covered by the automation tests. The test engineer can now explore new ways to test the earlier features at the same time focusing more on testing the new features introduced.

What if we intend to repeat each test several times to test for the reliability? A tester will die of boredom or lack of sleep. But machines can run all day and they can do repetitive task uninterrupted at better speed than a human can. So we have hired machines to work longer and faster to do repetitive and boring tasks.

The take-away from automating the tests are,

  • Save the cost of delivering stable product by reducing the manual efforts in relatively quick time compared to manual tests.
  • Make testing less boring and monotonous for our engineers so that they can focus on acquiring new skills to test the product better.
  • Consistency in test quality as there is no human intervention (Remember if the automation tests are not written rightly then the purpose of the automation may not be met).
  • Immediate feedback of the changes to the developers in CI environment so that they can fix the changes immediately than waiting for the next test cycle.
  • Improved speed in achieving the better quality and reduced test cycle duration.

 

What and When to automate?

It’s not practical to automate everything and it can be done. But, it is very challenging to deliver the best test results which a skillful tester can deliver as one can think of better permutations and combinations of actions and creative test ideas which may not be automated for valid reasons. I am not saying we cannot. There are products which have more test code than the product code and that’s a sign of good product. But, as mentioned before we can cover major use cases of all important features which make sure the greater stability of the product with good volume of test data (of differing combinations and permutations).

  • We should automate test cases which are difficult to be tested by the human as we are limited by speed and ability to generate huge test data and test for all the cases in limited time.

 

  • We should not automate the test cases which add little value and the more cost in automating. Say, CAPTCHA string recognition in automating login feature. Rather I would disable the CAPTCHA in the development server and automate the login feature (unless the CAPTCHA generation is purposefully weakened in test environment and their order is made known to enable the automation in development environment). Otherwise, I would need a module which would do CAPTCHA image decoding, which is an overhead mostly. Say, the charts are generated and the numbers are to be verified against the chart values. We would need to do chart image decoding. The easier option is to do image comparison to expected image if we know the test data input. Imagine testing a photo organizing app which organizes photos belonging to a person as album. How do we automate the test case to verify if the photo belonging to a person are grouped as an album? Unless we have predefined data and we know the expected result to compare against, the test case cannot be automated for any test data which is dynamically generated. However, it still helps to verify that the feature is not fully broken by checking it to work with the small test data we have (and we know the expected results).

 

  • If certain features of the product are expected to behave consistently when the same tests are performed repeatedly for long hours, several times as required by the product requirements, the automation is the only way forward. An example would be channel change in Television to work without failure for several times which is typically high.

 

  • We should automate when most of the feature implementation is complete, requirements almost frozen and stable. Otherwise, we end up maintaining the automation suite often than expected.

 

How to build a good automation framework?

  • Carefully identify test cases keeping automation as the end goal to assert the stability of the application under test. The test cases should cover most important use cases with a goal to uncover bugs and assure the features work across releases meeting least required quality.

 

  • The automation scripts and test data separation is a must. This demands the need to write generic code which enables testing for wide range of test data and test cases without a need to change or add the code or for a developer to get involved. Ability to change or edit the test data should be easier and adaptable to the changes in the minor changes or enhancements to the product features.

 

  • Avoiding dependency between test cases as much as possible unless the test case and test data get too big. Think of an application which allows the user to navigate to other pages/screen and use them only if they complete registration form. Let’s assume there are 5 features to automate and registration being one of them. Let’s assume we have coded and automated 5 test cases where first test case executed is registration. All other tests cases are executed if the first test case which is registration pass. If the registration fails for some reason rarely (unless failing always) then all other test cases are skipped or fail. I do not like that. So I would make registration as one of the step to be executed in every test case. Even if the registration fails in one of the test case, rest of the test cases executed successfully.

 

  • Choosing an automation software and the binding (programming language) which has immense support for other plugins which are needed and enhance the automation framework. The tool selected should be stable, not too difficult to learn, has good technical documentation and support, the fixes for serious bugs are delivered quick enough and lastly should have the features to automate almost everything that we have and we will have in the product to be automated. If the tool supports multiple bindings I would prefer a binding which has wider support for third party plugins to support the features which are most needed in an automation framework (Say, test results reporting, test case management, and spreadsheet read/write plugins such as JUNIT, TestNg and apache POI etc. TestNg is supported in java, python does not support it). If there are multiple bindings which are equally good, I shall prefer the one in which I am more good at and comfortable than learning the new programming language. But, there have been organizations who prefer a binding(programming language) which is not having support for plugins as much as other bindings for a reason that they are mostly comfortable with that binding and do not intend to migrate to new language which would demand time to learn and code proficiently. Change is always a difficult option!!

 

  • Implementing test cases which are easy to scale and maintain. If I have to give an example, think of a login page in a web application which needs to be automated. We write tests which automate entering the username and password text fields and click on “submit” button. The script works as expected now. Tomorrow the username and password text fields order are exchanged. Unless the developer has though over this and has coded the scripts with locator which are robust enough to rightly locate the username and password fields irrespective of the order is bound to fail.

 

  • Implementing test cases with readability and maintainability as one of the necessity. The automation scripts should reuse the code. So always write helper functions common across all products and specific to a product and reuse them to reduce code clutter and to enable readability and modularity. Say an application has number of pages where we need to enter the mailing address having fields first name, last name, building number, street name, city, state and pin code. Instead of repeating the same lines of code for test cases for different pages which prompt for mail address, I will add a helper function which accepts all fields as arguments and edits the fields. Now each test case need to reuse this function with the right data passed. The result is scripts are more readable. Imagine there is a bug or a new field has been added to “mail address” block say, landmark. All we need to do is extend the helper function. So easy to maintain.

 

  • Apply and enforce coding guidelines so that it’s easier to understand and modify the scripts over a long time. Even if the original developer of the script has quit the organization or during original developers absence the other developer does not find difficulty in understanding the implementation to fix or to change existing scripts to address new requirements.

 

  • Ability to generate a test report which would give enough information about why the test case failed and other useful statistics (without a need of human presence as the automation suite is run). This demands ability to embed extra intelligence which would attempt to diagnose to zero-in on the cause for failure and other supporting details.

 

  • It should enable test case management, so that we can choose the test cases to skip in easier way instead of getting into at the code level.

 

  • Ability to support continuous integration and test result reporting by mediums such as email or SMS (as an SOS for test case failure) to the stakeholders to get a quick feedback and act so. Triggering automation run needs to be time driven (say every day at 10:15PM) and event driven (some code changes are committed to code repository or new build generated in the build server triggered by code change commits).

 

  • The automation framework should enable necessary level of customization by means of configuration files which can either be edited directly or by using a GUI tool than getting into the code and other technical aspects. The other aspect is to apply configuration changes without having to rebuild the automation framework unless it hits the performance of the automation in action or it’s highly difficult and value added is not worth.

 

  • Speed of the test execution is crucial when we intend to test large number of test cases with even larger amount of test data. Should avoid fixed delays except rare cases and design should also be taken care at function level for speed. It would be great if the automation tool supports running the tests in parallel on multiple machines with different environment/platform to speed up the tests and to verify cross platform compatibility.

 

  • Provide test coverage report at test case and code level (at code level it’s called code coverage).

 

  • Ideally should be test platform/environment agnostic (OS, browser, machine architecture, time zone etc.) as far as possible. This needs intelligently designing the framework.

 

These are purely my opinions about a good automation test framework based on my experience and learning in software automation and software development in general. A constructive feedback or questions or discussion are welcome. Good day!

ABOUT SANDEEP TUPPAD (VP, Mobile Apps Testing and Automation)

SandeepTuppad - VP, Mobile Apps TestingSandeep Tuppad has a decade of experience in software development (Drivers & Application Software) for Consumer Electronic Devices such as Digital Television and other display devices. He has prior experience of implementing automation framework and utilities aiding software testing. At TestInsane, he is responsible for exploring and implementing test automation framework, utilities, gathering knowledge and mentoring the team to enable “quality mobile apps testing”. He loves to travel and pursue outdoor adventure sports.

 

Try our web and mobile test automation services – Buzz me at sandeep (at) testinsane (dot) com.

TestInsane - Web and Mobile Test Automation

TestInsane – Web and Mobile Test Automation