Documentation Home
MySQL Internals Manual

26.4 Negative Tests

A "negative" test is a test for which you expect to see a failure. If an error does not occur, that itself indicates a problem.

DO NOT FORGET "NEGATIVE" TESTS where we expect to see fine error messages from the server.

This section contains just a few examples of what to test. Please be creative and imagine what could go wrong in rough reality.

Column with numeric data type:

  • NULL, 0

  • Minimum - 1, Minimum, Minimum + 1

  • Maximum - 1, Maximum, Maximum + 1

  • Negative values if data type is unsigned

  • Garbage like 'abc', '1a', 'a1'

Column with string data type:

  • Null, <empty string>, "exotic" characters like '√§', single quotes, ...

  • String longer than column

Limited number of tables, columns, variables, ...

  • Maximum - 1, Maximum, Maximum + 1

Assume an SQL operation that affects the filesystem (LOAD DATA, CREATE SCHEMA or TABLE, backup/restore, ...). What will happen if the following conditions occur for a file or directory to be read, written, or implicitly created or deleted?

  • Exists/does not exist

  • Is writable/not writable(missing permission)

  • Is empty/not empty

  • Contains the expected content (Example: text)/unexpected content like maybe a JPG)

  • Is a regular file/a directory/a softlink pointing to .../a pipe

  • Is assigned via an extremely long path

  • Becomes victim of file system full

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.