its in the way that you use it

Upload: waqas-murtaza

Post on 04-Jun-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Its in the Way That You Use It

    1/3

    eptember 2008 $9.95 www.StickyMinds.com

    e Print Companion to

    GPS OPTIONALNavigating

    acceptance test-driven development

    HIGH HOPES

    Building trust onyour team

  • 8/13/2019 Its in the Way That You Use It

    2/320 BETTER SOFTWARE SEPTEMBER 2008 www.StickyMinds.com

    Test Connection

    Its in the Way that You Use Itby Michael Bolton

    People sometimes ask me what my fa-vorite test tool is, and my answer often

    confuses them. They seem to expect me

    to name a program that automates the

    operation of an application, makes some

    process more repeatable, or allows a

    machine to drive as quickly as possible

    through an application. But if you think

    driving is merely about getting from

    one point to another, ask a New York

    cabbie.

    Rapid testers dont think of test auto-

    mation merely as something that controlsa program and checks for some expected

    result. Instead, we think of test automa-

    tion as any useof tools to support testing.

    So my favorite test tool changes from

    moment to moment, but its often (drum

    roll) my text editor. For years, Ive used

    an editor called TextPad (see the Sticky

    Notes for a link). Im not claiming that

    its the best editor available, but its my

    favorite. There are plenty of other text

    editors, and whichever one you use, if

    youre happy with it, I am, too. So whatdo I use a text editor for?

    Writing. A lot of my work as a tester

    involves creating and editing texttaking

    notes, editing text, creating Fitnesse ta-

    bles, building Web pages, or writing ar-

    ticles like this one. With my text editor,

    I can do these things efficiently without

    extra overhead like the tables, format-

    ting and layout tools, styles, and thesau-

    ruses in sophisticated word processors.

    These extra features sometimes distract

    me or entice me to use them needlessly.As Marshall McLuhan said, We shape

    our tools, and thereafter our tools shape

    us [1]. I sometimes use a text editor to

    emphasize to myself that Im working

    on something temporary or preliminary.

    Thats not to say that a text file is never

    important; a commercial software com-

    pany that I worked for used to track

    bugs and feature suggestions by using a

    plain old ASCII text document. For us,

    the cost and overhead of an elaborate

    test management tool wasnt worth it

    when ideas could be captured concisely,

    compactly, and sufficiently in text.

    Programming. Good text editors sup-

    port programming by providing syntax

    highlighting, which recognizes the pro-

    gramming language that Im using and

    changes the color or font of keywords,

    symbols, and variables to make them

    more distinguishable. This improvesreadability and provides some cognitive

    hints to alert me when Im making a mis-

    take. More sophisticated programming

    environments automatically add closing

    parentheses, braces, or brackets when I

    type the opening symbol; provide con-

    text-sensitive help for the languages and

    libraries that Im using; and offer very

    sophisticated ways to map and model

    larger programs. When Im working on

    a large project, I find these features es-

    sential, but for a quick-and-dirty throw-away script, a good text editor is just

    fine.

    Cutting and pasting. Unlike Notepad,

    TextPad can mark blocks of text in col-

    umns, which allows me to open a file

    thats organized as a table, grab specific

    blocks in columns, and manipulate them

    or copy them to another program. This

    is often handy in combination with com-

    mand line redirection to supply input

    from a file or output from a program to

    a text file. In Windows, its also possibleto extend the virtual size of the com-

    mand window, copy output from pro-

    grams, and paste it into a text editor for

    processing.

    Data generation. I often use a testing

    technique called an input constraint at-

    tackhurling huge amounts of text at

    an input field to see whether the program

    protects itself from buffer overflows that

    could compromise security or stability.To generate data quickly, I type ten char-

    acters and then hit Ctrl-A (select all),

    Ctrl-C (copy to the clipboard), and then

    Ctrl-V ten times (paste ten copies). Now

    I have a file of one hundred characters.

    Then I hit Ctrl-A, Ctrl-C, and Ctrl V ten

    times again; now I have a thousand char-

    acters. Repeat that cycle a few times with

    a final Ctrl-A, Ctrl-C, and Ctrl-V, and I

    have a million or ten million characters

    on the clipboard, suitable for pasting

    into an input field, an application, or aWeb page. Try it! The results are often

    fascinatingdata corruption, strange

    behavior, or a crash. Danny Faught and

    James Bachs PerlClip tool [2] has more

    features for this task, but a text editor

    will do many useful things in a pinch.

    Searching and replacing. Sometimes

    Im looking for words, strings of words,

    or patterns of characters inside log

    files, Web pages, XML pages, comma-

    delimited files, or binary files. Some-

    times I want to replace strings of textwith something else, or delete markup

    ISTOCKPHOTO

  • 8/13/2019 Its in the Way That You Use It

    3/3www.StickyMinds.com SEPTEMBER 2008 BETTER SOFTWARE

    so t at I can ocus on t e text. To assist

    wit t ese tas s, etter text e itors in-

    c u e support or regu ar expressions

    power u orms o notation or see ing,

    matc ing, extracting, or rep acing pat-

    terns in text. See Je Frie s aster ng

    egu ar xpress ons .

    Learning. T e Per , Pyt on, an Ru y

    scripting anguages provi e power u

    support or regu ar expressions, ut it

    can e ar to appreciate t eir va ue

    unti youve earne to use t em we

    enoug to per orm your rst mirac e.

    More comp ex regu ar expressions can

    e ar to earn w t out v sua ee

    ac an recovera ty. s ng t e text

    e itor to step t roug pattern matc ing

    an su stitution, seeing c anges in t e

    text in rea time, an eing a e to press

    t e Un o ey e pe to acce erate my

    earning.

    Data inspection. W en I nee to earn

    somet ing a out a eits content or

    ormat o ten start nvest gat ng y

    open ng t n a text e tor. m g t see a

    ea er t at gives me c ues, ata in c ear

    text, or repeate patterns o strings or

    an s. I o ten scro t roug a og e

    very quic y, using a e ocuse per-

    spective to i enti y patterns o output

    or ramatic i erences rom t e norm.

    (We ca t is in testing or using a

    n orac e. ee t e t c y otes or

    more in ormation.) I can a so use t e

    e itor to e ete or c ange c aracters as

    a quic way to mo i y a c ean ata e

    to see ow a program an es e cor-

    rupt on.

    My co eagues an I sometimes use

    our e itors or t ings t at t eir pu -

    is ers mig t not ave expecte . W en I

    try to pour a ot o ata nto an nput

    e , an t e input e truncates t e

    excess, I copy t e e an paste it intot e e itor to get a wor or c aracter

    count rig t away. I o ten use text es as

    a ac up mec anism w en Im entering

    text into a We page. Jon Bac says t at

    e uses text es as onger-term, sa er

    storage or t e c p oar . e ot use

    text e tors to pee t e ormatt ng o

    ric text w en were pasting arge vo -

    umes o text to isjointe ce s in an

    Exce e. James Bac once programme

    is text e itor to remin im to ta e

    testing notes every ew minutes. W en Iorget t e syntax or a tag or a specia

    c aracter in HTML, or t e c aracter as-

    sociate wit a particu ar ASCII co e,

    my text e itor is t e an iest an astest

    re erence.

    ere are severa po nts to a t s.

    First, t e simp er t e too , t e more ex-

    i e, a apta e, an use u it mig t e.

    T in o t e i erence etween a 50

    Swiss Army ni e an a 15,000 com-

    puter-contro e ta e saw. Secon , i e

    qua ity, purpose is not somet ing

    in erent in a pro uct. Purpose is a re-

    ations ip [4] etween t e pro uct an

    t e person w o s putt ng t to some use.

    T ir , some o t ose purposes are in-

    ten e y t e esigners an a opte y

    t e users, ut nove an surprising pur-

    poses may emerge as we use a pro uct

    or as we test t.

    As testers, were usua y as e to e-

    en t e va ue o a pro uct y n ing

    mportant pro ems w t respect to

    ts nten e purpose. owever, we

    t in o our pro ucts as too s t at i -

    erent peop e wi use in i erent ways,

    a va ue y iscovering pur-

    poses t at avent yet een recognize .

    For examp e, i we t in o a test too

    as any too t at supports testing, even

    t e um e text e itor mig t ecome a

    power u test too .{end}

    REFERENCES:1] McLuhan, Marshall. Understanding Media.

    The MIT Press,1994.

    2] www.satisfice.com/tools/perlclip.zip

    3] Friedl, Jeffrey. Mastering Regular Expres-

    sions. OReilly Media, Inc., 2006.

    4] Weinberg, Gerald M. ntroduction to General

    Systems Thinking. Dorset House Publishing

    Company, Inc., 2001.

    Test Connection

    For more on the following topics go towww.StickyMinds.com/bettersoftware.n TextPadn Blink testing

    Sticky Notes

    StickyMinds.com