This document provides an introduction to test automation, including different scripting approaches like record and playback, linear scripting, modular scripting, data-driven testing, and keyword-driven testing. It discusses the benefits and problems of record and playback as well as examples of linear scripting, data-driven testing, and keyword-driven testing. Finally, it recommends generic skills to learn like scripting languages and tools for automation testing like Selenium, JMeter, and QTP.
6. Record and playback:
Problems
• Does not test anything unless checkpoints added
• Very fragile
1. Often single change in UI can break all tests
• Hard to maintain
1. Plenty of separate test scripts
2. No modularity or reuse
• System must be ready before automation can start
1. Does not support acceptance test driven
development (ATDD)
7. Linear scripting
• Non-structured scripts interact
directly with the system under test
(SUT)
• Can use any programming
language
• Also produced by capture and
replay tools
8. Linear scripting: Example
import unittest
from selenium import webdriver
class Login(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
def tearDown(self):
self.driver.quit()
def test_login(self):
driver = self.driver
driver.get('http://testurl')
username = driver.find_element_by_name('user_id')
submit_button = driver.
find_element_by_xpath(“//a*contains(@class,’a1’)+”)
username.send_keys('admin')
submit_button.click()
9. Linear scripting: Benefits
• Fast to create initially
• Flexible
• Can use common scripting
languages
• No license costs
10. Data-driven testing
• Test data taken out of test scripts
• Customarily presented in tabular
format
• One driver script can execute
multiple similar tests
• New driver script still needed for
different kinds of tests
12. Keyword-driven testing
• Not only test data but also
directives (keywords) telling
how to use the data taken out
of the test scripts
• Keywords and the test data
associated with them drive test
execution
14. Generic skills to learn
• Scripting languages (Python, Java,
C#, Javascript, ... )
• Regular expressions
• XPath and CSS selectors
• SQL
• Using version control
15. Tools for automation
testing
• Selenium (IDE, driver) – Web application
• Apache Jmeter (Performance, Load testing) – Web
services
• Test complete – Desktop + Web
• QTP – Desktop + Web
• Silk Test – Desktop + Web
• AutoIT – Desktop (Windows)
• White – Desktop (Windows)
• Automator – (Mac OS)
• Silkuli – cross-platform