This document discusses automation testing. It defines automation testing as writing scripts to test software using another software. Automation testing is used to rerun manual test scenarios quickly and repeatedly, especially for regression testing. The document outlines reasons for automation like reducing time/cost of testing and increasing speed and coverage. It also discusses what types of tests are suitable for automation and how to plan an automation strategy by selecting tools, defining scope, and designing/developing/executing/maintaining tests. Common automation frameworks like modular, data-driven, and hybrid frameworks are also summarized.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
78 views
4 Automation-Testing
This document discusses automation testing. It defines automation testing as writing scripts to test software using another software. Automation testing is used to rerun manual test scenarios quickly and repeatedly, especially for regression testing. The document outlines reasons for automation like reducing time/cost of testing and increasing speed and coverage. It also discusses what types of tests are suitable for automation and how to plan an automation strategy by selecting tools, defining scope, and designing/developing/executing/maintaining tests. Common automation frameworks like modular, data-driven, and hybrid frameworks are also summarized.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33
1.
What is Automation Testing
2. Why Automation Testing 3. How Automation Testing This type includes the testing of the Software manually i.e. without using any automated tool or any script. In this type the tester takes over the role of an end user and test the Software to identify any un-expected behavior or bug. There are different stages for manual testing like unit testing, Integration testing, System testing and User Acceptance testing. Testers use test plan, test cases or test scenarios to test the Software to ensure the completeness of testing. Automation testing which is also known as Test Automation, is when the tester writes scripts and uses another software to test the software. Automation Testing is used to re-run the test scenarios that are performed manually, quickly and repeatedly. Apartfrom regression testing, automation testing is also used to test the application from load, performance and stress point of view and also security testing. Automated testing is important due to following reasons: Manual Testing of all work flows, all fields , all negative scenarios is time and cost consuming It is difficult to test for Browser compatibility manually Automation does not require Human intervention. You can run automated test unattended (overnight) Automation increases speed of test execution Automation helps increase Test Coverage Manual Testing can become boring and hence error prone. It is not possible to automate everything in the Software Repetitive tests that run for multiple builds Tests that require multiple data sets Frequently-used functionality that introduces high risk conditions Tests that run on several different hardware or software platforms and configurations Tests that take a lot of effort and time when doing manual testing Test Cases that are newly designed and not executed manually atleast once Test Cases for which the requirements are changing frequently Test cases which are executed on ad-hoc basis. Test Tool Selection Test Tool selection largely depends on the technology the Application Under Test is built on. For instance QTP does not support Informatica. So QTP cannot be used for testing Informatica applications. Selenium cannot be used to test stand alone applications. Define scope of Automation Scope of automation is the area of the Application Under Test which will be automated. Following points help determine scope: Feature that are important for the business Scenarios which have large amount of data Common functionalities across applications Technical feasibility Ability to use the same test cases for cross browser testing Planning Design and Development During this phase you create Automation strategy & plan, which contains following details- Automation tools selected Framework design and its features In-Scope and Out-of-scope items of automation Automation test bed preparation Schedule and Timeline of scripting and execution Deliverables of automation testing Test Execution Automation Scripts are executed during this phase. The scripts need input test data before there are set to run. Once executed they provide detailed test reports. Execution can be performed using the automation tool directly or through the Test Management tool which will invoke the automation tool. Example: Quality center is the Test Management tool which in turn it will invoke QTP for execution of automation scripts. Scripts can be executed in a single machine or a group of machines. Maintenance Asnew functionalities are added to the System Under Test with successive cycles, Automation Scripts need to be added, reviewed and maintained for each release cycle. Maintenance becomes necessary to improve effectiveness of Automation Scripts. Software testing tools Following are the few popular tools which can be used for Automation testing: HP Quick Test Professional Selenium IBM Rational Functional Tester SilkTest TestComplete LoadRunner Appium(mobile apps) WATIR There are two general approaches to test automation GUI testing: Many test automation tools provide record and playback features that allow users to interactively record user actions and replay them back any number of times, comparing actual results to those expected. The advantage of this approach is that it requires little or no software development. This approach can be applied to any application that has a graphical user interface. However, reliance on these features poses major reliability and maintainability problems. Relabelling a button or moving it to another part of the window may require the test to be re- recorded. Record and playback also often adds irrelevant activities or incorrectly records some activities Code driven testing In this case the use of testing frameworks like Junit Nunit that allow the execution of unit tests to determine whether various section of the code are behaving as expected under various circumstances. What is A Framework A test automation framework is a set of assumptions, concepts and tools that provide support for automated software testing. The main advantage of such a framework is the low cost for maintenance. If there is change to any test case then only the test case file needs to be updated and the Driver Script and Startup script will remain the same. Ideally, there is no need to update the scripts in case of changes to the application. Different types of Automation Framework 1. Record and playback or linear framework 2. Modular framework 3. Data driven framework 4. Keyword driven framework 5. Hybrid framework Record/Playback - In this approach tests are created and executed using recording feature. Advantages Easy to create and takes less time Scripting knowledge not required Disadvantages No centralized maintenace of test objects Record/Playback is something that doesn’t work in a real-world scenario and here are the reasons: Such scripts contain hard coded values, which must change if anything at all changes in the application. This creates an additional overhead, as the testing team needs to update the scripts each time the data changes. These scripts contain very little error handling and recovery scenarios. Consequently, such scripts are not reliable (even in cases where the application doesn’t change) and often fail during playback for a variety of reasons such as pop- up windows, messages etc. The cost of maintaining these scripts is huge and quite unacceptable. If the application under test changes, the tests must be re-recorded. Record/Playback scripts work well only if the application under test is already working as per the expectations. In essence, this defeats the purpose of test automation. Record/Playback might work in some cases; if the tools used are intelligent enough to analyze the application under test and auto generate meaningful test data. The Modular Automation Testing Framework requires the creation of small, independent scripts that represent modules, sections, and functions of the application-under-test. Lack of re-usability can be classified into 2 types Lack of code re-usability: Since the Since the code in the Linear Framework in written step by step in a linear manner, you can’t really reuse it at different places without copy pasting it. We use modular framework approach to overcome this shortcoming of linear framework. b)Lack of Data Re-usability. You have this limitation in Linear Framework because the data is hard-coded within your script. Hence we can’t use the same code with multiple data values. You can overcome this shortcoming by using Data Driven approach. Modular Framework (also known as Functional Decomposition Framework) is the approach where you first identify the re-usable code from your test cases. Then you write this re-usable code inside different functions and call these functions wherever required. The advantage of this approach is that the re-usable code would always stay at one place and thus it would be easy to maintain the code because you would have to make the changes at a single place only. To re-use this piece of code, all you have to do is call the function wherever required. The only challenging part here is to identify the reusable portions in your test case flow. Once that is done, you have to just create functions and use it wherever required. Let us see an example which would help you understand this concept more clearly. Consider this scenario where you have to automate 2 test cases. In the first test case, you have to login to the application, create an order and then logout. In the second test case, you have to again login, then you have to modify an existing order and then logout. Can you identify the re-usable flows from the above 2 test cases? Yes, from the above test cases we can clearly see that there are 2 different re-usable flows that are used in both these test cases – Login and Logout. Let’s see how the flow would look like in the Modular Framework approach. Function fnLogin() 'Open Application 'Enter Used Id and password 'Click on Login button 'Verify successful login End Function
'- - - - - Logout Function - - - - -
Function fnLogout() 'Logout from the application 'Verify Logout is successful 'Close the application End Function
'===== Test Case 1 - Create Order =====
'Call Login function fnLogin()
'Code to create order
' .......... ' .......... ' ..........
'Call Logout function
fnLogout()
'===== Test Case 2 - Modify Order =====
'Call Login function fnLogin()
'Code to modify order
' .......... Advantages a) The amount of time spent on coding is lesser as you are creating re-usable functions and calling them wherever required. b) Script maintenance is relatively easier because the re-usable code is available at a single place only no matter how many times it is called. If there is a change in any re-usable function, you would be required to make the changes at only one place. Disadvantages a) Additional time spent in analyzing the manual test cases to find out the reusable flows. This is not required in linear framework. b) Users need more technical expertise in automation to work on modular frameworks. c) In case you use only modular framework, the data will still be hard coded in the script only. So you can’t use the same test script for multiple data without changing the values before each run. DataDriven Testing Framework is a framework which is driven by test data, which means that test data is the important factor here. The basic expectation with this kind of test automation framework is that your test scripts should be built in such a way that it should work for different sets of data without any changes to the test script. Considera scenario where you have a large number of user credentials for an application. You need to login to the application with each of these credentials to find out which of the user credentials are working properly and which are not. In order to complete this task, you can create a script in QTP which would read each of the user credentials and try to login to the application and at the end would report the results. 5.2 Advantages of Data Driven Framework Since the data is kept separate from the test script, the same script can be run multiple times for different sets of data (which can be kept in multiple rows in the data sheet). Changes made in the test data don’t affect the test scripts in any way and vice versa. Disadvantages of Data Driven Framework Additional effort and good technical expertise is required to create functions that connect to the external data sources to retrieve the data. Additional amount of time is required in identifying which external data source to use and deciding how the data should be stored or grouped in that external data source.