We are developing a library that we are looking to support on multiple platforms. We currently have a .Net(Desktop, CF, Silverlight, WP7), a Java (desktop and android) and a C++ (win32 for now) flavor and begining to feel the burden of aligning and maintaining these implementation. We have a relative small public interface exposed on these libraries which should all be aligned in functionality though we allow each platform to take advantage of their syntax etc. to avoid always having to adhere to the lowest common denominator.

We have a quite large testsuite (both unit and integration tests) against particularly our .Net implementation but would really like to avoid having to repeat the "same" tests for each platform. We are looking for some pragmatic advise/solutions to handling these (and future) platforms in some easy and uniform way with regards to testing.

We have been tossing around the idea of some kind of centralized "testdriver" that can be adapted to each platform. This would allow the tests to be written in one place (in e.g. .Net) and then adapted/executed on each platform (via e.g. interprocess to a testclient on the particular platform that translates the test-inputs/outputs to the specific platform) but are unsure if that is a road that leads to heaven or hell.

Just to clarify, we would really like some advise on maintaining tests for a component across multiple and avoid as much as possible the repeated/platform specific tests.

Any thoughts, experience, ideas on this subject?

  • The answer may depend upon the library's purpose. Is this a user interface library?
    – user246
    Commented Oct 10, 2011 at 12:32
  • It is not a user interface library so there is no manipulation of visual elements. The library offer a simple service that require connecting to a server to get/set some data on behalf of the hosting application. Commented Oct 11, 2011 at 9:55

4 Answers 4


I would consider inventing a simple syntax for describing my tests, including actions, inputs, and expected results. Then I would write a CLI for each platform that would read a test specified in this syntax, perform the specified actions, compared the expected results to actual results, and emit a pass/fail indicator. Of course, I would still need to maintain my per-platform CLIs, but my tests could be written exactly one and then shared across all platforms.


I did a similar task as user246 when I was testing a Filter Driver that was developed for multiple platforms, we had a lot of duplication across platforms and some functionality that while repeated was unique due to the way the different environments worked. The best thing you can do is list out the tests, what makes them unique, or not, and go from there to decide what tests you want and do not want to run per platform.

If one of your worries is repeating the "same" tests then make sure they actually are the same. Different environments may perform the same function differently, so you want to be sure of what you are testing before you exclude them.


I think that a "platform driver" is the way to go. I worked for sometime with Aqua SW solution that uses this approach- a high level test runner (based on JUnit) and low level "drivers" that match each platform.


If your goal is to try to have one test that will run on multiple platforms then one approach would be to write your tests in C# and have a method that detects the platform during test case initialization (similar to this example http://www.testingmentor.com/imtesty/2010/03/03/programmatically-detecting-the-operating-system-version-part-ii/), then use a bridge to marshall calls for the appropriate platform.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.