SilkTest的自动化测试框架和编码规范

这是我在公司上班写的,匆忙间写的,有些地方也没深究,但是大体上是没有问题的,因最近忙于毕业论文,会在后面抽时间review一下的。

SilkTest是Borland公司出品的一整套测试工具组件中的一个针对黑盒功能测试的自动化工具,关于它的介绍请去Borland的官网:SilkTest上查阅更多资料,SilkTest提供一个月的试用。

Overall<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Each automation tool has its own embedded language and file types. This character decides that different tools have different frameworks and code standards. Also we need to understand the tested system well, so that we can choose the right tool.

SilkTest Framework

The core file types in SilkTest are: .t file and .inc file. .t file includes all the test cases you designed, and .t file stores all the objects defined by SilkTest, which is similar with .jar file in Java. The diagram below shows the relationship between .inc file and .t file.

<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></path><lock aspectratio="t" v:ext="edit"></lock></shapetype><shape id="_x0000_i1025" style="WIDTH: 315.75pt; HEIGHT: 204pt" o:ole="" type="#_x0000_t75"><imagedata o:title="" src="file:///C:%5CDOCUME~1%5CJUSTIN~1%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.emz"></imagedata></shape>

Firstly, .inc file is invoked by .t file. So it’s clear that .inc file is the foundation. Then we should know what .inc file and .t file include. It’s helpful to understand this invoking relationship. From the diagram, it displays that .t file is just a set of test cases, and .inc file covers all the variables, controls and methods, which the related test cases need. So the exact things invoked by .t file are those necessary variables, controls and methods.

Now the key point of framework is how to deal with the relationship between .inc file and .t file. As we know, scripts should follow the well-designed manual test cases. So it seems like there is not too much work we need to do in .t file. Yes, it’s true to the level of framework.

So the framework design depends on how to design .inc file.

Structure 1: .t files basing on simple .inc files

Simple does not mean it’s not complex and easy to maintain. It only means the number of .inc files is not so many, maybe one, two, or three.

This structure only adapts to the software system which only has a main window with other popped-up dialog boxes derived from this main window. For example, Microsoft Office Excel is a typical one. Whatever you do in Excel, the main window always exists. So for simplicity, we define only one .inc file including all the variables, controls and methods.

Structure 2: .t files basing on multiple .inc files

Comparing to Structure 1, it’s easy to understand why we need Structure 2. Structure 2 is used in this kind of situation: Multiple main windows and not direct connections between these main windows. So it forces us to write or record related .inc files independently.

SilkTest Code Standard

Code standard has to consist with Framework closely, and embodies Framework clearly. Here are the standards we should focus on (Details on programming language grammar, syntax and coding style are not mentioned here.):

Structured:

All the .inc files and .t files should be placed systematically. The inner of each file also needs to be structured. Especially, methods in .inc files should be designed reasonable and reusable so that the work flow in .t files is clear and stable.

Fault-tolerant:

Running scripts automatically should not be terminated by errors caused by other errors. It’s also necessary to add enough codes to avoid failures in single test case.

Data-driven:

If the set of scripts can work smoothly, the next step is to separate mutable data from scripts. After this stage, the whole scripts will be converted to an independent scripts and testing data storing in a specific file. Between these two parts, we must write a stable method to get data from its source, or even write back the results of test cases.

<shape id="_x0000_i1026" style="WIDTH: 384pt; HEIGHT: 53.25pt" o:ole="" type="#_x0000_t75"><imagedata o:title="" src="file:///C:%5CDOCUME~1%5CJUSTIN~1%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image003.emz"></imagedata></shape>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值