Bird
Raised Fist0
Testing Fundamentalstesting~15 mins

Test management tools (Jira, TestRail) in Testing Fundamentals - Build an Automation Script

Choose your learning style10 modes available
Create and verify a new test case in TestRail
Preconditions (3)
Step 1: Navigate to the TestRail project dashboard
Step 2: Click on the 'Test Cases' tab
Step 3: Click the 'Add Test Case' button
Step 4: Enter 'Verify login functionality' in the Title field
Step 5: Enter 'Test the login page with valid credentials' in the Description field
Step 6: Select the appropriate section for the test case
Step 7: Click the 'Add Test Case' button to save
Step 8: Verify that the new test case appears in the test case list with the correct title
✅ Expected Result: The new test case titled 'Verify login functionality' is created and visible in the test case list
Automation Requirements - Selenium with Python
Assertions Needed:
Verify the test case title input field accepts the correct text
Verify the test case description input field accepts the correct text
Verify the new test case appears in the test case list after saving
Best Practices:
Use explicit waits to handle dynamic page elements
Use Page Object Model to separate page interactions
Use meaningful locators like IDs or stable CSS selectors
Include clear assertion messages for test failures
Automated Solution
Testing Fundamentals
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

class TestRailPage:
    def __init__(self, driver):
        self.driver = driver
        self.wait = WebDriverWait(driver, 10)

    def go_to_project_dashboard(self):
        self.driver.get('https://yourtestrailurl.com/index.php?/projects/overview/1')

    def click_test_cases_tab(self):
        tab = self.wait.until(EC.element_to_be_clickable((By.ID, 'navigation-test-cases')))
        tab.click()

    def click_add_test_case(self):
        add_button = self.wait.until(EC.element_to_be_clickable((By.ID, 'add_case_button')))
        add_button.click()

    def enter_title(self, title):
        title_field = self.wait.until(EC.visibility_of_element_located((By.ID, 'title')))
        title_field.clear()
        title_field.send_keys(title)

    def enter_description(self, description):
        desc_field = self.driver.find_element(By.ID, 'custom_description')
        desc_field.clear()
        desc_field.send_keys(description)

    def select_section(self):
        # Assuming default section is selected or no action needed
        pass

    def save_test_case(self):
        save_button = self.driver.find_element(By.ID, 'accept')
        save_button.click()

    def verify_test_case_in_list(self, title):
        # Wait for the test case list to refresh and check for title
        self.wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, 'table.cases')))
        cases = self.driver.find_elements(By.CSS_SELECTOR, 'table.cases tbody tr td.title')
        titles = [case.text for case in cases]
        assert title in titles, f"Test case titled '{title}' not found in the list"


def test_create_test_case():
    driver = webdriver.Chrome()
    driver.implicitly_wait(5)
    try:
        page = TestRailPage(driver)
        page.go_to_project_dashboard()
        page.click_test_cases_tab()
        page.click_add_test_case()
        test_title = 'Verify login functionality'
        test_description = 'Test the login page with valid credentials'
        page.enter_title(test_title)
        page.enter_description(test_description)
        page.select_section()
        page.save_test_case()
        page.verify_test_case_in_list(test_title)
    finally:
        driver.quit()

if __name__ == '__main__':
    test_create_test_case()

This script uses Selenium with Python to automate creating a test case in TestRail.

We use a Page Object Model class TestRailPage to organize page actions like navigating, clicking buttons, and entering text.

Explicit waits ensure elements are ready before interacting, avoiding timing issues.

Assertions check that the test case title appears in the list after saving, confirming success.

Finally, the test function runs the steps and closes the browser.

Common Mistakes - 3 Pitfalls
Using hardcoded sleeps instead of explicit waits
Using brittle XPath selectors that break easily
Not verifying that inputs accept the correct text before saving
Bonus Challenge

Now add data-driven testing with 3 different test case titles and descriptions

Show Hint

Practice

(1/5)
1. What is the primary purpose of test management tools like Jira and TestRail?
easy
A. To design user interfaces
B. To write code for software applications
C. To manage server hardware
D. To organize and track testing activities and results

Solution

  1. Step 1: Understand the role of test management tools

    Test management tools help testers organize test cases, track progress, and report bugs.
  2. Step 2: Compare options with this role

    Only To organize and track testing activities and results describes organizing and tracking testing activities, which matches the tool's purpose.
  3. Final Answer:

    To organize and track testing activities and results -> Option D
  4. Quick Check:

    Test management tools = Organize and track tests [OK]
Hint: Think: What helps testers track and organize tests? [OK]
Common Mistakes:
  • Confusing test management with coding or design tools
  • Thinking test management tools handle hardware
  • Assuming they write software code
2. Which of the following is a correct way to create a new test case in TestRail?
easy
A. Send test case via email to TestRail support
B. Write test case in a text editor and upload as .exe
C. Click 'Add Test Case', fill details, then save
D. Create a new project in Jira instead

Solution

  1. Step 1: Recall TestRail test case creation process

    TestRail allows adding test cases by clicking 'Add Test Case', entering details, and saving.
  2. Step 2: Evaluate other options

    Uploading .exe files or emailing support are not standard ways; creating a Jira project is unrelated.
  3. Final Answer:

    Click 'Add Test Case', fill details, then save -> Option C
  4. Quick Check:

    TestRail test case creation = Add and save [OK]
Hint: TestRail uses UI buttons to add test cases, not files or emails [OK]
Common Mistakes:
  • Confusing file upload with test case creation
  • Mixing Jira project creation with TestRail test cases
  • Thinking support emails create test cases
3. In Jira, if you create a bug issue and assign it to a developer, what will happen when the developer changes the status to 'In Progress'?
medium
A. The bug is marked as fixed automatically
B. The bug status updates to show work has started
C. The bug is deleted from the project
D. The bug is reassigned to the tester

Solution

  1. Step 1: Understand Jira issue workflow

    Changing status to 'In Progress' means work on the bug has started, not fixed or deleted.
  2. Step 2: Match options with workflow behavior

    Only The bug status updates to show work has started correctly describes status update showing work started.
  3. Final Answer:

    The bug status updates to show work has started -> Option B
  4. Quick Check:

    Jira 'In Progress' = Work started [OK]
Hint: In Jira, 'In Progress' means work started, not fixed or deleted [OK]
Common Mistakes:
  • Thinking 'In Progress' means bug is fixed
  • Assuming bug gets deleted automatically
  • Confusing status change with reassignment
4. You notice that test cases in TestRail are not linked to Jira issues as expected. What is the most likely cause?
medium
A. The integration between TestRail and Jira is not configured properly
B. TestRail does not support linking to Jira
C. Jira issues are deleted automatically after creation
D. Test cases must be manually copied into Jira

Solution

  1. Step 1: Understand integration role

    TestRail can link test cases to Jira issues if integration is set up correctly.
  2. Step 2: Analyze options

    The integration between TestRail and Jira is not configured properly explains missing links due to misconfiguration; others are incorrect or false statements.
  3. Final Answer:

    The integration between TestRail and Jira is not configured properly -> Option A
  4. Quick Check:

    Missing links = Integration issue [OK]
Hint: Check integration settings first when links are missing [OK]
Common Mistakes:
  • Assuming TestRail cannot link to Jira
  • Thinking Jira deletes issues automatically
  • Believing manual copying is required
5. A team uses Jira for bug tracking and TestRail for test case management. They want to generate a report showing which test cases failed due to open bugs. What is the best approach?
hard
A. Use TestRail-Jira integration to link test cases with Jira bugs, then generate combined reports
B. Manually compare test case results and Jira bugs in separate spreadsheets
C. Export Jira bugs and import them into TestRail as test cases
D. Create duplicate test cases in Jira and track failures there

Solution

  1. Step 1: Identify integration benefits

    Linking test cases and bugs via integration allows automatic combined reporting.
  2. Step 2: Evaluate other options

    Manual comparison is error-prone; importing bugs as test cases or duplicating test cases in Jira is inefficient and incorrect.
  3. Final Answer:

    Use TestRail-Jira integration to link test cases with Jira bugs, then generate combined reports -> Option A
  4. Quick Check:

    Integration enables combined reporting [OK]
Hint: Leverage integration for combined reports, avoid manual work [OK]
Common Mistakes:
  • Relying on manual spreadsheet comparison
  • Importing bugs as test cases incorrectly
  • Duplicating test cases in Jira unnecessarily
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard