0% found this document useful (0 votes)
9 views

Unit 3- Scripting

The document outlines a course on Software Testing and Automation, focusing on scripting and its importance in testing processes. It covers various scripting languages, their applications in testing, and the differences between scripting and programming languages. Additionally, it details types of scripting used in software testing, including test case creation, data input, GUI testing, performance testing, and regression testing, with examples related to an online e-commerce platform.

Uploaded by

AKSHAT AMLA
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Unit 3- Scripting

The document outlines a course on Software Testing and Automation, focusing on scripting and its importance in testing processes. It covers various scripting languages, their applications in testing, and the differences between scripting and programming languages. Additionally, it details types of scripting used in software testing, including test case creation, data input, GUI testing, performance testing, and regression testing, with examples related to an online e-commerce platform.

Uploaded by

AKSHAT AMLA
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Course Name- Software Testing and Automation

Course Code-COM-702(B)
Lecture No-

Topic – Scripting
Date- 15-10-2024

Model Institute of Engineering & Technology


Course Outcomes

By the end of the course, students shall be able to:

CO1 Understand the concepts of scripting and its importance

CO2 Analyze the variations in the types of testing suits and their applicability

CO3 Understand various testing tools for scripting

CO4 Understand what kind of testing carried out in different applications

CO5 Gain understanding of applicability of popular testing framework


Introduction to Scripting in Software Testing

• Definition: Scripting involves writing code sequences to automate testing


tasks. Scripting languages are versatile programming tools used in many domains,
including software development, data analysis, automation, and web development.
Here are some of the most common scripting languages
• Purpose: Enhances efficiency, accuracy, and consistency in testing
processes.
• Key Benefits: Automates repetitive tasks.
• Allows for executing more tests in less time.
• Increases test coverage and reliability.

Test Automation Fundamentals. Unit 3


Scripting Language examples
4

Python - Highly popular due to its readability, extensive libraries, and


versatility in automation, data science, and web applications.
JavaScript - Widely used in web development to create interactive effects
within web browsers.
Ruby - Known for its elegant syntax and is primarily used in web
applications. Ruby on Rails is a popular web framework built with Ruby.
Perl - Although it has seen a decline in popularity, it's still used for system
administration, network programming, and web development.
PHP - Mainly used for server-side scripting to develop web applications.
Bash - Commonly used in Unix-based systems for task automation and
system administration.

Test Automation Fundamentals. Unit 3


Scripting Language for testing
5

 For software testing specifically, some scripting languages are used more
frequently due to their robust libraries and frameworks that support testing
activities:
• Python: It's widely used in testing because of frameworks like pytest and unittest.
It can be used for a variety of tests, including but not limited to unit testing,
integration testing, and end-to-end testing.
• JavaScript: Essential for web development testing, especially with frameworks
like Jest for unit and integration tests and Cypress or Selenium WebDriver for
browser-based testing.
• Ruby: Utilized with Ruby on Rails applications, with RSpec being a popular
testing framework.

Test Automation Fundamentals. Unit 3


Differences Between Scripting and Programming
Languages:
6

 Execution:
• Scripting Languages: These are often interpreted, meaning they are executed line
by line at runtime. This allows for quicker testing and modification since there's no
need to compile the code before it runs.
• Programming Languages: These can be either compiled or interpreted, but
traditionally, major programming languages like C and Java are compiled into
machine code, which is then executed by the computer's hardware.
 Use Case:
• Scripting Languages: Typically used for automating specific tasks within
programs or systems, such as data manipulation, routine administrative tasks, or
scripting for applications like web browsers. Examples include Python, Bash, and
JavaScript.
• Programming Languages: Used to create applications from the ground up,
capable of spanning every aspect of functionality including UI, backend
processing, and data management. Examples include Java, C++, and Swift.
Test Automation Fundamentals. Unit 3
Differences Between Scripting and Programming
Languages:
7

 Performance:
• Scripting Languages: Generally slower than programming languages due
to being interpreted and not optimized during the translation to machine
code.
• Programming Languages: Often faster because the code is compiled to
native machine code which is directly executed by the operating system.
 Complexity and Control:
• Scripting Languages: Designed for higher-level programming with a
focus on ease of use and rapid development rather than low-level memory
and process management.
• Programming Languages: Provide more control over system resources,
which makes them suitable for developing complex and performance-
critical applications like operating systems and game engines.

Test Automation Fundamentals. Unit 3


Types of Scripting in Software Testing
8

1. Test Case Creation: Automate the execution of test cases.


2. Data Input Scripts: Automate data entry to test how applications handle
inputs.
3. GUI Testing Scripts: Automate interactions with the graphical user
interface.
4. Performance Testing Scripts: Stress test applications by simulating
multiple users.
5. Regression Testing Scripts: Ensure that new code changes do not
disrupt existing functionalities.
Test Case Creation
9

Automated test case execution involves scripting tests that were traditionally
performed manually. This allows for tests to be run automatically, reducing human
error and saving time. Tools like Selenium, Appium, or frameworks like JUnit or
TestNG can be used to write these scripts.
Examples
Automation scripts can include commands to navigate through the application, input
values, and then check the output against expected results. This is especially useful
for repetitive tests or those that require extensive data input.
Data Input Scripts
10

Data input scripts are designed to automate the entry of test data into the
system. This is particularly useful for boundary value testing, equivalence
partitioning, and other test methods that require varied and extensive inputs
to ensure the application handles data correctly under different scenarios.
For example,
a script could be written to test form validations by automatically inputting
strings, numbers, and special characters into form fields to verify that the
application responds correctly.
GUI Testing Scripts
11

GUI testing scripts focus on the graphical interface of an application,


ensuring that all elements like buttons, menus, dialogs, and forms work as
expected. Tools like Selenium

WebDriver can simulate user actions such as clicking, dragging, dropping,


and typing. The script checks the visibility, usability, and responsiveness of
GUI elements. Automated GUI testing helps in identifying cosmetic issues,
functional bugs, and usability problems within the application.
Performance Testing Scripts
12

Performance testing scripts are crucial to determining the robustness and


speed of applications under stress.
These scripts simulate multiple users or high loads to test how the application
handles increased data, processing demands, and to identify bottlenecks.
Tools like JMeter or LoadRunner are used to create these scripts, which
help to evaluate the performance metrics of the application, such as response
times, throughput rates, and resource utilization levels.
Regression Testing Scripts
13

Regression testing is critical whenever existing software is modified. It


ensures that new changes do not adversely affect the existing functionalities.
Regression testing scripts run a set of tests automatically to verify that the
behavior of the application remains consistent after modifications.
This can be particularly helpful in Agile development environments where
changes are frequent and incremental.
Automated regression testing helps maintain stability and can quickly catch
new errors introduced into the system after updates.
Example-online e-commerce platform
14

 1. Test Case Creation: Automate the Execution of Test Cases


 For the e-commerce site, you might create automated test cases to simulate a
user journey from landing on the homepage to checking out:
• Script: Use Selenium to script a test where the bot logs into an account,
searches for a product, selects a product from the results, adds it to the cart,
and proceeds to checkout. The script checks that each page loads correctly,
the cart updates properly, and the final total is correct.
 2. Data Input Scripts: Automate Data Entry to Test How Applications
Handle Inputs
 Testing the e-commerce site's product search and user registration form can
involve:
• Script: Create scripts using Selenium or Cypress that input various test data
into the search bar and registration forms to check how the system handles
boundary values, incorrect formats, or special characters. This could involve
entering extremely long strings, empty fields, or invalid email formats to
ensure the form validations are working as expected.
Example-online e-commerce platform
15

 3. GUI Testing Scripts: Automate Interactions with the Graphical User


Interface
 For the GUI aspects of the e-commerce site, focus might be on the responsiveness
and functionality of interactive elements:
• Script: Use Selenium WebDriver to test the responsiveness of navigation menus,
the visibility of product thumbnails on different device resolutions, and
interactive elements like sliders or dropdowns on the product filters. The script
can automatically click, drag, and drop elements, checking for any UI breaks or
functionality issues.
 4. Performance Testing Scripts: Stress Test Applications by Simulating
Multiple Users
 To ensure the e-commerce site performs well under pressure, especially during
high traffic events like sales:
• Script: Utilize JMeter to simulate hundreds or thousands of users accessing the
site simultaneously, adding items to their carts, and checking out. This helps in
identifying performance bottlenecks, such as slow page loads or transaction
processing delays under load.
Example-online e-commerce platform
16

 5. Regression Testing Scripts: Ensure that New Code Changes Do Not


Disrupt Existing Functionalities
 Whenever updates are made to the e-commerce site, regression testing
ensures that new changes haven’t broken existing functionality:
• Script: Set up a suite of regression tests using TestNG or JUnit integrated
with Selenium, which runs through all the core functionalities of the
website—like logging in, product searches, adding items to the cart, and
processing payments—every time there's a new release. This helps catch
any issues introduced by the new changes.

You might also like