Python - The big testing course

所在平台: Udemy

课程主页: https://www.udemy.com/course/python-the-big-testing-course/

课程评论:没有评论

第一个写评论        关注课程

课程简介

本课程是“Python - 大型测试课程”。 **课程概述:** 本课程整合了讲师多年的 Python 实践经验,旨在为你提供一个坚实的测试基础,从不同角度测试你编写的代码。课程将介绍并提供真实世界的应用示例,涵盖以下流行模块: * **doctest:** * 搜索并执行 Python 交互式会话风格的文本,以验证其准确性。 * 用途包括: * 检查模块文档字符串(docstrings)是否过时,验证其中的交互式示例是否仍按文档所示工作。 * 通过验证测试文件或测试对象中的交互式示例是否按预期工作来进行回归测试。 * 为软件包编写教程文档,其中包含丰富的输入输出示例。根据示例或解释性文字的侧重点,可将其视为“ the flavor of 'literate testing' ”或“executable documentation”。 * **pytest:** * 帮助你编写更好的程序。pytest 框架易于编写小型、可读的测试,并能扩展以支持复杂的函数式测试。 * **主要特点:** * 提供有关失败的 assert 语句的详细信息(无需记忆 `self.assert*` 名称)。 * 自动发现测试模块和函数。 * 模块化的 fixture,用于管理小型或参数化的持久化测试资源。 * 可直接运行 unittest(包括 trial)测试套件。 * 支持 Python 3.8+ 或 PyPy 3。 * 丰富的插件体系结构,拥有超过 1300 个外部插件和活跃的社区。 * **nose2:** * 是 unittest 框架的扩展,用于更轻松地发现、运行和报告测试。 * 它是旧版 nose 测试框架的后继者,提供了多种功能来改进和简化测试过程。 * **关键方面:** * **自动测试发现:** 自动搜索符合特定模式(通常以 `test` 开头或以 `.py` 结尾)的文件和目录来运行测试,无需手动指定。 * **插件:** 高度可扩展,支持插件来添加或修改功能。内置插件用于测试覆盖率、性能分析等,用户也可以编写自定义插件。 * **配置:** 可通过 `unittest.cfg` 文件进行配置,设置 nose2 及其插件的选项,方便管理测试设置。 * **测试输出:** 提供增强的测试输出和报告,支持多种格式,并比默认的 unittest runner 提供更详细的信息。 * **测试 Fixture:** 支持 unittest fixture(setup and teardown 方法),可在测试运行前准备环境并在测试后进行清理。 * **测试套件:** 可运行特定的测试套件,允许逻辑分组和批量运行测试。 * **并行测试:** 支持并行运行测试,尤其对于大型测试套件可以显著提高速度。 * **总体而言**,nose2 通过提供更强大、更灵活的测试发现、执行和报告功能来增强 unittest 框架,使其成为许多 Python 开发者的热门选择。 * **locust:** * 是一个开源负载测试工具,允许开发者模拟和测试 Web 应用程序的性能。 * 设计易于使用和扩展,适用于测试 Web 服务的可伸缩性和健壮性。 * **testinfra:** * 是一个用于验证基础设施状态和配置的测试框架。 * 特别适用于确保服务器配置正确以及基础设施即代码(IaC)的部署按预期运行。 本课程的代码示例均可在 GitHub 仓库中找到。

课程评论(0条)

课程详情

Welcome,This course is the cumulation of all the years of experience I have with python. My idea was to create a course that provides you with an anchor point into testing code you write from different aspects.The following popular modules are introduced and provided with real-world examples.- doctest- pytest- nose2- locust- testinfraAbout doctest. The doctest module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work exactly as shown. There are several common ways to use doctest:To check that a module's docstrings are up-to-date by verifying that all interactive examples still work as documented.To perform regression testing by verifying that interactive examples from a test file or a test object work as expected.To write tutorial documentation for a package, liberally illustrated with input-output examples. Depending on whether the examples or the expository text are emphasized, this has the flavor of "literate testing" or "executable documentation".About pytest. It helps you write better programs. The pytest framework makes it easy to write small, readable tests, and can scale to support complex functional testing.Features: Detailed info on failing assert statements (no need to remember self.assert* names)Auto-discovery of test modules and functionsModular fixtures for managing small or parametrized long-lived test resourcesCan run unittest (including trial) test suites out of the boxPython 3.8+ or PyPy 3Rich plugin architecture, with over 1300+ external plugins and thriving communityAbout nose2. The nose2 module in Python is a test runner that extends the built-in unittest framework to make it easier to discover, run, and report on tests. It is the successor to the older nose testing framework and provides a variety of features to improve and simplify the testing process. Here are some key aspects of nose2:Automatic Test Discovery: nose2 automatically discovers and runs tests by searching for files and directories that match a certain pattern (typically those that start with test or end with.py). This eliminates the need to manually specify test files.Plugins: nose2 is highly extensible and supports plugins that can add or modify functionality. There are built-in plugins for features like test coverage, profiling, and more, and users can write their own custom plugins.Configuration: It allows configuration via a unittest.cfg file, which can be used to set options for nose2 and its plugins. This makes it easy to manage test settings and preferences.Test Output: nose2 provides enhanced test output and reporting. It can output results in various formats and provides more detailed information compared to the default unittest runner.Test Fixtures: It supports unittest fixtures (setup and teardown methods), allowing you to prepare the environment before tests run and clean up afterward.Test Suites: nose2 can run specific test suites, allowing you to group tests logically and run them together.Parallel Testing: It supports running tests in parallel, which can significantly speed up the testing process, especially for large test suites.Overall, nose2 enhances the unittest framework by providing more powerful and flexible test discovery, execution, and reporting capabilities, making it a popular choice for many Python developers.About locust. The locust module in Python is an open-source load testing tool that allows developers to simulate and test the performance of web applications. It is designed to be easy to use and extendable, making it suitable for testing the scalability and robustness of web services. About testinfra. The testinfra module in Python is a testing framework used for verifying the state and configuration of infrastructure. It is particularly useful for ensuring that servers are configured correctly and that infrastructure-as-code (IaC) deployments are functioning as expected.The course is supported by a github repository where you will find all the demo examples.

课程标签

0人关注该课程

主题相关的课程