Generalised the library API tests and created a common test-runner. Instead of copy and pasting the same code in each time. First cut of pids API test, for _new so far.