Building a testing portfolio in Testing Fundamentals - Build an Automation Script
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import unittest class TestPortfolioPage(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.get('file:///path/to/portfolio.html') # Update path accordingly self.wait = WebDriverWait(self.driver, 10) def test_portfolio_content(self): driver = self.driver wait = self.wait # Wait for header and verify text header = wait.until(EC.visibility_of_element_located((By.TAG_NAME, 'h1'))) self.assertEqual(header.text, 'My Testing Portfolio', 'Header text does not match') # Find project list container projects = driver.find_elements(By.CLASS_NAME, 'project') self.assertEqual(len(projects), 3, 'There should be exactly 3 projects') # Verify each project has name and description for i, project in enumerate(projects, start=1): name = project.find_element(By.CLASS_NAME, 'project-name').text desc = project.find_element(By.CLASS_NAME, 'project-desc').text self.assertTrue(name.strip(), f'Project {i} name is empty') self.assertTrue(desc.strip(), f'Project {i} description is empty') # Verify footer contact info footer = driver.find_element(By.TAG_NAME, 'footer') self.assertIn('contact', footer.text.lower(), 'Footer does not contain contact information') def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()
This test script uses Selenium with Python's unittest framework.
setUp: Opens the browser and loads the local portfolio HTML file.
test_portfolio_content: Waits for the header and checks its text. Finds all project elements by class name 'project' and asserts there are exactly three. For each project, it checks that the name and description elements are not empty. Finally, it checks the footer contains the word 'contact' to confirm contact info is present.
tearDown: Closes the browser after the test.
This structure ensures the test is clear, waits for elements properly, and uses semantic locators for maintainability.
Now add data-driven testing with 3 different portfolio HTML files, each with different project details
Practice
Solution
Step 1: Understand the role of a testing portfolio
A testing portfolio is a collection of your work that shows your skills in software testing.Step 2: Identify the correct purpose
It is used to prove your testing abilities to employers or clients, not for unrelated tasks like storing personal documents or managing deadlines.Final Answer:
To showcase your testing skills and experience -> Option AQuick Check:
Testing portfolio = showcase skills [OK]
- Confusing portfolio with personal file storage
- Thinking it's for coding instead of testing
- Mixing portfolio with project management tools
Solution
Step 1: Understand organization best practices
Organizing test cases by feature or functionality helps reviewers find relevant tests easily.Step 2: Eliminate poor organization methods
Random order or mixing with unrelated documents makes the portfolio confusing. Including only failed tests is incomplete.Final Answer:
Grouped by feature or functionality tested -> Option BQuick Check:
Organize by feature = clear portfolio [OK]
- Leaving test cases unordered
- Including only failed tests
- Mixing unrelated files with test cases
Test Cases Included: - Login Functionality - Payment Processing - User Profile Update Bug Reports: - Bug #101: Login fails on invalid password - Bug #102: Payment gateway timeout Automation Scripts: - login_test.py - payment_test.pyWhat will a reviewer most likely conclude about this portfolio?
Solution
Step 1: Analyze the portfolio contents
The portfolio lists test cases, bug reports, and automation scripts, showing a variety of testing work.Step 2: Check for completeness
Bug reports are included with details, and test cases cover features. Automation scripts are also present.Final Answer:
It is well-rounded with manual and automated tests -> Option DQuick Check:
Multiple test types = well-rounded portfolio [OK]
- Ignoring bug report details
- Assuming automation means no manual tests
- Missing that test cases are listed
- Bug #201: "App crashes when clicking submit"
- Bug #202: "Login button not working"
- Bug #201: "Payment page freezes"
What is the main issue here?
Solution
Step 1: Identify the problem in bug IDs
Bug #201 appears twice with different descriptions, which can confuse readers and tracking systems.Step 2: Understand impact of duplicate IDs
Duplicate IDs make it hard to reference bugs correctly and can cause errors in bug tracking.Final Answer:
Duplicate bug IDs causing confusion -> Option CQuick Check:
Unique bug IDs prevent confusion [OK]
- Ignoring duplicate IDs
- Thinking missing scripts is the main issue
- Assuming descriptions are too long
Solution
Step 1: Identify quality over quantity
Adding scripts that cover important features shows thoughtful testing and skill.Step 2: Importance of clarity and relevance
Clear comments and showing test results help reviewers understand your work and its impact.Final Answer:
Add scripts that cover critical features with clear comments and results -> Option AQuick Check:
Quality scripts + clarity = strong portfolio [OK]
- Adding many unclear scripts
- Ignoring critical features
- Testing random unrelated parts
Ready to prove it?
Pass the test and this pattern moves unknown
