Lithium is an automated testcase reduction tool developed by Jesse Ruderman.
Most of what you need to know to use Lithium is in one of these pages:
By default, Lithium uses a clever algorithm that's efficient at reducing most large testcases. For a testcase with 2048 lines, it will try removing each chunk of size 1024, permanently removing it if it is still 'interesting'. It then does the same for each chunk of size 512, then 256, all the way down to chunks of size 1. It then does as many additional rounds at chunk size 1 as necessary until it completes a round without removing anything, at which point the file is 1-minimal (removing any single line from the file makes it 'uninteresting').
If n is the size of the testcase and m is the size of the 1-minimal testcase found by Lithium, then Lithium usually performs O(m ⋅ lg(n)) tests with a total test size of O(m ⋅ n). See the analysis of Lithium's algorithm for more information and proofs.
To keep m small, make sure Lithium's smallest removals won't introduce fatal syntax errors into the file it is trying to reduce. For example, don't use --char when trying to reduce a long sequence of JavaScript statements, and don't feed XHTML to Lithium. (Convert it to HTML first and let Firefox's tag-soup parser sort out the invalidity, or use serializeDOMAsScript.)
./lithium.py [options] interestingness-test.py [arguments for interestingness test]
If you find a non-deterministic bug, don't despair. Lithium will do fine as long as you make the bug happen at least 70% of the time. You can repeat the test either within the application, by adding a loop or reload in the testcase (outside of the DDBEGIN/DDEND markers!), or outside of the application, by adding a loop to the "interestingness test" script.
Lithium is written in Python and requires Python 2.4. (It uses generator expressions and the subprocess module, both of which were introduced with Python 2.4)
Various versions of Lithium have been used successfully with:
It is known to not work well in MSYS, an alternative to Cygwin. I've seen Lithium sorta work in MSYS after adding add ", shell=True" to the call to "subprocess.call" removing the "./" before the test filename, but even then it was buggy. I recommend using Cygwin's Python instead.