发布新日志

  • Verification and Vaildation 辨别

    2012-09-28 09:57:11

    Verification: Confirmation by examination and through provision of objective evidence that specified requirements havebeen fulfilled. [ISO 9000]

    验证:通过检查和提供客观证据来证实指定的需求是否已经满足。[ISO 9000]

    Validation: Confirmation by examination and through provision of objective evidence that
    the requirements for a specific intended use or application have been fulfilled. [ISO 9000]

    确认:通过检查和提供客观证据来证实特定目的功能或应用已经实现。[ISO 9000]

    辨析:验证(verification) 产品是否正确的按着设计文档实现功能。确认(validation) 产品是否正确的按着客户需求被实现功能。 也就是产品通过了验证测试但是不一定会通过确认测试。这也就是为什么要提早介入测试,让设计文档尽可能准确的符合需求文档的要求。需求和设计文档之间的Gap越小,两种测试就越可能得到相同的结果。

  • EDS -ISTQB-模拟题-Module1 错题解析

    2012-09-23 20:15:58

    1. In prioritising what to test, the most important objective is to:

    A. find as many faults as possible

    B. test high risk areas 

    C. obtain good test coverage 

    D. test whatever is easiest to test

     

    Answer: B

     

    3. A failure is:

    A. an incorrect step, process or data definition in a computer program 

    B. found in the software; the result of an error 

    C. departure from specified behavior 

    D. a human action that produces an incorrect result

     

    Answer: C

     

    5. What is the purpose of testing?

    A. to detect and prevent defects 

    B. to measure how closely the system conforms to its requirements 

    C. to provide manager with information about the progress of a project 

    D. all of the above answers are correct

     

    Answer: D

       

    6. Which of the following statements about Testing and Debugging is NOT correct?

    A. Debugging checks that the defect has been fixed correctly 

    B. Testing ensures that the fix does indeed resolve the failure 

    C. Testing checks that the defect has been fixed correctly 

    D. Debugging identifies the cause of a defect and repairs the code

     

    Answer: C

      

    8. When should testing begin?

    A. after construction

    B. after producing the first project deliverable

    C. after implementation

    D. whenever time permits

     

    Answer: B

  • Foundations Of Software Testing ISTQB Certification(3rd)

    2012-09-17 16:52:04

  • 关于FL考试的考题分布

    2012-09-11 11:01:26

    至郑文强老师的一封信:

    郑文强老师,您好!

    有幸在你的CSDN个人空间里获得了一些关于ISTQB的资料,对我的FL的考试非常有帮助,再次表达我的感谢之情。
    另外,我看到你的 “ISTQB FL初级认证系列01:ISTQB FL初级认证考试说明” 中,对FL考试的考题分布有详细的介绍,但是,内容应该是基于2007年的考纲的吧?
    因为,我发现知识点的基本还只限于K1,K2,K3. 在2011年的新考纲里有一个新的K4基本的知识点了,我在CSTQB的网上了找不类似的介绍,请问您是否能提供这方面的资料?或者能否在你百忙之中更新一下这个内容吗?

    非常感谢,

    您的读者
     
    郑老师的回复:
     
    你好:

    非常感谢你的来信,从心中可以看出你对ISTQB已经有相当的了解。ISTQB考证说明中FL的考题分布,确实是基于2007版本的。目前就一个内容有所更改,即一道K4的题目代替了原来K3的题目:白盒测试中的内容。因为CSTQB官方没有这个最新的更新,所以我也没有计划更新。从考试层面而言,白盒测试中的内容,你不用太关心,实际内容没有什么变化。

    有任何ISTQB方面的疑问,欢迎来信,或者访问我的个人网站:http://www.skyqa.com

    祝好
    郑文强
     
  • ISTQB - 模拟题错误解析

    2012-09-06 17:19:03

    1. (K1)  下列关于错误、缺陷和失效的观点正确的是:
    A)  人都会犯错误,因此在由人设计的程序也会引入缺陷;
    B)  所有的缺陷都会产生失效;
    C)  失效主要是由人的错误造成的,和环境条件没有关系;
    D)  当存在缺陷的代码被执行时,才可能引发软件错误。

    答案: 我选D, 但是答案是A

    解析:粗心没好好看题,答案D应该是“引发软件失效”,用排除法得到答案A。

    5. (K2)  下列关于不同的测试阶段的描述错误的是:
    A)  维护测试通常是为了验证开发过程发现的缺陷是否被正确修复。
    B)  组件测试的主要目标是尽可能的发现失效,从而识别和修正尽可能多的缺陷。
    C)  验收测试的主要目标是确认系统是否按照预期工作,是建立满足了需求的信心。
    D)  不同测试阶段,其测试目标是不同的。

    答案: 我选B, 但是答案是A

    解析:FL考纲2011版P14页:“维护测试通常是为了验证在开发过程中的软件变
    更是否引入新的缺陷”。 而P30页:“当发现和修改了一个缺陷后,应进行再测试以确定已经成功的修改了原来的缺陷,这称之为确认。”,这样看来答案A的叙述是错误的。

    7. (K2)  规划测试环境的搭建和确定测试需要的基础设施和工具属于下面的哪个活动?
    (A)  计划和控制
    (B)  分析和设计
    (C)  实现和执行
    (D)  评估出口准则和报告

    答案: 我选A, 但是答案是B

    解析:这个是被书“软件测试基础教程”的“2.2.1测试计划和控制”一节误导了,这节最后讲到了基础设施和测试工具需要开发的问题,就误认为A了。这部分内容在考纲P17页有很清楚的表述。

    8. A test team consistently finds between 90% and 95% of the defects present in the system under test. While the test manager understands that this is a good defect-detection percentage for her test team and industry, senior management and executives remain disappointed in the test group, saying that the test team misses too many bugs. Given that the users are generally happy with the system and that the failures which have occurred have generally been low impact,which of the following testing principles is most likely to help the test manager explain to these managers and executives why some defects are likely to be missed?
    a. Exhaustive testing is impossible
    b. Defect clustering
    c. Pesticide paradox
    d. Absence-of-errors fallacy

    答案: 我选B, 但是答案是A

    解析:这个题很容易被90%~95%迷惑,粗心就选择B了,但是题目里表达了,发现了绝大部分Defect,并且剩余的问题对用户影响不大,因此给管理者的解释告诉他们避免全部的问题是不可能的,做到把影响大的问题最大程度发现是有可能的。

  • 理性看待认证考试证书

    2012-09-04 13:01:20

    最近看到大家关于认证考试的一些看法的帖子,也有讨论考了证书能不能加工资的。 我打个比方,你想开车,必须考驾照,考了驾照,你就一定能多赚钱吗? 换个说法一个人他想开车喜欢开车,但是他知道必须先考驾照才能学会开车,保证自己的驾驶技术可以得到最初的认可,也许他以后想去赛车。。。

    想问认证的证书怎么样,要想问问自己怎么看待你正在从事的这份测试的职业。

    我也在考认证的证书,之所以从事测试工作7,8年了才考这个证书,是因为自己发现自己对测试理论的认识不系统不严谨,需要一个系统性的梳理自己的测试理论知识的系统性的时候了。 比如,自己也设计测试用例,也管理测试计划,系统的看过教程才发现,自己以前早就知道的“软件质量特征”,其实是设计测试用例和考虑测试计划的出发点,软件需要达到的功能性,稳定性等的特征,决定了你测试用例设计和管理测试计划的的中心和重点。在这之前,自己还一直都迷失在套用测试计划设计模板里(不知道模板考虑的出发点和如何自己去设计一些新的内容)。

    多考虑一些自己职业发展的问题,这对自己长远发展的大有裨益的,当然薪水的增加不仅和个人积累有关系,机遇也很重要。如果只一味考虑证书和薪水的关系,那从这个学习过程中个人能力的提升的程度也会大打折扣的。

  • ISTQB-FL-考纲-2007(蓝色)Vs.2011(黑色)

    2012-08-30 10:14:30

    The syllabus of ISTQB Foundation Level

    2007(Blue) Vs. 2011(Black)

     

    • K1: remember, recognize, recall;

    • K1: remember

     

    • K2: understand, explain, give reasons, compare, classify, categorize, give examples, summarize;

    • K2: understand

     

    • K3: apply, use.

    • K3: apply

     

    • K4: (No Exist)

    • K4: analyze

     

    1.  Fundamentals of Testing (K2)

     

    1.1 Why is testing necessary? (K2)

     

    LO-1.1.5 Recall the terms error, defect, fault, failure and corresponding terms mistake and bug. (K1)

     

    LO-1.1.5 Explain and compare the terms error, defect, fault, failure, and the corresponding terms mistake and bug, using examples (K2)

     

    1.2 What is testing? (K2)

     

    LO-1.2.2 Describe the purpose of testing in software development, maintenance and operations as a means to find defects, provide confidence and information, and prevent defects. (K2)

     

    LO-1.2.2 Provide examples for the objectives of testing in different phases of the software life cycle (K2)

     

    LO-1.2.3 (No Exist)

     

    LO-1.2.3 Differentiate testing from debugging (K2)

     

    2. Testing Throughout the Software Life Cycle (K2)

     

    2.1 Software development models (K2)

     

    LO-2.1.1 Understand the relationship between development, test activities and work products in the development life cycle, and give examples based on project and product characteristics and context (K2).

     

    LO-2.1.1 Explain the relationship between development, test activities and work products in the development life cycle, by giving examples using project and product type (K2).

     

    3. Static techniques (K2)

     

    3.1 Static techniques and the test process (K2)

     

    LO-3.1.3 Explain the difference between static and dynamic techniques. (K2)

    LO-3.1.4 Describe the objectives of static analysis and reviews and compare them to dynamic testing. (K2)

     

    LO-3.1.3 Explain the difference between static and dynamic techniques, considering objectives, types of defects to bee identified, and the role of these techniques within the software life cycle (K2) 

     

    3.3 Static analysis by tools (K2)

     

    LO-3.3.2 List typical benefits of static analysis. (K1)

     

    LO-3.3.2 Describe, using examples, the typical benefits of static analysis (K2)

     

    4. Test design techniques (K4) * (K3 --> K4)

     

    4.1 The test development process (K3) * (K2 --> K3)

     

    LO-4.1.3 Evaluate the quality of test cases. Do they:

    • show clear traceability to the requirements;

    • contain an expected result. (K2)

     

    LO-4.1.3 Evaluate the quality of test cases in terms of clear traceability to the requirements and expected results (K2)

     

    4.3 Specification-based or black-box techniques (K3)

     

    LO-4.3.1 Write test cases from given software models using the following test design techniques: (K3)

    • Equivalence partitioning;

    • Boundary value analysis;

    • Decision table testing;

    • State transition testing.

     

    LO-4.3.1Write test cases from given software models using equivalence partitioning, boundary value analysis, decision tables and state transition diagrams/tables (K3)

     

    LO-4.3.2 Understand the main purpose of each of the four techniques, what level and type of testing could use the technique, and how coverage may be measured. (K2)

     

    LO-4.3.2 Explain the main purpose of each of the four testing techniques, what level and type of testing could use thee technique, and how coverage may be measured (K2)

     

    LO-4.3.3 Understand the concept of use case testing and its benefits. (K2)

     

    LO-4.3.3 Explain the concept of use case testing and its benefits (K2)

     

    4.4 Structure-based or white-box techniques (K4) * (K3 --> K4)

     

    LO-4.4.2 Explain the concepts of statement and decision coverage, and understand that these concepts can also be used at other test levels than component testing (e.g. on business procedures at system level). (K2)

     

    O-4.4.2 Explain the concepts of statement and decision coverage, and give reasons why these concepts can also bee used at test levels other than component testing (e.g., on                business procedures at system level) (K2)

     

    LO-4.4.3 Write test cases from given control flows using the following test design techniques:

    • Statement testing;

    • Decision testing. (K3)

     

    LO-4.4.3 Write test cases from given control flows using statement and decision test design techniques (K3)

     

    LO-4.4.4 Assess statement and decision coverage for completeness. (K3)

     

    LO-4.4.4 Assess statement and decision coverage for completeness with respect to defined exit criteria. (K4)

     

    4.6 Choosing test techniques (K2)

     

    LO-4.6.1 List the factors that influence the selection of the appropriate test design technique for a particular kind of problem, such as the type of system, risk, customer requirements, models for use case modeling, requirements models or tester knowledge. (K2)

     

    LO-4.6.1 Classify test design techniques according to their fitness to a given context, for thee test basis, respective models and software characteristics (K2)

     

    5. Test management (K3)

     

    5.1 Test organization (K2)

     

    LO-5.1.2 List the benefits and drawbacks of independent testing within an organization. (K2)

     

    LO-5.1.2 Explain the benefits and drawbacks of independent testing within an organization (K2)

     

    5.2 Test planning and estimation (K3) * (K2 --> K3)

     

    5.3 Test progress monitoring and control (K2)

     

    LO-5.3.2 Understand and interpret test metrics for test reporting and test control (e.g. defects found and fixed, and tests passed and failed). (K2)

     

    LO-5.3.2 Explain and compare test metrics for test reporting and test control (e.g., defects found and fixed, and tests passed and failed) related to purpose and use (K2)

     

    6. Tool support for testing (K2)

     

    6.1 Types of test tool (K2)

     

    LO-6.1.1 Classify different types of test tools according to the test process activities. (K2)

     

    LO-6.1.1 Classify different types of test tools according to their purpose and to the activities of the fundamental test process and the software life cycle (K2)

     

    LO-6.1.2 Recognize tools that may help developers in their testing. (K1)

     

    LO-6.1 .2 Intentionally skipped

     

    LO-6.1.3 (No Exist)

     

    LO-6.1.3 Explain the term test tool and the purpose of tool support for testing (K2)

     

    6.2 Effective use of tools: potential benefits and risks (K2)

     

    LO-6.2.2 Recognize that test execution tools can have different scripting techniques, including data driven and keyword driven. (K1)

     

    LO-6.2.2 Remember special considerations for test execution tools, static analysis, and test management tools (K1)

     

    LO-6.3.2 State the goals of a proof-of-concept/piloting phase for tool evaluation. (K1)

     

    LO-6.3.2 State thee goals of a proof-of-concept for tool evaluation and a piloting phase for tool implementation (K1)

     

  • 再次为ISTQB-FL考试做准备

    2012-08-30 09:58:45

    在我家领导的催促下,本人再次为ISTQB-FL考试做准备,不参加培训,使用自己手上的现有资料:

    1. 以Foundations Of Software Testing ISTQB Certification(3rd)

    为主要教材(OReilly上刚刚购入电子版花了好多米...)

    2. 结合ISTQB的2011年的Syllabus和Glossary

    3. 参考书是《Software_Testing_Foundations_Third_Edition》,主要是它是结合考纲的还有习题,但是买最新版本的是Amazon上太贵也不方便。

    4. 可以再看看 EDS的ISTQB Testing Foundation 的Flash教程(内部资料哦)

    5. 在教程看的差不多了要试试网上买来的题库,不知道好不好,总算是能做个练习。

    6. 最后,花一大笔米去考试,如果不行的话那就杯具了,俺家领导可是给俺花了血本了。。。

  • 读书笔记-xUnit.Test.Patterns.Refactoring.Test.Code

    2011-03-08 16:26:27

    Chapter 1  A Brief Tour

    1. If we fi  nd that we really cannot make the minimal test strategy work on our project by using these patterns, we can fall back to the alternative patterns listed in the full descriptions of these patterns and in the other narratives.

    翻译:如果我们确实遇到了使用这些模式但是不能使这些最小测试策略在我们的项目中起作用的情况,那么我们就需要返回到这些模式的完整描述和其他一些叙述的地方,那里列出了一些替换的模式。

    2. I have laid out this simple strategy in five parts:
    • Development Process: How the process we use to develop the code
    affects our tests.

    • Customer Tests: The fi  rst tests we should write as the ultimate defi  ni-
    tion of “what done looks like.”

    • Unit Tests: The tests that help our design emerge incrementally and
    ensure that all our code is tested.

    • Design for Testability: The patterns that make our design easier to test,
    thereby reducing the cost of test automation.

    • Test Organization: How we can organize our Test Methods (page 348)
    and Testcase Classes (page 373).

    我简单的罗列了在五个部分中的简单的测试策略:
    1. 开发过程:我们使用开发代码的流程是如何影响我们的测试

    2.客户测试:是我们应该写的作为“应该做出什么样子”的最终定义的第一个测试

    3. 单元测试:是能够帮助增量式的形成设计并且确保所有的代码都是被测试过的测试

    4. 可测性设计:使我们的设计更容易被测试从而降低了测试自动化的成本

    5. 测试组织方法:我们应该如何组织测试方法和测试类

     

  • 基于Scrum的测试实践在Defect Closure项目的应用

    2010-11-17 20:43:19

     
    • 关于 Scrum
    • Defect Closure项目中的测试流程
    • 测试流程实现的先决条件
    • 测试过程过程分解
    • 测试中遇到的问题和解决方法讨论

     

  • 读书笔记-<<C++程序设计原理与实践>>

    2010-11-03 12:58:10

    第一部分 基本知识

    第3章 对象、类型和值

    1. 初始化和赋值的区别:初始化需要检查变量的类型描述;赋值则需要将旧址销毁再将新值存入变量。

     

  • (原创)使用类和xUnit模式实现GUI测试代码

    2010-09-21 12:53:57

     

    简述

    本文采用类对象的方式封装了项目的主要窗口的GUI对象, 大大方便了项目的主要窗口对象的调用和扩展。同时,也封装了GUI对象的检查点方法,使得测试代码逻辑进一步得到简化。另外,借鉴了xUnit 模式的设计方法, TestCaseTestSuit进行了分离, 方便了后续对测试代码的维护.

    动化测试的核心问题就是如何减少维护量,例如:我们应该使用对象库还是描述性编程?如果选择OR那么我们可以在每个ACTION中使用共享对象库或者本地对象库,那如果选择DP,可以有什么方式来实现吗?

    成本效益和可维护性是我们在做自动化测试中最为关注的,在此引出一个概念-GUI层扩展。这一概念经过的SOLMAR自动化专家组的分析和观察已被采纳,使用它就可以尽可能地提高代码重用性(通过使用面向对象的方法来提高效率,并分解出若干个抽象层且可维护性较高的自动化项目)。

    本文的思路是来源于QTP自动化测试的著名Web站点Advance QTPMeir Bar-Tal的一篇文章<<Implementing a GUI Layer with Classes>>. 这篇文章介绍了一种基于QTP的为为先进的自动化测试技术,本技术是由AdvancedQTP SOLMAR自动化测试专家组采纳的一组面向对象的实现技术中的一种。这种技术主要是把QTP描述性编程以及装载GUI对象的DICTIONARY对象通过业务驱动的方式来得到体现,最有价值的地方在于其对象识别的先发机制,可以有效的防止QTP在运行时识别对象出现卡住的现象,当对象出现不匹配时,能使测试顺利退出,并在报告中定位细节。有效的降低了测试的维护量并节省了自动化测试的时间。

     

    一.           GUI

    1.        封装GUI对象

    下面使用项目 CCConfirmDialogClass 窗口封装的GUI类做一个简单的介绍. CCConfirmDialogClass分为四个主要的部分:

    1)      对象类属性存取方法

    CCConfirmDialogClass内置一个Scripting.Dictionary 类型的m_htChildObjects成员, 它主要是用来存储GUI对象集合。

     

    2)      测试对象GUI界面控件对象层

    在类对象初始化中利用Scripting.Dictionary 容器对象,把GUI控件对象层上的对象封装起来,直接通过关键字在字典对象中定位对象,并针对对象进行操作来达成关键字字典对象驱动。

     

    3)      测试对象初始化检查公共函数

    类对象在运行时需要很多公共行为的函数, 比如IsInitialized函数判别GUI对象是否已经被正确的被加载,防止测试对象发生变化以后,与对象库中的对象无法匹配时测试流程会被中断导致超时错误信息,这样的情况会导致在自动化测试中浪费无谓的时间,因此使用工具函数IsContextLoaded函数检查GUI层中所有对象的是否已经存在并且把结果进行返回。其实这个函数的使用的时候并不是这么理想,有部分对象也在这个GUI层里但是并不是可见的,用这个方法只能检查始终是可见的对象,因此,稍后会讨论对于这种情况的解决方法。

     

    4)      业务逻辑函数

    CCConfirmDialog的主要业务逻辑行为就是对将要执行的行为回答”YES”或是“NO”。业务行为函数封装了采用关键字对测试对象访问的方法, 提供了方法调用的易用性和可维护性。

    代码示例如下图所示:

     


    2.        使用GUI对象

    GUI对象的实例采用了对象工厂方法实例化一个全局变量,供调用的其他GUI类或者测试逻辑中使用。

     

    GUI对象实例调用的形式如下图所示:

    CCClassFactory 方法有三个参数:

    ·        strClassType: 需要创建的GUI类名

    ·        objObject:对象实例变量

    ·        byval strObjec:对象实例变量名称

     

    CCClassFactory方法使用类单例模式(Singleton Pattern)实现,避免了GUI对象实例被多次引用时对象重复创建。

     

    3.        封装复杂GUI对象

    项目中有一些GUI对象较为复杂,比如一个GUI对象里包含多个子GUI对象,比如项目的 Destination Profile Configuration 窗口:


     

    因此,将Destination Profile ConfigurationGUI类分解为三个GUI子类:

    由此就可以分别将GUI对象和对于的业务逻辑封装在不同的子类中,而公共的GUI对象, 比如 Turn Edit On对象就封装在Destination Profile Configuration窗口GUI类中,这样很好的提升了代码的复用性。

    4.        简化测试执行流程

    通过GUI对象的封装,对测试执行流程进行了有效的简化,并且对代码的可读性也有了显著的改善。下面是一个Add Destination Profile 测试的例子。

     

    二.           检查点类

    既然通过对GUI对象的封装可以简化了测试执行的流程,能不能将这种方法推广到测试检查流程呢?检查点的流程和测试执行流程既有关联由于区别,通常情况下需要重复部分测试流程,但是也有不同的附加流程,比如在Patient Input的检查流程需要对已经录入的Patient记录进行检索,然后再查看录入的内容,因此使用对GUI对象的封装方法,也对检查点对象使用的GUI对象和检查逻辑进行封装。下面是一个检查 Add Destination Profile的例子:

    由此简化的测试执行流程和检查流程如下图所示:

     

    三.           使用xUnit Pattern 重构测试代码

    1.        断言(Assert

    断言是xUnit的最大特色之一,简化的调用方式使得嵌入在代码逻辑内的检查点既简洁又明确当前的检查类型和目标。封装一个Assert Class能够很好的简化测试流程,而且可以重构一些不明确的测试检查点。

    Assert Class 提供一些检查方法,比如assertEquals(检查两个变量相等),assertTrue(检查变量是否为真)等。

    虽然我们模仿了xUnit的断言,但是也不能一味的照搬,事实上与白盒测试不同的是基于GUI测试的检查点不仅仅需要检查结果,还需要通过检查控制测试流程是否进行下去,比如某个窗口不存在时就需要报错,然后中断测试流程执行下一个测试。xUnit的断言不是基于GUI的并不需要考虑这个问题。因此,必须对测试检查点进行分类实现。从检查以后产生的执行结果,我将检查点分为控制点(Control Point)和观察点(Observation Point)。观察点控制点只做值的检查,在检查成功或失败以后输出相应日志;控制点值的检查,在检查失败以后输出失败的日志,并且终止程序的执行。当然,这种划分不是绝对的,在有需要的情况下可以进一步扩展不同的检查点类型。

    由此,assertEqualsassertTrue 分类为两组检查点方法:assertCPEqualsassertCPTrueassertOPEquals assertOPTrue

    采用断言方法,测试的执行和检查可以进一步的被重构:

     

    在使用VBScript实现断言过程中,由于VBScript并不提供支持try-catch的异常抛出和捕捉处理机制。但是通过VBScript提供的on error resume next on error goto 0机制来实现断言机制。实现的大致过程如下:

    2.        SetUp TearDown

    使用SetUpTearDown方法可以将测试的前置条件(Prerequisite 后置条件(Restoration)进行有效的封装,重构以后的测试代码显的更加有条理和边界分明。比如,使用指定的用户登录系统是一个常见的前置条件。

    3.        TestSuite

    对于一组测试用例采用TestSuite的方式进行组织。与TestCaseSetUpTearDown方法类似,也可以采用同样的方法将更高层的公共前置条件和后置条件进行重构。下面是一个简单的例子:

     

     

     

    四.           结束语

    通过此次实践,我们找到了一种提高测试代码复用性的方法,虽然使用的效果还不是最为理想的,但是随着宿主语言对OO的支持的改进,这种思想和方面必将成为自动化测试发展的方向。

  • (原创) 基于Daily Build安装包的自动化测试流程在项目中的应用

    2010-09-21 12:45:13

    一.  前言

    Continuous Integration(持续集成)这个术语源自 XP(极限编程)的一个最佳实践,随着XP 社区在近几年的壮大,XP 的很多实践得到了广泛的推广,持续集成就是其中之一。事实上, 持续集成并不是一个全新的概念,在这个术语出现之前,Daily Build(日创建) ,他们的主要区别就在于实施的频率上,随着 XP 社区的大师级人物 Martin Fowler的一篇《Continuous Integration》正式为其正名,持续集成这个术语就越来越多地出现在原来Daily Build出现的位置。

    Paul M. DuvallCI实践的经典著作《Continuous Integration: Improving Software Quality and Reducing Risk》中对测试实践方面, 主要强调的是基于xUnit的自动化单元测试, 并没有对如何进行基于安装包的自动化测试流程实践进行描述。

    目前多数得对Daily Build的测试只能进行单元测试, 无法满足对安装包进行功能测试要求, 因此, 笔者在参与一个项目时, 为了解决实现对Daily Build 产生的安装包进行自动的安装部署之后的自动化测试的问题, 设计和实现了一个自动化测试的流程。

     

    二.  测试流程设计

    由于本项目是基于定制的Window Xpe的软件系统, 通过Ghost方式恢复初始安装系统是一个既简单又有效的手段。另外一方面, 为了能够实现自动运行功能测试用例, 就必须能够自动安装部署ATU和运行自动化测试用例所需的工具软件和环境变量。针对这两个关键问题我们设计了以下的主要步骤:

    1. Download Install package from remote server*
    2. Re-ghost test machine automatically
    3. Install CCPlatform. via QTP Script
    4. Build Test Environment for Running Test Script
    5. Run Test Script. Automatically
    6. Upload logs to remote server

    *: 目前公司有两个网络环境: 办公室网络和实验室网络. Daily Build Install Package 是放置在办公室网络里, Daily Build测试环境是在实验室网络里. 根据公司的IT Policy, 实验室网络仅能访问办公室网络指的服务器的特点目录.  因此, 在进行测试环境的部署前需要和公司IT和配置管理员联系获取可以访问的服务器地址和权限.

    详细步骤如下图所示:

    三.  关键技术实现

    1.      Re-Ghost Automatically

    为了确保测试环境的干净与测试结果的可靠性, 在每次运行自动化测试之前,对机器环境进行一次镜像恢复, 这样可以在最大程度上减少多次运行测试用例对环境的影响. 测试环境需要在一个稳定的可重复执行的restore process. 在恢复过程中,我们可以参考BaseImage的做法.将固定的公用程序打包到一个自定义的Ghost Image, 进行恢复.

    具体问题如下:

    a.       Ghost 运行环境

    目前系统是工作在Windows XPE 环境下, 一个稳定且可重复执行的过程的起点必然是在Windows XPE, 但是BaseImage, Ghost的运行环境是在Dos 6.0+ , 所以测试机必须同时具备两种环境. 一种是Windows XPE, 另一种是Dos 6.0+. 同时又要保证改两种环境是可启动状态.

    通过查阅MSDN, 以及参考Windows XPE 启动过程, 最终决定双环境启动流程如下:

     

    其中GRLDR, DOS6.0 是附加于boot.ini的第二启动项, 编辑 boot.ini 如下:


    [boot loader]

    timeout=5

    default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

    [operating systems]

    multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Embedded" /fastdetect /NoExecute=OptIn /3GB /USERVA=2700

    C:\grldr="Daily Build Env"


    通过查询Ghost 11 说明文档, 在当前的Ghost环境中, Ghost能识别NTFS分区, 按照[硬盘编号]:[分区编号] 方式来识别NTFS分区, 例如: 1:1\CCBACKUP 表示第一个硬盘第一个分区下的CCBACKUP 目录. 因此确定GRLDR工作流为:

     

    实现过程如下:

     

                                                                              i.      创建并编辑GRLDR
    其中GRLDR中使用16进制编辑器修改为:

     

    find --set-root --ignore-floppies --ignore-cd /BD5NEW.img

    map --mem /BD5NEW.img (fd0)

    map --hook

    chainloader (fd0)+1

    rootnoverify (fd0)

     

                                                                            ii.      创建DOS启动镜像
    制作一张2.88MBDos6.0启动盘命名为BD5NEW.img:

                                                                          iii.      修改DOS启动配置文件运行指定命令
    修改Config.sys :

    [menu]

    menuitem=RESTORE, Start recover from an image.

    menuitem=BACKUP, Start backup to an image.

    menuitem=CUSTOM, Custom mode for Ghost.

    menudefault=RESTORE,3

    menucolor=7,0

     

    [RESTORE]

    device=himem.sys /testmem:off

     

    [BACKUP]

    device=himem.sys /testmem:off

     

    [CUSTOM]

    device=himem.sys /testmem:off

     

    [COMMON]

    files=10

    buffers=10

    dos=high,umb

    stacks=9,256

    devicehigh=ramdrive.sys /E 2048

    lastdrive=z

     

    修改Autoexec.bat
    A:\Smartdrv.exe /x

    IF "%config%"=="BACKUP" GOTO BACKUP

    IF "%config%"=="CUSTOM" GOTO CUSTOM

    A:\ghost.exe -clone,mode=pload,src=2:1\ccbackup\ccbackup.gho:1,dst=1:1 -sure –rb

                      在将上述文件放到C盘根目录下, 双环境就创建完毕.

     

    b.      运行环境之间的切换
     一个稳定可重复执行的过程同时也要求测试机可以对两种环境进行可控的切换. 包含从Windows XPE Dos6.0+, Dos6.0+ Windows XPE 的全自动可编程的逻辑过程.

     

    经过查询MSDN, 微软提供一个启动菜单编辑工具bootcfg.exe

     

    bootcfg.exe /Timeout 5

    bootcfg.exe /default /ID 2

    shutdown –r –t 1000

     

    这样当运行以上批处理命令, 计算机即可重启,并进入Dos环境, 为自动分区恢复的前提.


     

     

    2.      Auto-install Package

    由于需要进行功能性测试, 因此需要将安装包自动进行安装部署. 对于安装过程的控制, 采用QTP脚本自动运行和控制安装过程,具有可以对不同版本和形式的安装包进行可监控和参数配置处理.

    项目是一个比较复杂的安装过程, 在安装过程中需要调用很多不同的第三方安装程序或者其他系统组件安装包, 比如JRE, MSVC++ Redistribution, Eclipse, MIM等等. 需要控制安装过程就需要对不同的安装界面进行识别和控制,具体的问题如下:

    ·         Processing Dialog

    在使用QTPCC的安装过程控制时, 经常遇到一些如下图所示的Processing Wait Window 窗口. 这类窗口控制的难点是无法准确的预计这个窗口什么时候关闭, 然后进行下一步处理.

     

     

    笔者通过对使用UI 对象的WaitProperty方法扩展了Window的方法WaitPropertyUntilNotExistWaitPropertyUntilExist"实现了对Processing Wait Window的准确处理,  调用的示例代码:

    其中, WaitPropertyUntilNotExist(“visible”, “True”)代表的含义是当对象的visual属性值为True时开始等待直到它不存在.

    其中, WaitPropertyUntilExist(“visible”, “True”)代表的含义是一直等待到对象的visual属性值为True.

     

     

    实现的VBScript的代码如下:

     

     

    ·         Operate Command Line Window

    由于项目安装过程中调用了很多的脚步文件, 因此经常会遇到处理Command Window的情况, 比如, 按装Eclipse的组件的时候, 需要在这个窗口出现的时候对窗口做一个Press Key的动作. 处理这样的窗口主要的问题由两个: 1). 如何识别Command Line Window窗口需要输入动作; 2). 如何对Command Line Window进行输入动作.

     

    解决以上的问题主要的方法就是通过UI对象的GetVisibleText方法获取特征文本,然后调用 UI对象的Type方法进行输入动作, 调用的示例代码:

     

    实现的VBScript的代码如下:

     

     

    3.      Log Mechanism

     

    由于在整个自动化测试流程是分为几个不同的阶段有不同的程序控制调用完成的, 任何一个部分都有可能出现问题, 因此为了方便的追溯和解决问题, 每执行的部分都提供了统一格式的Log信息. 在执行完毕, <SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'T

  • Open2Test Framework

    2010-07-29 14:39:23

    而然在网络上搜索到了Open2Test Framework, 这个是基于KeyWord的开源测试框架, 支持很多的测试工具:QTP,TP,SkillTest,Selenium...

    详细的资料参考这个网站 http://www.open2test.org/index.html 吧!

    我所要说的是这个框架的问题:

    1. 没有很好的学习的例子,上手比较慢

    2. 代码中有很多错误

    3. 较难调试

    4. 编写测试也比较困难

    这是目前发现的比较大问题的问题, 前两个问题, 我在熟悉过程中把他们逐步解决,然后共享出来给大家, 后面两个问题只有开发一个好的工具能够对他们进行解决.

  • QTP Unplugged -SourceCode

    2010-05-13 12:19:54

    QTP Unplugged -SourceCode


    我通过国内的一个代理网站买了这本书, 内容还是比较实用的, 特别是本书提供的工具代码,我已经在最近的项目里多次获益了, 所以拿出来共享给大家!

    To 版主: 如果顶的人多的话,希望放入精华贴里让更多人受益, 谢谢!




    QuickTest Professional Unplugged

    By Tarun Lalwani (Author)

    List Price: $49.99 + S/H

    Current Price: Click here to see buying options

    Pages: 442, Size: 8.5″ X 11″

    Available in Book stores Also

    HP QuickTest Professional is a functional test automation tool. It supports a Record and Playback framework out of the box, where we can record and capture our interactions with the application under test
    and then replay those actions later. With this book you will learn

    Basic concepts of QTP
    Working without Object repository using Descriptive Programming
    Advanced concepts of QTP
    Working with external tools Microsoft Word, Outlook, Excel
    Integrating QTP Scripts with Quality Center
    Real life Automation problems and their solutions

  • 为ISTQB FL 考试准备

    2010-01-28 13:01:35

    ISTQB FL  - > ISTQB AL -> ISTQB EL

    慢慢考吧, 按着这个发展下去,年纪一大把了 再不有点可以拿出手的东西 咋整昵

  • 开发自己的GUI 测试工具!

    2007-01-09 14:46:19

    Effective GUI Test Automation: Developing an Automated GUI Testing Tool - By Kanglin Li and Mengqi Wu
Open Toolbar