首页 > 其他分享 >[Testing adn BDD] Introduction to Test and Behavior Driven Development

[Testing adn BDD] Introduction to Test and Behavior Driven Development

时间:2024-04-17 17:22:05浏览次数:26  
标签:Development BDD code Introduction testing system environment Testing Test

The Importance of Testing

The value of testing

"If it's worth building, it's worth testing. If it;s not worth testing, why are you wasting your time to workng on it?"

-- Scott Ambler, agiledate.org

Design principles for Apollo

  • Use a High-Level Language: Employing a higher-level language simplified calculations and reduced errors.

  • Divide into Jobs: Breaking down software into smaller tasks optimized memory usage, essential for systems with limited memory like the Apollo computer.

  • Restart on Failure: Instantly restarting a failed job ensured continuous operation, a practice still followed in modern systems like Kubernetes.

  • Checkpoint Good State: Saving and resuming from a known state minimized redundant calculations, a concept echoed in modern stateless container designs.

  • Hardware Monitors the Software: Hardware oversight prevented system hang-ups, a principle akin to preemptive multitasking in contemporary systems.

  • Send Telemetry: Continuous telemetry data provided real-time insights into system health, crucial for decision-making, a practice still vital in modern software monitoring.

You can only test what you know

Testing is essential for ensuring the functionality and reliability of software systems. The principles derived from historical examples like the Apollo Guidance System highlight the importance of testing in ensuring robustness and resilience to failure. Remember, you can only test what you know, emphasizing the necessity of comprehensive testing strategies.

Why Developers Don’t Test

  1. I already know it works: Developers may skip testing because they believe their code is functioning correctly. However, overlooking tests can lead to future issues when others work on the code, as they may inadvertently introduce bugs without proper tests to verify functionality.

  2. I don't write broken code!: Some developers may argue that they don't need to test because they write code without errors. However, the software ecosystem is dynamic, with constant updates and patches. Without tests, it's challenging to ensure compatibility with new libraries or patches, potentially leading to vulnerabilities or system failures.

  3. I have no time: Time constraints are often cited as a reason for skipping testing. However, investing time in writing tests upfront can save considerable debugging time in the future. Tests provide a safety net for refactoring code and adding new features, boosting productivity in the long run.

Why do we need to test?

Testing is crucial because:

  • Prevents future code breaks and compatibility issues: Tests help ensure that changes to code, libraries, or dependencies do not introduce unexpected bugs or system failures, maintaining stability and reliability.

  • Reduces overall development time: While writing tests may seem time-consuming initially, they ultimately streamline the development process by catching errors early and providing confidence for future modifications or additions.

  • Ensures that your code behaves as expected when others use it: In an open-source or collaborative environment, code may be reused in various contexts. Testing ensures that the code behaves predictably regardless of its application, fostering trust among developers and users alike.

Testing Levels and Release Cycle

Software Testing Levels:

  1. Unit tests:

    • Test individual units or components of a software system.
    • Verify that each unit performs as designed.
    • Focus on both "happy" paths (expected behavior) and "sad" paths (error handling).
    • Typically executed in a development environment or during continuous integration (CI).
  2. Integration Tests:

    • Combine individual units and test them as a group.
    • Expose flaws in the interaction between integrated units.
    • Evaluate how modules behave together with various inputs.
    • Often performed in a development environment or during Behavior Driven Development (BDD).
  3. System Tests:

    • Test the entire software process as a complete, integrated system.
    • Evaluate the system's compliance with specific requirements.
    • Verify that the entire system works together as expected.
    • Usually conducted in a staging or pre-production environment.
  4. Acceptance Tests:

    • Test the system for acceptability based on business requirements.
    • Assess whether the system is acceptable for delivery to end users.
    • Often performed by end users in an environment similar to or the same as the production environment.

Traditional Release Cycle:

  • Development: Developers perform unit testing and store code in a source code management (SCM) system like Git.

  • Build: Code artifacts are compiled, and further unit testing may be conducted in a build environment.

  • Package Repo: Built artifacts such as Java jar files, Python wheels, or Docker images are stored in a package repository.

  • Test, Stage, and Prod Phases:

    • Test: Build artifacts are deployed into testing environments for integration, performance, and compliance testing.
    • Stage: Testing environments become more like production, allowing for system testing and acceptance testing.
    • Prod: The final production environment where the fully tested and accepted software is deployed for end-user access.

Key Takeaways:

    • The software testing process includes four levels: Unit, Integration, System, and Acceptance.

    • Testing occurs at different levels throughout the phases of the traditional release cycle, starting from development and progressing through testing, staging, and production environments.

 

标签:Development,BDD,code,Introduction,testing,system,environment,Testing,Test
From: https://www.cnblogs.com/jbite9057/p/18141293

相关文章

  • MIT6.S081 - Lecture1: Introduction and Examples
    课程简介课程目标理解操作系统的设计和实现通过XV6操作系统动手实验,可以扩展或改进操作系统操作系统的目标Abstraction:对硬件进行抽象Multiplex:在多个应用程序之间共用硬件资源Isolation:隔离性,程序出现故障时,不同程序之间不能相互干扰Sharing:实现共享,如数据交互或协......
  • SystemVerilog -- 2.0 Data Types ~ Introduction
    SystemVerilogDataTypesSystemVerilog是Verilog的扩展,也用作HDL。Verilog具有和数据类型来描述硬件行为。由于硬件验证可能变的更加复杂和苛刻,Verilog中的数据类型不足以开发高效的测试平台和测试用例。因此,SystemVerilog通过添加更多类似C的数据类型和扩展Verilog,以......
  • SystemVerilog -- 1.1 Introduction ~ tb
    我们需要一个称为testbench的环境对设计运行任何类型的仿真。Whatisthepurposeofatestbench?Testbench允许我们通过仿真来验证设计的功能。它是一个容器,其中放置设计并使用不同的输入激励进行驱动。生成不同类型的输入刺激使用生成的激励驱动设计输入允许设计处理输......
  • GUI development with Rust and GTK4 阅读笔记
    简记这是我第二次从头开始阅读,有第一次的印象要容易不少。如果只关心具体的做法,而不思考为什么这样做,以及整体的框架,阅读的过程将会举步维艰。简略记录gtk-rs的书中提到的点。对同一个问题书中所演示了多种处理方法,而且跨度比较大,第一次阅读的时候经常出现忘记之前的内容。f......
  • Verification -- Introduction
    AISC设计流程由几个步骤组成,包括designspecification、designentry、designsynthesis、designverification、physicaldesignanddesignsign-off.Designverification(DV)通常是指使用仿真工具对设计进行功能验证的pre-siliconeffort。Whatisdigitaldesignverific......
  • 微软安全开发流程(Security Development Lifecycle, SDL)
    1.SDL简介SecurityDevelopmentLifecycle(SDL)是微软2004年提出的从安全角度指导软件开发过程的管理模式。SDL是一个安全保证的过程,其重点是软件开发,在开发的所有阶段都引入了安全和隐私的原则。SDL一直都是微软在全公司实施的强制性策略。2.SDL步骤SDL中的方法,试图从安全漏......
  • vue3配置使用环境变量.env.development
    参考:https://blog.csdn.net/perfect2011/article/details/1299308191.新建环境配置文件,根目录.env基础系统变量,无论何种环境,都可使用其中配置的值,其他环境中的变量会覆盖.env中的同名变量。.env.development开发环境.env.production生产环境.env.staging测试环境2.vue3使用vit......
  • 报错:react.development.js:1130 Uncaught Error: Objects are not valid as a React
      原因:是因为getControl我用了异步async的方法。而调用的时候,没有加上await导致的。 解决办法:加上await就可以了 ......
  • Operating System Concepts 9th: Chapter 1 Introduction
    Anoperatingsystemisaprogramthatmanagesacomputer’shardware.Italsoprovidesabasisforapplicationprogramsandactsasanintermediarybetweenthecomputeruserandthecomputerhardware.操作系统的定义:一个管理计算机硬件,并作为用户与硬件之间的中......
  • Lecture 10 Geometry 1 (Introduction)
    Lecture10Geometry1(Introduction)Examplesofgeometry几何的例子不同形状的几何光滑的曲面复杂的模型、位置摆放布料水滴城市(复杂在东西多)怎么存储怎么渲染这么大级别的东西离得远的情况下如何简化几何模型如何利用光线之间的连续性毛发微观几何树枝......