What approach do you take to using external bioinformatics software during testing of your code?
For example, if one of your components used clustalw, which you have installed on a Linux server but not on your Windows workstation, which approach would you take?
- Let your code run the external program - if it doesn't exist, let it die horribly and fail its tests. Advantages: laziest solution. Disadvantages: lots of failing tests can hide other failures that may only appear when you run it on your Windows workstation.
- Skip tests that wouldn't pass on your platform. For example, skip the tests for the clustalw-using software when you're running it on your Windows workstation.
- Mock the program out somehow?
- Something else?
Edit: The software isn't a package that will be used by anyone else. It'll just be used by myself (barring being hit by a bus) for my current project.
The project is written in ruby. I assumed most bioinformaticians use scripting languages unless they have to optimize for speed, but maybe that's not the case.
I don't get your point. If some external program is a dependency for your program, why should it not die and fail the corresponding tests if you attempt to run it on a platform where one of the required dependencies are not present?
I think this is a quite common question, though not specific to bioinformatics. It applies in general to software configuration an dependency management. So could be asked on Stackoverflow, but I see no need to vote this down.
I stick with one platform - Linux - where I can use simple commands such as "which" to check if an executable exists.
I agree with Lars. If the dependency isn't there, then even later the user won't be able to run it. But, make it optional to compile your package without the component so that the user can still use the rest.
Skipping tests based on certain conditions then reporting them as skipped is a common way to go. Most testing frameworks will support this behavior.