saru is a testing library.
This file is just a dumpiing gorund for ideas at the moment as I build towards a proper devcelopment plan.
How do we test code? There are three types of tests...
- Regression tests
- Functional tests
- Unit tests
Other considerations are:
- Every test should be a single executable!
- Every test should be a single source file!
- The bits of the makefile for the test should be autogenerated from the source!
- Some kind of metadata in the source file. Gotta be easy to specify or it wont get done.
- Automagic dependency tracking of includes.
- Tracking of library dependencies.
- Warnings about directories without tests (unless something like a .notest exists? )
// SARU:RequiresLibrary FakeDummy
// SARU:TestName Dummy Test
// SARU:Tests That the tesing library works
// SARU:Expected pass
#include "TestUtils.h"
#include "dummy.h"
int main()
{
bool ok = doSomething();
if(!ok) return Test::Fail();
return Test::Ok();
}
The tesing suite could be bsaed around a set of small tools that do simple jobs, with bigger tools built around these tools. This could be kind of like the idea behind git - with plumbing and poreclain.
Possible small tools include:
- extracting settings from source code.
- builing a makefile
- updating/tracking/retreiving library names
- tools to build, run and report on tests
- tools to analyse test results over time
We should aim to have a system that:
- can build and run one or more tests in a directory.
- can produce a test template file
- leaves no clutter in the tes directories ( hides it in a .test subdir? )
- provides a way to run all tests in a project.
- in the spirit of git all helpers will be called saru-xxx and callable through a wrapper script as "saru xxx args"
- Test templates could be named (eg "saru template c++" would get the c++ template...)