wuzhiguocarterblog.wuzhiguo.tech·Aug 25, 2024Google Test:从入门到高手Google Test(简称GTest)是一个由Google开发的C++测试框架,广泛用于单元测试。以下是从入门到高手的学习路径,涵盖基本使用到高级技巧。 一、入门阶段 安装与配置 安装Google Test库。 在CMake项目中集成Google Test,简单配置编译环境。 使用find_package(GTest)或手动编译Google Test源码。 编写简单测试 测试案例:使用TEST宏编写简单的测试案例。 断言(Assertions):学习EXPECT_EQ、ASS...System & Architecture DesignUnitTest
wuzhiguocarterblog.wuzhiguo.tech·Aug 7, 2024Google Test表格驱动测试最佳实践案例案例一:用列表组织测试用例 在使用 Google Test 进行表驱动测试时,遵循最佳实践可以确保测试代码的可读性、可维护性和扩展性。以下是一些最佳实践建议: 1. 组织测试数据 将测试数据和预期结果放在一个结构体或类中,以便于管理和扩展。 2. 使用 TestWithParam 和 INSTANTIATE_TEST_SUITE_P TestWithParam 可以让你轻松地将参数化测试与测试数据关联。确保使用最新的 Google Test 版本以利用其新功能。 3. 明确测试名称 使用 INS...System & Architecture DesignUnitTest
Jonathan Ifeanyijonaz.hashnode.dev·Oct 26, 2023Best Practices for Writing Effective Unit Tests in PythonTesting is a fundamental aspect of software development. Understanding the best practices for writing unit tests is crucial for any programmer, whether you're just starting or have a bit of coding experience under your belt. This Article is tailored ...5 likesUnitTest
Ananya Guptablogsbyananya.hashnode.dev·Oct 4, 2023Building a Python Boilerplate Function with Unit TestingWhen it comes to programming, we often find ourselves writing the same code snippets over and over again. These repetitive pieces of code are known as “boilerplate.” In this mini project, we’ll explore the boilerplate concept by creating a Python fun...27 readsboilerplate
Jared Atandijaredatandi.hashnode.dev·Oct 20, 2022Testing your code the easy wayPython testing is critical for software quality. Without tests, your code is prone to bugs and errors that can impact user experience. That’s why it’s important to know how to write tests in Python. In this article, we’ll walk through the basics of P...87 readsSE General KnowledgePython
Sunny Singh98sunny.hashnode.dev·Jul 31, 2022Writing first Angular test and moreThe goal of writing Automated testing is to increase the quality of software. Angular has 2 types of Unit tests: Isolated test- when we are trying to check the functionality of a single function. This means it is not dependent on any other function ...10 likes·45 readsunit test
Sunny Singh98sunny.hashnode.dev·Jul 30, 2022Writing First Unit test in JasmineNOTE: This is a continuation of Unit Testing-Introduction and Setup for Jasmine Some Terminologies to understand Before, we write the first unit test, we have to work on understanding some terminologies and naming conventions. We will be writing the ...jasmine
kapil Gargkapilg.hashnode.dev·Jun 30, 2020Self documenting unit testWhen you write unit test case with python unittest module and run the test, by default it prints the testcase name (module name)...status. test_is_even_number (test_math_util.TestMathUtil) ... ok -------------------------------------------------...Python 3