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

【摘抄】Ten Concepts for Successful Automation Scripts

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

7u/Z0[uU{^w0Share this link: http://sdtimes.com/link/32824

(w#h*m+U$[z!o0

:MY1o6I4j%YUmk0Ten Concepts for Successful Automation scrīpts 51Testing软件测试网vG;U-xaV!Y\
By Edward J. Correia 
#K/~5Z8o7fS bPaR051Testing软件测试网S7q/a*`V
September 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.
/H ~O)Sre Y0
3\'x M;e*Bn0"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.
'L @(@I$p2N z H0
.A?8DbvI0He 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软件测试网%W}*ky?i)K
51Testing软件测试网z0sT/k+H I*{;A,e
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:
g8Z9s#l-C.y%C0
y^ Xsa9y051Testing软件测试网#UsE }(? q-b

»
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)?

)m$m6F;v j0Organization 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:
9b;rH,mP hWJ[{051Testing软件测试网eo$a~1TpBYs
»
Login
»
Create Invoice
»
Edit Invoice
»
Delete Invoice
»
Logout
51Testing软件测试网&j8RoY K&D|+^\
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."
:S(` R2Z1J}0
L7P/emA;]~ K[9j0Be 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:
Jz uuX0
r_:d%Pq0
»
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

.?*aX%G3jFt0scrī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软件测试网c0k@&t ~

iATy,`0Tests 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:
9\W(m!N,TgD)@051Testing软件测试网P`[:W~X&[ V
»
Use regular expressions when asserting specific data
»
Differentiate the environments by passing a variable with the alpha, beta or production URL at runtime

.X vl2VSi[ X0Use 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软件测试网`8KXd1Z[

'W#n$t\5`QK*O~0Schedule 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.51Testing软件测试网"H Td)BTS&W7r!X
51Testing软件测试网z!G5Kj_8Z S
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."
ep2ki [(B9Xrm0
"Q{#]2o;G v2{0Automated 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软件测试网:s"\,@EQ

l1jD0J'O\0In 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软件测试网8MxfCk(j
51Testing软件测试网 mu6hB+s\X\ G1z
51Testing软件测试网n!f D"D'Vp"| E
Share this link: http://sdtimes.com/link/32824

TAG: 摘抄

 

评分:0

我来说两句

Open Toolbar