Search code examples
javaunit-testingjunitautomated-teststest-framework

JUnit Testing for Automated Testing Scripts?


I recently joined this organisation that I am currently working at that has asked me to manage a project to re factor, extend and maintain an existing Automated Testing Framework written in java, which uses a keyword driven framework and RFT. I have been a developer at heart all my life even though I have moved to Agile management. By habit I write unit tests to test for behavior before writing source code. This framework does not have one unit test. My first instinct was "where are the unit tests?" I know I can write unit tests for the testing framework classes. During a discussion here it was brought up that writing unit tests for testing frameworks or scripts may be a waste of time. I diplomatically disagreed.

Question 1: Could my instinct be wrong? Do you have any suggestions which can be helpful to fight my case.

Question 2: And could this get recursive? Writing tests for tests and tests and so on. Is there rule for when to stop writing unit tests? Is there a concept of testing the tester recursion?

Again I am all for unit tests but never been in this kind of situation before. I could not find much on this topic from my research.

EDIT

Thank you all for your interesting responses! The unit tests will definitely be written without doubt! Highest priority will be given to our self written framework classes and methods that are used most often and would have high ROI and high Penalty for failure. The plan is to gradually and incrementally achieve a high level of code coverage for the whole project (java)


Solution

  • Question 1: Could my instinct be wrong? Do you have any suggestions which can be helpful to fight my case.

    Your instincts are not wrong. If your testing framework has a bug it might miss errors by skipping tests, for example.

    Question 2: And could this get recursive? Writing tests for tests and tests and so on. Is there rule for when to stop writing unit tests? Is there a concept of testing the tester recursion?

    No. Because test cases are supposed to be so simple that bugs can't survive scrutiny. Every test should be trivial or the class being tested needs refactoring. Obviously sometimes this is easier said than done.

    I'd examine the test framework and add tests wherever a failure would really hurt.