Introduction To Software Testing & QA: Week 1 Lesson - ELEC IT E2: Software Quality Assurance
Introduction To Software Testing & QA: Week 1 Lesson - ELEC IT E2: Software Quality Assurance
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.
Defect Lifecycle:
1. Identification
2. Logging
3. Triage & Fixing
4. Retesting
5. Closure
Software Testing Methodologies
TakesScreenshot ts = (TakesScreenshot)
driver;
File src =
ts.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(src, new
File("./screenshots/test.png"));
Assertions
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");
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