Testing API
I had to develop test scripts, using Java (for Java API) and JavaScript, Visual Basic, VBScript and C# (for COM API). I also had to run the test scripts for every new versions of the APIs during the project.
Main effort was applied to testing the Java API: it was tested completelly. The COM API was tested only for some selected, main functions.
Below is description of the Java API testing.
The testing approach is the following: in a test script, create a test function for each API method. The test function calls a method from the API and passes into the method different valid or invalid input parameters. The result returned by the method is compared with an expected value. If the actual and expected values are equal, the test function outputs a Pass status. Otherwise - Fail, and a defect shall be raised for the method.
Also in a test function, there is a check for an exception that the called method could throw. I check that an expected exception is thrown under defined conditions. Also I check that the text of the exception corresponds to the text in the documentation.
There may be cases when the documentation itself is outdated for some methods. Such defects should also be raised.
The test scripts can be executed from the command line, via a batch file, containing calls to all the test scripts. The test results are logged in a text file. The format for such a log file can be as follows:
Summary
-date time
-total number of test functions
-number of passed test functions
-number of failed test functions
Details (for each test function)
- test script name
- test function name with different input parameters
- Pass or Fail status
- Notes, if the test function failed