软件测试技术_1

本文介绍了软件测试的基本概念,包括Bug的定义、软件测试与软件质量保证的关系,以及不同质量评估模型。同时,文章详细阐述了软件测试的原则,如不可能穷尽测试和测试应尽早启动,并探讨了多种测试分类,如黑盒测试、白盒测试、功能测试等。最后,文中对比了V模型、W模型、H模型和X模型的优缺点。

part01 绪论

1 什么是软件测试

软件=程序+文档,软件测试!=程序测试。
软件测试以是否满足需求为目标。
定义:使用人工或自动手段,来运行或测试某个系统的过程。其目的在于检验它是否满足规定的需求或弄清预期结果与实际结果之间的差别。

Bug:缺陷、失效、错误

程序员犯了一个错误(mistake)
=》错误在软件中表现为缺陷(fault)
=》运行带有缺陷的软件对会出现故障(error)
=》运行有缺陷的软件能观察到失效(fail)
(啥狗屁玩意儿)

2 软件测试与软件质量保证(SQA)

软件质量保证(Software Quality Assurance,SQA)活动是通过对软件产品有计划的进行评审和审计来验证软件是否合乎标准的系统工程,通过协调、审查和跟踪以获取有用信息,形成分析结果以指导软件过程。

两者之间的干系

理论上,测试作为软件生命周期的一部分,其过程也受到SQA监督;
实际上,许多名义上的SQA做着测试的工作,许多测试人员做着部分SQA的工作。
充分的测试不能保障软件产品质量,软件测试是软件产品高质量的必要非充分条件。

质量评估模型

产品质量:McCall 模型, Boehm 模型, ISO 9126 模型
过程质量: 软件能力成熟度模型 CMM ( Capability Maturity Model),国际标准过程模型 ISO 9000,软件过程改进和能力决断 SPICE ( Software Process Improvement and Capability Etermination)

3 软件测试的基本原则

软件测试工程的目标:尽可能早地找出软件缺陷,确保其得以修复。

  1. Zero bug 与Good Enough
  2. 不可能执行穷尽测试
  3. 测试应该尽早启动,尽早介入
  4. 软件测试应该追溯需求
  5. 缺陷存在群集现象
  6. 缺陷具有免疫性(杀虫剂悖论)
  7. 不存在缺陷的理论、测试无法显示潜伏的软件缺陷

4 软件测试的分类

从方法角度看:黑盒测试、白盒测试;静态测试、动态测试
• 黑盒测试可能是动态的(运行程序,只看输入和输出),也可能是静态的(不运行程序,只查看界面)
• 白盒测试可能是动态的(运行程序,分析代码结构),也可能是静态的(不运行程序,静态查看代码)

从目标角度看:功能测试、强壮性测试、性能测试、适用性测试、安全性测试、可靠性测试

从阶段角度看:单元测试、集成测试、系统测试、验收测试

  • 单元测试《详细设计》:一般和编码同步进行,主要采用白盒测试方法,设计测试用例(语句覆盖率达到100%,分支覆盖率达到85%),通常要编写驱动模块和桩模块。
  • 集成测试《概要设计》:主要目标是发现与接口有关的模块之间问题,两种集成方式:一次性集成方式和渐增式集成方式。
  • 系统测试《系统需求规格说明书》:主要由黑盒测试工程师进行,前期主测系统功能是否满足需求,后期主测系统运行性能是否满足需求,以及系统在不同的软硬件环境中的兼容性。
  • 验收测试:验收测试的目的是向未来的用户表明系统能够像预定要求那样工作,验证软件的功能和性能如同用户所合理期待的那样。
    在这里插入图片描述
  • 回归测试:软件进行版本迭代时,重新执行上个版本的测试用例,可以在任何阶段进行。
  • 冒烟测试:对西南本进行系统大规模的测试之前,先验证一下软件的基本功能是否实现。
  • 随机测试:所有的测试数据都是随机生成的。

5 软件测试的过程模型

V模型

需求分析= =》验收测试
规格说明= =》系统测试
概要设计= =》集成测试
详细设计= =》单元测试
在这里插入图片描述
局限性:测试是设计及编码之后的一个阶段,需求分析阶段隐藏的问题一直到后期的验收测试才被发现。

W模型

在这里插入图片描述
局限性:与V模型一样,软件开发和测试之间保持一种线性的前后关系,需要严格的质量,无法支持迭代、自发性以及变更调整。对于很多文档事后补充、或者根本没有文档的做法下,令人困惑。

H模型

软件测试是一个独立地流程,贯穿于整个生命周期,只要条件按成熟了就可以进行测试。
在这里插入图片描述

X模型

在自底向上的开发中,对于单独的程序片段要尽心分离的编码和测试,随后将代码单元组合集成,在集成的过程中启动探索性测试(未计划的特殊测试),最后将成品交付。
在这里插入图片描述

Python Testing Cookbook Paperback: 364 pages Publisher: Packt Publishing (May 17, 2011) Language: English ISBN-10: 1849514666 ISBN-13: 978-1849514668 Over 70 simple but incredibly effective recipes for taking control of automated testing using powerful Python testing tools Learn to write tests at every level using a variety of Python testing tools The first book to include detailed screenshots and recipes for using Jenkins continuous integration server (formerly known as Hudson) Explore innovative ways to introduce automated testing to legacy systems Written by Greg L. Turnquist – senior software engineer and author of Spring Python 1.1 Part of Packt’s Cookbook series: Each recipe is a carefully organized sequence of instructions to complete the task as efficiently as possible In Detail Are you looking at new ways to write better, more efficient tests? Are you struggling to add automated testing to your existing system? The Python unit testing framework, originally referred to as “PyUnit” and now known as unittest, is a framework that makes it easier for you to write automated test suites efficiently in Python. This book will show you exactly how to squeeze every ounce of value out of automated testing. The Python Testing Cookbook will empower you to write tests using lots of Python test tools, code samples, screenshots, and detailed explanations. By learning how and when to write tests at every level, you can vastly improve the quality of your code and your personal skill set. Packed with lots of test examples, this will become your go-to book for writing good tests. This practical cookbook covers lots of test styles including unit-level, test discovery, doctest, BDD, acceptance, smoke, and load testing. It will guide you to use popular Python tools effectively and discover how to write custom extensions. You will learn how to use popular continuous integration systems like Jenkins (formerly known as Hudson) and TeamCity to automatically test your code upon check in. This book explores Python’s built-in ability to run code found embedded in doc strings and also plugging in to popular web testing tools like Selenium. By the end of this book, you will be proficient in many test tactics and be ready to apply them to new applications as well as legacy ones. A practical guide, this cookbook will ensure you fully utilize Python testing tools to write tests efficiently. What you will learn from this book : Get started with the basics of writing automated unit tests and asserting results Use Nose to discover tests and build suites automatically Write Nose plugins that control what tests are discovered and how to produce test reports Add testable documentation to your code Filter out test noise, customize test reports, and tweak doctest’s to meet your needs Write testable stories using lots of tools including doctest, mocks, Lettuce, and Should DSL Get started with the basics of customer-oriented acceptance testing Test the web security of your application Configure Jenkins and TeamCity to run your test suite upon check-in Capture test coverage reports in lots of formats, and integrate with Jenkins and Nose Take the pulse of your system with a quick smoke test and overload your system to find its breaking points Add automated testing to an existing legacy system that isn’t test oriented Approach This cookbook is written as a collection of code recipes containing step-by-step directions on how to install or build different types of Python test tools to solve different problems. Each recipe contains explanations of how it works along with answers to common questions and cross references to other relevant recipes. The easy-to-understand recipe names make this a handy test reference book. Who this book is written for Python developers and programmers with a basic understanding of Python and Python testing will find this cookbook beneficial. It will build on that basic knowledge equipping you with the intermediate and advanced skills required to fully utilize the Python testing tools. Broken up into lots of small code recipes, you can read this book at your own pace, whatever your experience. No prior experience of automated testing is required.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值