0% found this document useful (0 votes)
9 views105 pages

Introduction To Software Testing & QA: Week 1 Lesson - ELEC IT E2: Software Quality Assurance

This document provides an overview of software testing and quality assurance, detailing the importance of software quality, the differences between QA, QC, and software testing, as well as the software development lifecycle (SDLC) and testing lifecycle (STLC). It covers various testing methodologies, types of testing (functional and non-functional), and the significance of test planning and documentation. Additionally, it introduces test automation using Selenium, highlighting its advantages, challenges, and setup instructions.

Uploaded by

briquettes613
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
9 views105 pages

Introduction To Software Testing & QA: Week 1 Lesson - ELEC IT E2: Software Quality Assurance

This document provides an overview of software testing and quality assurance, detailing the importance of software quality, the differences between QA, QC, and software testing, as well as the software development lifecycle (SDLC) and testing lifecycle (STLC). It covers various testing methodologies, types of testing (functional and non-functional), and the significance of test planning and documentation. Additionally, it introduces test automation using Selenium, highlighting its advantages, challenges, and setup instructions.

Uploaded by

briquettes613
Copyright
© © All Rights Reserved
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/ 105

Introduction to

Software Testing & QA


Week 1 Lesson | ELEC IT E2: Software
Quality Assurance
Importance of Software Quality
- Reduces risks (financial, security,
reputational)
- Improves user experience
- Saves cost by early defect detection
- Ensures compliance with standards

Example: Facebook outage due to software


bugs.
QA vs. QC vs. Software Testing
Quality Assurance (QA) is proactive, focusing
on preventing defects by improving
processes.
Quality Control (QC) is reactive, ensuring that
the final product meets quality standards
before release.
Software Testing is a subset of QC that
involves executing test cases to find defects.
Aspect QA (Quality Assurance) QC (Quality Control) Software Testing

Product-oriented process that Activity focused on


Process-oriented approach
Definition verifies the final product finding defects in the
to ensure quality
meets quality standards software

Identifying and fixing


Focus Prevention of defects Detection of defects
software bugs

After development (before


When? Throughout the SDLC During the STLC
release)

Functional,
Example Process audits,
Inspections, walkthroughs performance, security
Activities documentation reviews
testing
SDLC & STLC Overview
SDLC Phases:
1. Requirement Analysis
2. Design
3. Development
4. Testing
5. Deployment
6. Maintenance

STLC Phases:
1. Requirement Analysis
2. Test Planning
3. Test Case Development
4. Test Execution
5. Test Closure

SDLC focuses on the entire software development process, while STLC focuses only on testing
activities within that process.
Types of Testing: Functional vs. Non-
Functional
Functional Testing - Ensures the application works
according to the requirements.

Unit Testing – Tests individual components of the


software.
Integration Testing – Ensures different modules work
together.
System Testing – Tests the entire system end-to-end.
User Acceptance Testing (UAT) – Validates if the
software meets business requirements.
Types of Testing: Functional vs. Non-
Functional
Non-Functional Testing - Evaluates aspects like
performance, security, and usability.

Performance Testing – Checks speed and


scalability.
Security Testing – Identifies vulnerabilities.
Usability Testing – Ensures user-friendliness.
Compatibility Testing – Tests on different devices
and browsers.
Software Defects & Defect Lifecycle
Common Software Defects:
- Functional defects (incorrect output)
- UI defects (alignment issues)
- Performance issues (slow response time)
- Security vulnerabilities (weak encryption)

Defect Lifecycle:
1. Identification
2. Logging
3. Triage & Fixing
4. Retesting
5. Closure
Software Testing Methodologies

Week 2 Lesson | Black Box vs. White


Box, Agile vs. Waterfall, Test Case
Design Techniques
Learning Objectives
• Differentiate Black Box vs. White Box
Testing
• Compare Agile vs. Waterfall Testing
• Understand Test Case Design Techniques
Black Box Testing
Focuses on functionality without knowing the
internal code
Tests input and output behavior
Used for functional, system, and acceptance
testing

Example: Testing a login system without


checking its code.
White Box Testing
Examines internal code structure, logic, and
flow
Requires knowledge of coding
Used for unit, security, and integration testing

Example: A developer tests a password


encryption function for security.
Agile vs. Waterfall Testing
Agile - Testing occurs continuously, feedback-
driven
Waterfall - Testing happens after development
is completed

Example: Agile is used in mobile app


development, Waterfall in government
software.
Test Case Design Techniques
• Boundary Value Analysis (BVA)
• Equivalence Partitioning
• Decision Table Testing
• State Transition Testing
• Use Case Testing
Boundary Value Analysis (BVA)
• Tests values at the edge of allowed input
range

Example: Age input (18-60), test 17 (invalid),


18 (valid), 60 (valid), 61 (invalid).
Equivalence Partitioning
• Divides input data into valid and invalid
groups

Example: Password length (8-16 chars), test


'abc' (invalid), 'abcdefgh' (valid).
Decision Table Testing
• Uses rules and conditions for structured test
cases

Example: Loan approval depends on credit


score and salary.
State Transition Testing
• Tests system behavior as it moves between
states

Example: ATM card states (Inserted → PIN


entered → Cash dispensed → Ejected).
Use Case Testing
• Tests real-world scenarios of software
usage

Example: Online shopping workflow (Browse


→ Add to Cart → Checkout → Payment).
Summary
• Black Box focuses on system behavior;
White Box tests internal code.
• Agile is iterative; Waterfall is sequential.
• Test case design techniques improve
efficiency.
Test Planning & Documentation

Writing Test Plans, Test Cases, and Test


Scenarios, Test Case Management Tools
(Jira, Zephyr, TestRail) Defect Life Cycle
& Bug Reporting
Learning Objectives
• Understand the importance of test planning
in the software testing lifecycle.
• Identify and describe the components of a
Test Plan.
• Create basic test documentation (Test Plan,
Test Case, and Test Summary Report).
• Recognize the role of traceability and test
coverage in documentation.
What is Test Planning?
Test planning is the process of defining the
scope, approach, resources, and schedule of
testing.
Answers the "what, why, when, who, and
how" of testing.
Ensures everyone is aligned and testing is
done systematically.
Why is Test Planning Important?
✓Avoids confusion
✓Saves time and resources
✓Ensures test coverage
✓Helps manage risks
Test Plan Components (Overview)
❑ Introduction
❑ Test Items
❑ Features to be Tested / Not to be Tested
❑ Test Approach
❑ Pass/Fail Criteria
❑ Test Deliverables
❑ Testing Schedule
❑ Environmental Needs
❑ Roles and Responsibilities
❑ Risks and Mitigation
Test Plan Components (Detailed)
Introduction - Overview of the testing project
Test Items - Features/modules to be tested
Test Approach – Strategy: manual,
automation, etc.
Pass/Fail Criteria - Success metrics
Types of Test Documentation
Test Plan - Strategy and scope of testing
Test Cases - Step-by-step test instructions
Test Data - Inputs used in testing
Test Summary Report - Overview of testing
results
Example Test Case Format
Test Case ID: TC001
Description: Verify login with valid credentials
Precondition: User must be registered
Test Steps: 1. Go to login page 2. Enter valid
credentials
Expected Result: Redirect to dashboard
Actual Result: Redirects to dashboard
Status: Pass
Traceability Matrix
Links each requirement to its test case
Ensures complete coverage
Example:
Requirement ID Description Test Case ID
RQ001 User Login TC001, TC002

RQ002 Password Reset TC003


Best Practices in Test
Documentation
➢Keep it simple and clear
➢Use reusable templates
➢Regularly update documents
➢Store in accessible locations
➢Review and get feedback
Summary
➢Test planning is critical for successful QA
➢Proper documentation improves quality and
traceability
➢Use best practices for efficiency and clarity
Class Activity
1. Create a sample Test Plan for PUP SIS
– login feature
– Online ACE
– Online Petition
– Course Offering
2. Write test cases.
3. Create a simple traceability matrix.

➢ Submission via Class Teams. Instruction will be


posted as well.
Instructions: Write T if the statement
is true and F if it is false.
1.___ Test planning defines the approach,
scope, and schedule of testing.
2.___ A test case must include expected
results.
3.___ The test plan does not need to include
risks and mitigation strategies.
4.___ Traceability Matrix is used to ensure
test cases cover all requirements.
5.___ Test documentation is only useful for
automation testing.
Instructions: Choose the best answer.
6. What is the primary purpose of a test plan?
a) To list all test cases
b) To outline the testing approach, schedule, and scope
c) To write automation scripts
d) To create user manuals

7. Which of the following is not a component of a test plan?


a) Test Approach
b) Expected Revenue
c) Pass/Fail Criteria
d) Test Deliverables
Instructions: Choose the best answer.
8. What document links each requirement to its
corresponding test case?
a) Test Summary Report
b) Test Data Sheet
c) Traceability Matrix
d) Test Case Document

9. A well-documented test case should include:


a) Steps to execute the test
b) Expected results
c) Preconditions
d) All of the above
Instructions: Choose the best answer.
10. Which testing document provides an overview of test
execution results?
a) Test Plan
b) Test Summary Report
c) Test Case Document
d) Test Data File

11. In test planning, identifying features that will not be


tested is known as:
a) Test Scope
b) Test Exclusions
c) Risk Analysis
d) Test Execution
Instructions: Choose the best answer.
12. What is the role of a Test Summary Report?
a) To provide detailed test case steps
b) To summarize testing results and findings
c) To list all software defects
d) To define the automation framework

13. What does a test case primarily verify?


a) Code quality
b) Expected behavior of a feature
c) UI design standards
d) The number of bugs in software
Instructions: Choose the best answer.
14. Why is test documentation important?
a) It helps maintain test consistency
b) It allows knowledge transfer across teams
c) It supports audit and compliance requirements
d) All of the above

15. The section of the test plan that identifies necessary


hardware and software is called:
a) Testing Schedule
b) Environmental Needs
c) Roles and Responsibilities
d) Risk Management
Instructions: Write the correct term based on the
description.
16. A document that outlines the overall strategy, scope,
and objectives of testing.

17. A document that records testing results and summaries


after execution.

18. A test document that lists steps to validate software


functionality.

19. A technique that ensures all requirements have


corresponding test cases.

20. The process of defining the test strategy, objectives, and


resources.
Part 1: True or False (5 points)
1. T – Test planning defines the approach, scope, and schedule of testing.
2. T – A test case must include expected results.
3. F – The test plan should include risks and mitigation strategies.
4. T – A Traceability Matrix ensures test cases cover all requirements.
5. F – Test documentation is useful for both manual and automation testing.
6. b) To outline the testing approach, schedule, and scope
7. b) Expected Revenue
8. c) Traceability Matrix
9. d) All of the above
10. b) Test Summary Report
11. b) Test Exclusions
12. b) To summarize testing results and findings
13. b) Expected behavior of a feature
14. d) All of the above
15. b) Environmental Needs
16. Test Plan – A document that outlines the overall strategy, scope, and objectives of testing.
17. Test Summary Report – A document that records testing results and summaries after execution.
18. Test Case – A test document that lists steps to validate software functionality.
19. Traceability Matrix – A technique that ensures all requirements have corresponding test cases.
20. Test Planning – The process of defining the test strategy, objectives, and resources.
Thank You!
Functional & Non-Functional
Testing
Learning Objectives
➢Explain functional vs non-functional testing
➢Understand Unit, Integration, System, UAT
➢Basics of performance, security, usability
testing
➢Exploratory and ad-hoc testing
Functional vs. Non-Functional
Testing
Functional. Verifies software functions as
specified
Non-Functional. Evaluates performance,
usability, security
Example:
Functional - Login works with correct
credentials
Non-Functional - Login works for 1000 users
Unit Testing
Tests individual components in isolation.
Done by developers

Tools - JUnit, NUnit, pytest


Example - Testing calculateDiscount() function
Integration Testing
Tests combined modules working together

Types - Top-down, Bottom-up, Big Bang


Example - Inventory updates reflected in cart
System Testing
Complete system tested as a whole. Done in
staging/production-like environment

Example - Browse > Add to Cart > Checkout


> Confirmation Email
User Acceptance Testing (UAT)
Final validation by end-users. Ensures
software meets business requirements

Example - Sales staff checks reports


Non-Functional Testing Overview
❑Performance Testing
❑Security Testing
❑Usability Testing
Performance Testing
Responsiveness and stability
Types - Load, Stress, Spike Testing
Tools - JMeter, LoadRunner

Example - 1000 users access banking app


Security Testing
Identifies vulnerabilities
Areas - Authentication, Data protection
Tools - OWASP ZAP, Burp Suite

Example - Restrict unauthorized admin access


Usability Testing
Measures user-friendliness
Focus - UI, accessibility, navigation

Example - New users sign up in 2 mins


Exploratory Testing
Simultaneous learning and testing. Flexible,
creative

Example - Coupon bug in food delivery app


Ad-Hoc Testing
Informal, unstructured testing. No test cases

Example - Enter emojis in fields to test UI


1. Which of the
following is NOT a type
of functional testing?
A. Unit Testing
B. Integration Testing
C. Load Testing
D. System Testing
2. User Acceptance
Testing is usually
performed by
A. Developers
B. Test Automation Engineers
C. End Users or Clients
D. Product Owners only
3. What is the main
purpose of integration
testing?
A. Test UI components
B. Validate the entire application
C. Check how modules interact
D. Test security features
4. Which of these is
considered a non-
functional requirement?
A. The system allows user login
B. The system responds within 2 seconds
C. The user can reset their password
D. Admin can update user profiles
5. Which tool is
commonly used for
performance testing?
A. Selenium
B. JUnit
C. JMeter
D. OWASP ZAP
TRUE OR FALSE
6. Unit testing is usually done by testers.
7. Exploratory testing relies on test cases and
scripts.
8. Security testing includes checking for data
protection and unauthorized access.
9. Ad-hoc testing is an informal, unstructured
form of testing.
10.Usability testing focuses on the system's
ability to handle stress.
Thank
You
Fundamentals of Test
Automation
Advantages, Challenges, and
Selenium Setup with Java
Learning Objectives
1. Explain benefits and limitations of
automated testing
2. Understand Selenium WebDriver's purpose
and features
3. Set up Selenium with Java using IntelliJ and
Maven
4. Create and run a basic automated web test
Introduction to Test Automation
Automates repetitive and regression test
cases. Ensures consistency and faster test
execution. Saves manual effort and improves
reliability
Advantages of Test Automation
1. Faster test execution and feedback
2. Repeatable and reusable test cases
3. Scalable across environments and
browsers
4. Consistent and reduces human errors
5. Supports CI/CD pipelines
Challenges of Test Automation
1. High initial setup time and cost
2. Frequent test maintenance required
3. Not ideal for exploratory or usability
testing
4. Requires programming and tool
knowledge
Introduction to Selenium WebDriver
1. Open-source tool for automating web apps
2. Supports multiple languages and browsers
3. Simulates real user actions (click, type, etc.)
4. Integrates with JUnit, TestNG, and CI tools
Tools Needed for Selenium with Java
1. Java JDK
2. IntelliJ IDEA (Community Edition)
3. Maven (for dependencies)
4. Selenium WebDriver
5. JUnit or TestNG for testing
Selenium Setup - Steps Overview
1. Install IntelliJ and Java JDK
2. Create a Maven project
3. Add Selenium dependency to pom.xml
4. Create test classes and run tests
5. Add JUnit or TestNG support
Example - Basic Selenium Test
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com");
System.out.println(driver.getTitle());
driver.quit();
JUnit Example Test
@Test
public void testGoogleTitle() {
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com");
assert driver.getTitle().contains("Google");
driver.quit();
}
Summary / Recap
✓Test automation improves speed and
reliability
✓Selenium is a powerful web testing tool
✓Java + IntelliJ + Maven offers easy setup
✓JUnit/TestNG structures and automates tests
Writing Basic Selenium
Scripts
Locating Elements, Performing
Actions, Screenshots & Assertions
Learning Objectives
➢Locate web elements using various locator
strategies.
➢Perform actions like click, sendKeys, scroll,
select.
➢Implement waits to handle synchronization.
➢Capture screenshots in Selenium.
➢Use assertions to validate test outcomes.
Finding Web Elements
Selector Element
By.id driver.findElement(By.id("userna
me"))
By.name driver.findElement(By.name("emai
l"))
By.xpath driver.findElement(By.xpath("//in
put[@type='text']"))
By.cssSelector driver.findElement(By.cssSelector(
"input.login"))
Performing Actions
Function Purpose
sendKeys() Type into input fields

click() Click buttons or links

Select Choose from dropdown menus

JavaScriptExecutor Scroll into view


Handling Waits
Feature Implicit Wait Explicit Wait
Waits for a defined amount of time for
Waits for a specific condition to occur
Definition elements to appear before throwing an
before proceeding
exception
Applies only to specific
Scope Applies globally to all elements
elements/conditions
WebDriverWait wait = new
WebDriverWait(driver,
driver.manage().timeouts().implicitlyW
Syntax Duration.ofSeconds(10));
ait(Duration.ofSeconds(10));
wait.until(ExpectedConditions.visibilityOf
ElementLocated(By.id("elementId")));
Less flexible (works only for element More flexible (supports conditions like
Flexibility
presence) visibility, clickability, text presence, etc.)

Full control over how and when the wait


Control Minimal control once set
should be applied
Ideal for dynamic content or elements
Use Case Useful for basic synchronization that take time to load under specific
conditions
Capturing Screenshots

TakesScreenshot ts = (TakesScreenshot)
driver;
File src =
ts.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(src, new
File("./screenshots/test.png"));
Assertions

JUnit: assertEquals(expected, actual);


TestNG: Assert.assertEquals(actual, expected);
Take home Individual Activity

1. Open a login page


2. Enter credentials and click login
3. Verify landing page URL
4. Capture a screenshot after login
Assignment (Due Next Week)

1. Write a Selenium test for a form


submission
2. Use various locator strategies
3. Include assertions and screenshots
4. Submit your project via teams
Automation Frameworks
& Best Practices
Page Object Model (POM), Data-
Driven & Keyword-Driven Testing,
TestNG Integration
Page Object Model (POM)
Design pattern in Selenium that
represents each web page with a class.
- Encapsulates UI elements and
interactions
- Promotes separation of concerns
- Increases maintainability and reusability
Why use POM?
- Keeps UI logic separate from tests
- Easier to maintain and update
- Methods for page actions are reusable
across tests
Data-Driven Testing
Testing technique using external data sets.
- Input data is separated from test logic
- Use Excel, CSV, JSON, or databases
- Enhances test coverage and reusability
Keyword-Driven Testing
Testing method using predefined action
keywords.
- Actions and data are separated from logic
- Enables non-programmers to write tests
- Keywords represent steps (e.g., 'ClickButton',
'EnterText')
Data vs Keyword-Driven
Data-Driven:
Focus: Input data variation
Test logic is static, data changes

Keyword-Driven:
Focus: Action abstraction
Test logic represented by keywords
What is TestNG?
Java testing framework inspired by JUnit.
- Supports annotations, parallel execution,
and reports
- Enables grouping, prioritization, and
dependency handling
TestNG Annotations
@Test: Declares a test method
@BeforeClass, @AfterMethod:
Setup/teardown methods
@DataProvider: Supplies data
@Parameters: Pass values via XML
TestNG Features
- Flexible test configuration with XML
- Built-in reporting
- Easily integrates with Selenium, Maven,
Jenkins
Automation Best Practices
- Use clear naming conventions
- Keep tests independent
- Modularize code (POM, utilities)
- Centralize test data
- Implement logging and reporting
Maintenance Best Practices
- Refactor and clean up regularly
- Automate regression tests
- Document and review test code
- Use version control systems like Git
Working with Advanced
Selenium Features
Alerts, Frames, Windows, Mouse &
Keyboard Actions, File Uploads &
Downloads
Learning Objectives
• Handle browser alerts, frames, and multiple
windows/tabs
• Simulate complex mouse and keyboard
actions
• Automate file upload and download
operations
Handling Alerts
Alerts are popup boxes in the browser.
Types:
- Simple
- Confirmation
- Prompt

Selenium Example:
Alert alert = driver.switchTo().alert();
alert.accept();
alert.dismiss();
alert.sendKeys("input");
Handling Frames
Frames embed other HTML documents.
Must switch context to interact with them.

Example:
driver.switchTo().frame("frameName");
driver.switchTo().defaultContent();
Handling Windows
Selenium handles tabs/windows using window
handles.

Example:
String main = driver.getWindowHandle();
for (String win : driver.getWindowHandles()) {
if (!win.equals(main))
driver.switchTo().window(win);
}
Mouse Actions
Use Actions class for advanced mouse
interaction.

Example:
Actions act = new Actions(driver);
act.moveToElement(el).click().perform();
act.doubleClick(el).perform();
Keyboard Actions
Simulate keypresses using Actions class.

Example:
act.sendKeys(Keys.ENTER).perform();
act.keyDown(Keys.CONTROL).sendKeys("a").ke
yUp(Keys.CONTROL).perform();
File Uploads
If <input type='file'> is visible:
upload.sendKeys("C:\\path\\to\\file.txt");

For hidden elements, use JavaScriptExecutor


or Robot class.
File Downloads
Selenium can't handle download dialogs.
Set browser preferences.

Example (Chrome):
chromePrefs.put("download.default_directory",
"C:\\Downloads");
Best Practices
1. Always switch back to main content after
frame/window actions
2. Use explicit waits
3. Handle alerts/frames in try-catch blocks
Summary
✓Selenium handles alerts, frames, windows
✓Actions class for mouse/keyboard
✓File upload via sendKeys
✓File downloads need browser config

You might also like