字符串输入的测试用例 [英] Test cases for string inputs

查看:71
本文介绍了字符串输入的测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

字符串输入相关的一些有用的测试用例想法(和测试问题)有哪些? 有用并不意味着适用于任何地方或所有时间——只是经常足以在您解决一个问题时值得考虑新问题/系统/域.

What are some useful test case ideas (and test questions) related to string inputs? Usefulness need not mean applicable everywhere or all the time--just often enough to be worth considering when you address a new problem/system/domain.

个人答案可能包含特定于某些域(例如电子邮件地址)的问题,但可能应该指向一个单独的 wiki 问题.

Individual answers may contain questions specific to certain domains (eg email address) but should probably point to a separate wiki-question.

请将您的答案同时添加到问题和答案列表中,以便对个别项目进行投票.

Please add your answer BOTH to the question and to the list of answers so that individual items may be voted upon.

一些答案​​:

  • 参见 https://github.com/minimaxir/big-list-of-naughty-strings
  • 空白/空字符串
  • 仅限空格
  • 所有 ASCII/ANSI 字符 0-255
  • 扩展的 Ascii 字符(例如在 Outlook 中)
  • 很长的字符串(建议使用 perlclip 生成一个反字符串,例如 2*4*6*8*11*14*17*20*
  • 只有一个字符
  • Unicode 字符
  • SQL 注入
  • 跨站脚本、跨站请求伪造
  • 重做

相关 SO 问题:

推荐答案

  • 关于数字格式(小数/逗号)的本地化问题
  • 对特殊字符的行为敏感性(例如支持单引号,但仍然能够解析像 Jim O'malley 这样的名字)
  • 转义字符,并以转义字符结束字符串 - 例如,如果您的转义字符是 ^,并且用户输入类似 See above^
  • 字符串中的新行用作单行.
    • localization concerns regarding number formats (decimals / commas)
    • behavior sensitivity of special characters (for example supporting single quotes, but still being capable of parsing a name like Jim O'malley)
    • escape character, and ending a string with the escape character - for example if your escape character is ^, and the user inputs something like See above^
    • new lines in a string intended as single-line.
    • 这个列表是无穷无尽的,因为它真的取决于你打算如何使用字符串,以及它来自哪里.

      the list is endless though because it really depends on how you intend to use the string, and where it came from.

      这篇关于字符串输入的测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆