Here is the problem.
I want to test the "binary-search-tree"system, there is already existing function called"inserting x into the tree" and "printTree" in the system. Now I am going to do a unit test of "binary-search-tree", when I want to check the correction of the test outputs, I need to print the "tree" out, which needs to use the "printTree".
But since it is a unit test, is there must only one function I can use in the test program? Then I have to write a stub replacing the "printTree" function? (But the stub is used for the functions that is not ready to be called. Obviously, this" printTree" function is already to be called.)
To summary, in this situation(calling function and called function are ready), it is necessary to rebuild a stub to replace the called function to do the unit test of calling function? If it is necessary, how to build the stub? If it is not, so I can use two function in one unit test?
Aucun commentaire:
Enregistrer un commentaire