0
0
Testing Fundamentalstesting~10 mins

Continuous testing in CI/CD in Testing Fundamentals - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test simulates a continuous testing step in a CI/CD pipeline. It runs automated tests on a sample application build and verifies that all tests pass before allowing deployment.

Test Code - unittest
Testing Fundamentals
import unittest

class SampleAppTests(unittest.TestCase):
    def test_addition(self):
        self.assertEqual(2 + 3, 5)

    def test_string_upper(self):
        self.assertEqual('hello'.upper(), 'HELLO')

if __name__ == '__main__':
    unittest.main()
Execution Trace - 4 Steps
StepActionSystem StateAssertionResult
1Test runner starts executing the test suiteCI/CD environment triggers the unittest framework-PASS
2Test runner executes test_addition methodRunning test to verify addition logicCheck if 2 + 3 equals 5PASS
3Test runner executes test_string_upper methodRunning test to verify string uppercase conversionCheck if 'hello'.upper() equals 'HELLO'PASS
4Test runner completes all tests and reports resultsAll tests passed successfullyVerify no test failures or errorsPASS
Failure Scenario
Failing Condition: If any assertion fails during test execution
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test_addition method verify in this CI/CD test?
AThat 2 plus 3 equals 5
BThat 'hello' converts to 'HELLO'
CThat the application deploys successfully
DThat the test runner starts correctly
Key Result
Continuous testing in CI/CD ensures that automated tests run on every code change, catching errors early and preventing faulty code from reaching production.