• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Satisfice, Inc.

Software Testing for Serious People

  • Home
  • About
    • Privacy Policy
  • Methodology
    • Exploratory Testing
    • Reasons to Repeat Tests
  • Consulting
    • Ways to Engage Our Services
  • Classes
    • James Bach’s Public Test Consulting
    • Testimonials
    • RST Courses Offered
    • Rapid Software Testing Explored
    • Rapid Software Testing Applied
    • Rapid Software Testing Managed
    • Rapid Software Testing Coached
    • Rapid Software Testing Focused: Risk
    • Rapid Software Testing Focused: Strategy
  • Schedule
  • Blog
  • Contact
  • Resources
    • Downloads
    • Bibliography: Exploratory Process
    • Bibliography: Risk Analysis
    • Bibliography: Coaching
    • Bibliography: Usability
    • Bibliography: My Stuff From IEEE Computer and IEEE Software Magazines
    • Bibliography: The Sociology of Harry Collins

Counterstrings: Self-Describing Test Data

I was at a conference some months ago when Danny Faught showed me a Perl package for manipulating the Windows clipboard. I turned it into a little tool for helping me test text fields.

It’s called PerlClip. Feel free to download it. You don’t need Perl to run it.

One of the things PerlClip does is allow you to produce what I call “counterstrings”. A counterstring is a graduated string of arbitrary length. No matter where you are in the string, you always know the character position. This comes in handy when you are pasting huge strings into fields and they get truncated at a certain point. You want to know how many characters that is.

Here is a 35 character counterstring:
2*4*6*8*11*14*17*20*23*26*29*32*35*

Each asterisk in the string occurs at a position specified by the immediately preceding number. Thus, the asterisk following the 29 is the 29th character in that string. So, you can chop the end of the string anywhere, and you know exactly where it was cut. Without having to count, you know that the string “2*4*6*8*11*14*17*2” has exactly 18 characters in it. This saves some effort when you’re dealing with a half million characters. I pasted a 4000 character counterstring into the address field of Explorer and it was truncated at “2045*20”, meaning that 2047 characters were pasted.

I realize this is may not be a very interesting sort of testing, except perhaps for security purposes or when you’re first getting to know the app. But security is an increasingly important issue in our field, and sometimes when no one tells you the limits and dynamics of text fields, this can come in handy.

Filed Under: Automation, Heuristics, Test Coverage

Reader Interactions

Comments

  1. Michael Holmes says

    September 6, 2006 at 8:26 pm

    I’ve used this tool and found it very helpful in things like field validation as suggested in the field – Requirement states that field will accept a maximum input of 200 characters. Great create a string, put it in your automation library, have your automation tool call the string to test the value. Requirement changed? Create a new string with same name!

    Also have used it for creating large quantities of data for insertion into database applications under test.
    Testing indexing in databases through creating huge strings and using find and replace to change or strip out the asterisks.
    Though for both these cases I have also enjoyed using texts from the Project Gutenberg library – (http://www.gutenberg.org/wiki/Main_Page) I mean Ipsum Lorum does tend to get boring after a while.

    Reply
  2. José Alejandro Betancur says

    July 13, 2007 at 11:21 am

    james,

    is there a way to tell perlclip to create the $allchars backwards?

    I figure out that the combination “&#” breaks the application when is used.. and some times some points of the $allchars text backwards also crash apps.

    [James’ Reply: There’s no way to do that yet. But it’s easy to tweak the code to make that happen.] 

    Reply
  3. Dan Meservy says

    January 28, 2010 at 10:33 am

    I’ve already shared this with a couple of my testing colleagues. Though it’s simple, it’s powerful. Before, we’d hold a button for a long time in a field, then copy to the point of truncation and paste the text in word and do a character count. Cave-man like, I know! Thank you for the tool! It’s in my library now.

    Reply
  4. Gleb Shevchuk says

    October 12, 2010 at 3:25 am

    A useful testing tool.
    Thanks.

    Reply
  5. Jin says

    April 21, 2019 at 12:29 pm

    Typo,possibly? 17*2 ??

    [James’ Reply: I know it looks like one, but it isn’t. The full string was 2*4*6*8*11*14*17*20*23*26*29*32*. When that is truncated to 18 characters it will end in “”2″”]

    Reply
  6. Jin Kwon says

    April 21, 2019 at 12:29 pm

    A way in Java to generate counterstrings.
    https://gist.github.com/jinahya/c278ccad5df4b2e754667f29751a9e3a

    Reply
  7. Vincentd123 says

    February 15, 2021 at 2:49 pm

    javascript code which you can copy paste into dev tools console
    “` javascript
    let str = “”
    while (str.length < 1000){ str = `${str}${str.length + 1 + str.length.toString().length}*`}
    console.log(str)
    “`
    ps. testing if comments support markdown 😉

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Search

Categories

  • About Me (18)
  • Agile Methodology (14)
  • Automation (19)
  • Bug Investigation and Reporting (9)
  • Buggy Products (22)
  • Certification (10)
  • Context-Driven Testing (44)
  • Critique (41)
  • Ethics (19)
  • Exploratory Testing (32)
  • FAQ (5)
  • For Newbies (25)
  • Heuristics (28)
  • Important! (20)
  • Language (35)
  • Management (20)
  • Metrics (3)
  • Process Dynamics (27)
  • Quality (7)
  • Rapid Software Testing Methodology (22)
  • Risk Analysis (12)
  • RST (3)
  • Scientific Method (3)
  • Skills (30)
  • Test Coverage (7)
  • Test Documentation (8)
  • Test Oracles (4)
  • Test Reporting (11)
  • Test Strategy (26)
  • Testability (3)
  • Testing Culture (90)
  • Testing vs. Checking (17)
  • Uncategorized (10)
  • Working with Non-Testers (6)

Blog Archives

Footer

  • About James Bach
  • Satisfice Blog
  • Bibliography: Bach on IEEE
  • Contact James
  • Consulting
  • Engage Our Services
  • Privacy Policy
  • RST Courses
  • RST Explored
  • RST Applied
  • RST Managed
  • RST Coached
  • RST Focused: Risk
  • RST Focused: Strategy
  • RST Methodology
  • Exploratory Testing
  • Testing Training
  • Resources
  • Bibliography: Exploratory
  • Bibliography: Risk Analysis
  • Bibliography: Coaching
  • Bibliography: Usability
  • Bibliography: The Sociology of Harry Collins
  • Schedule
  • Upcoming Public Classes
  • Upcoming Online Classes
  • Public Events
  • Tester MeetUps

Copyright © 2023 · News Pro on Genesis Framework · WordPress · Log in