In the following
git hub link to the testing code a simple technique to check whether something has been set or went via a particular execution path is demonstrated.
In this particular use case
the actual code to test
should implement a logic as follows:
- check that a var is set , if not set to default value ( the var is the "mysql_scripts_dir"
As the time of writing the function is not even ready ... the challenge was how-to test that the var was set according to the desired logic ... echoing the var into the /tmp/ or /var/log / dir is out of question - since ( at least for this tool ) the tool should write data only bellow its root dir ...
The solution ?!
Echo the value of the var into the implementation code's tool log file ( the line contains the pid of the run ), build the desired log line result into the testing code and verify it by the child pid - after the code has executed there should be 1 and only 1 occurrence of that log line ...
I might be doing something reeeaally wrong here ... if you do have better ideas please comment ...
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!