0
0
Testing Fundamentalstesting~10 mins

Continuous Delivery testing in Testing Fundamentals - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test simulates a Continuous Delivery pipeline step where the application is automatically deployed to a staging environment and verified for successful deployment. It checks that the deployment page loads and shows a success message, ensuring the delivery process works smoothly.

Test Code - Selenium with unittest
Testing Fundamentals
import unittest
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 TestContinuousDeliveryDeployment(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Chrome()
        self.driver.implicitly_wait(5)

    def test_deployment_success_message(self):
        driver = self.driver
        driver.get('https://staging.example.com/deployment-status')

        # Wait until the deployment status element is visible
        status_element = WebDriverWait(driver, 10).until(
            EC.visibility_of_element_located((By.ID, 'deployment-status'))
        )

        # Verify the deployment success message is displayed
        self.assertIn('Deployment Successful', status_element.text)

    def tearDown(self):
        self.driver.quit()

if __name__ == '__main__':
    unittest.main()
Execution Trace - 5 Steps
StepActionSystem StateAssertionResult
1Test starts and Chrome browser opensChrome browser window is open and ready-PASS
2Browser navigates to 'https://staging.example.com/deployment-status'Deployment status page loads in the browser-PASS
3WebDriverWait waits up to 10 seconds for element with ID 'deployment-status' to be visibleDeployment status element is visible on the pageCheck element with ID 'deployment-status' is present and visiblePASS
4Assert that the text 'Deployment Successful' is present in the deployment status elementDeployment status element contains the success message textVerify 'Deployment Successful' text is in element textPASS
5Browser closes and test endsBrowser window is closed-PASS
Failure Scenario
Failing Condition: The deployment status element does not appear or does not contain the success message
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test verify on the deployment status page?
AThat the login form is present
BThat the page shows 'Deployment Successful' message
CThat the browser can open any website
DThat the deployment button is clickable
Key Result
Always wait explicitly for key elements in Continuous Delivery tests to ensure the deployment page is fully loaded before checking success messages. This prevents flaky tests caused by timing issues.