阅微草人的测试工作,伴随着初入社会的无奈艰辛彷徨,但是这些都会过去的,已经找到了自己的方向,正在努力中。学习像路飞那样的勇敢、自信、无畏、前进,真诚的伙伴。

【摘抄】Ten Concepts for Successful Automation Scripts

上一篇 / 下一篇  2008-09-17 10:13:26 / 个人分类:摘抄

51Testing软件测试网"W"l$|-r|2b;v,J

Share this link: http://sdtimes.com/link/32824

&wU`f(E GM0

y9tO7s:B9l1Ev0Ten Concepts for Successful Automation scrīpts 51Testing软件测试网&wE O,U`` aN
By Edward J. Correia 
1^_LM z:u0
k4^T.~*]0September 9, 2008 — There isn't much use in automating a testing process if the automation scrīpts can't be used again and again. The more such scrīpts have to be tweaked or modified to be applied to the latest revision, the more likely they are to end up in the trash. It pays to develop scrīpts that are easily maintained so that any necessary changes are minimal and benefit to the project is maximized.51Testing软件测试网 s"e2q/z${,F7mY
51Testing软件测试网/kkh,e\3Z|
"Most [people] think of automated testing as a way to record then play back various functions from an application, but this is just a small part of this type of testing," says Matthew Hoffman, manager of systems verification and validation at Concurrent Technologies, a software development services consultancy. He offers 10 things an automated tester can do to keep tests useful and free of major maintenance requirements.51Testing软件测试网 ^(FVK7]*j"M]Tie
51Testing软件测试网c}yJ&`R `
He says it's helpful for the automation team to have some software development experience. A basic understanding of programming concepts is helpful for tasks such as setting variables, using regular expressions, creating loops and extracting header data. 51Testing软件测试网TX];S At#`2E*w
51Testing软件测试网)x.`n7qXzT
It's also a good practice to plan out your test scenarios ahead of any automation activities. "It is crucial to design the tests before recording the scrīpts. Many testers will [also] examine the functional specifications and design tests to cover the requirements," he says. Useful questions an automated tester should ask when designing the scrīpts include:
n`&TaEJ V.tcY051Testing软件测试网*V_ y Va7z:Q2{7J

.v@N If'?z0y3m0
»
What areas of the application will be reused on each/several of the scrīpts (i.e., login and logout)?
»
Are there any variables that will be reused on each/several of the scrīpts (i.e., user name, password, hostname and port number)?

7?|S_F z*z0Organization of the tests is a key ingredient of successful test automation, Hoffman says, adding that test scrīpts should be organized with modularization in mind. "The scrīpts should be structured to parallel the flow of the functional areas of an application." For example, if your scrīpt is testing an invoicing system, the scrīpt might be organized with the following sections:
+s"R6e~*xF:p&WR0
'SG(Kv(W~0
»
Login
»
Create Invoice
»
Edit Invoice
»
Delete Invoice
»
Logout
51Testing软件测试网3bW:h6G|N6t
scrīpts should clean up the data created. "It is important to clear any data that was created by the automated tests," he says. Remnants of test data can wreak havoc for the development team and the functional testers, particularly when they're verifying system data. For example, if your test scrīpt creates an invoice, there should be a corresponding scrīpt that deletes the invoice when tests are done. "It is also useful to enable logging within the automated test tool to verify that information was created [and] deleted."51Testing软件测试网rFcBcz\5E

^.~;m%Y'cP9H.[0Be certain of your assertions. Assertions determine whether a test passes or fails, and they are critical components of any successful test scrīpt. They should be kept simple and used to validate individual program components, such as:
j9P%t4ak]&Y'S/XWg0
!k[A+xO]0
»
The page name displayed for each request
»
The correct fields being displayed
»
A message displayed for incorrect data
»
Correct text color (i.e., a required field might need red text)
»
The proper functions/buttons being enabled/disabled
»
Correct confirmation messages

o7B1C&e3kT2Q}g0scrīpts should test for negative scenarios. "The purpose of any type of testing is to break the system before the customer breaks it." Hoffman suggests using automated scrīpts to attempt scenarios that can break the system, such as entering bad data into forms, entering incorrect login information, submitting data and trying to navigate back to a previous page to re-enter duplicate data, and entering incorrect credit card information.51Testing软件测试网!F6hUJ w0hr8\2V

k$F:w)B-n Z }7Y/k0Tests should execute on various environments. Applications often are meant to run in alpha, beta and production environments, so each environment will need to be tested. scrīpts must be flexible enough to run in each of the various environments. Hoffman offers these suggestions for creating scrīpts that will execute on these environments:
E^z4e_3E_0
TzH)dS;a.[$m.i0
»
Use regular expressions when asserting specific data
»
Differentiate the environments by passing a variable with the alpha, beta or production URL at runtime
51Testing软件测试网!I!It&Y \
Use configuration management. The automated scrīpts are essentially development files, so basic configuration management practices should be applied to the process of creating and managing them. "The scrīpts should be in source control software at all times. The test team should develop a document that describes the deployment of the scrīpts within a development and production environment. The document should also consist of scrīpt development standards so each person on the team creates the scrīpts in the same manner."51Testing软件测试网&M8fD8u#Q)O

$gv6D"s6oGS*l0Schedule regular test runs. To ensure that a system is functioning correctly at all times, it can be beneficial to schedule automated tests on a regular basis. The scheduler can be set up to run when all users have logged off the system or in the early mornings before anyone has started their work.
s3kC*];r&mn+r G*l051Testing软件测试网!g5X%Z{:`!F
Report and distribute results. Results should be reported after the scheduled tests execute, and then sent to the development team for analysis. Not all scrīpt failures are due to faulty code. "Many times the scrīpts fail because of a network outage, change to the system or a scrīpt error. The automated test developer must determine what kind of error[s] are in the reports and communicate it with the team."51Testing软件测试网c2Pn-}#@

5?n*C&Y,c0Automated testing is more than a matter of record and playback. To give your automation project the greatest chance for success, it's important to apply consistent concepts—to organize, execute and report—to minimize scrīpt maintenance and maximize benefit.51Testing软件测试网l@"PFw1U9o
51Testing软件测试网 P$`"gyl _'?J
In October's issue of Software Test & Performance magazine, automation expert Elfriede Dustin describes some of the major problems that lead to automation project failure and offers sage advice on how to avoid them. For now, don't miss the September issue of Software Test & Performance magazine, available now for free download. This month's issue packs a .NET punch!51Testing软件测试网F#Fgk'E@3P"lS/L

6x1{8cJ6KOB051Testing软件测试网'JXpt7v1uL
Share this link: http://sdtimes.com/link/32824

TAG: 摘抄

 

评分:0

我来说两句

Open Toolbar