tests/README
author mpm@selenic.com
Tue, 14 Jun 2005 13:28:42 -0800
changeset 331 55f63f3b6a54
child 332 6c869059beb4
permissions -rw-r--r--
Add a simple testing framework -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Add a simple testing framework manifest hash: 9eeea72f2f33438040998a190183958764232ece -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCr0wKywK+sNU5EO8RAl9FAJ4o1QUA/YE2hCSlUPngR8h30hT1xQCgoEhu um2QkJOc2Rz7i6xTGPxuqzU= =YyUM -----END PGP SIGNATURE-----
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     1
A simple testing framework
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     2
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     3
This finds all scripts in the test directory named test-* and executes
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     4
them. The scripts can be either shell scripts or Python. Each test is
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     5
run in a temporary directory that is removed when the test is complete.
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     6
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     7
A test-<x> succeeds if the script returns success and its output
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     8
matches test-<x>.out. If the new output doesn't match, it is stored in
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     9
test-<x>.err.
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    10
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    11
There are some tricky points here that you should be aware of when
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    12
writing tests:
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    13
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    14
- hg commit and hg up -m want user interaction
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    15
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    16
  for commit use -t "text"
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    17
  for hg up -m, set HGMERGE to something noninteractive (like true or merge)
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    18
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    19
- changeset hashes will change based on user and date which make
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    20
  things like hg history output change
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    21
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    22
  use commit -t "test" -u test -d "0 0"
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    23
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    24
- diff will show the current time
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    25
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    26
  use hg diff | sed "s/\(\(---\|+++\).*\)\t.*/\1/" to strip dates
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    27