恭喜你!

Python 測試入門

Alexander Levin

Data Scientist

第 1 章-用 pytest 建立測試

  • 測試與 pytest
  • CLI:pytest test_script.py
  • 測試標記(markers)

測試輸出範例

Python 測試入門

第 2 章-Pytest fixtures

  • 介紹 fixtures
  • 鏈式 fixture 請求 fixture 呼叫其他 fixture

  • 自動使用 fixtures(autouse)

  • fixtures 收尾(teardown)
Python 測試入門

第 3 章-基本測試類型

  • 單元測試
  • 功能測試
  • 整合測試
  • 效能測試
Python 測試入門

第 4 章-用 unittest 撰寫測試

  • 認識 unittest
    import unittest
    class TestSquared(unittest.TestCase):
      def test_negative(self):
          self.assertEqual((-3) ** 2, 9)
    
  • Unittest CLI unittest 測試 test_sqneg.py 的輸出

  • unittest 的 fixtures

  • 實務範例
Python 測試入門

恭喜你!

Python 測試入門

Preparing Video For Download...