We have a series of hardware and we have decided on a common API to be given to the customer for use. The customer will use this API in order to program the hardware. The API includes functions for establishing a connection with the h/w like X_Open,X_Close,X_SetConfig, X_GetConfig, no of hardware connected, error handling with the corresponding structs to be filled by the API or the customer. The hardware will ofcourse be validated independently also. What strategies can I use to validate this API ? We want to test this API i.e it works as expected for instance we are actually able to setConfig in the h/w or get no of devices on the bus or if the API function X_Open is called , the function is able to establish a connection to the hardware as expected or say API function X_GetNoDevices returns no. of present devices on the bus. We want to validate that all API functions work as described to the customer
-
Is your question "how to test that the validation-layer of the hardware-api works as expected" ie that the validation-layer realy throws an exception if an invalid hardware-adress was give to the hardware-api?– k3bFeb 29, 2012 at 10:17
-
@ k3b My question is checking if h/w api behaves as advertised.– spring liuFeb 29, 2012 at 11:26
1 Answer
Essentially what you refer to is known as compatibility test suite, a set of sample applications that demonstrate reference usage of your API, along with documentation clearly describing expected behavior of these applications, allowing to judge whether API functions as intended.
When your API is modified or extended, you change your test suite accordingly by modifying / extending your sample applications and adjusting documentation for expected behavior.
Stuff like that is widely used in the industry, one example that immediately jumps to mind is Java TCK / JCK. Another example is Khronos conformance tests for OpenGL and other API implementations.
If you plan for a long term use of such test suite, it makes much sense to treat it as a separate software product, with version control, issue tracking, releases and such.