Skip to content

unittest

David Liu edited this page Mar 14, 2025 · 3 revisions
  • unittest only take function with prefix test_ as test case
  • Execution order does not respect function definition order, but function name ascending order
    • Note that the order in which the various test cases will be run is determined by sorting the test function names with respect to the built-in ordering for strings

  • tearDown 是 unittest 框架中的一个方法,用于在每个测试方法执行完毕后进行清理工作
  • tearDownClass 是一个类方法,它会在所有测试方法执行完毕后被调用一次。
  • setUp函数是unittest.TestCase类中的一个实例方法,它在每个测试方法执行之前被调用

Latest compiled version

  • 3.12.9+
  • 3.11.11
  • 3.10.11
Clone this wiki locally