Visual Basic

Test Script Specification

(The idea here is that we want to methodically check each member of the public interface. Some of the test routines will automatically make use of some of the other members.)

Objective: To ensure that each member in the CStockList and CStockItem classes have been run at least once to ensure correct behavior. This is a component-level test that will be performed by the development team.

Test methodology: The two classes are implemented in an ActiveX DLL. This allows for the creation of a dedicated test harness application that will act as a normal client program. For this initial test, sample data will be hard-coded into the test harness application. (The possibility exists to extend this in the future so that test data will be read from a data file.)

Scope of this strategy: This is a generic document that outlines a method of testing without providing any test data. Reasonable test data can be created as required.

Test environment: Windows 98 (full installation), run-time files as installed by Visual Basic 6. No service packs are applied to these products at this time.

SERVERDATA.DLL test 1

Members used: Add, Count, Item, StockValue

Intent: Check that a record is added successfully.

  1. Formulate the data for a new record that doesn't already exist in the table.
  2. Create a reference to a CStockList object.
  3. Call the Item method using the new StockCode value (from step 1) and verify that this raises a "not found" error. This is to check that the record doesn't already exist. If it does exist, this test data has already been used and so the rest of the test should be aborted.
  4. Call the Count property. Check that this tallies with the number of records currently in the table (via Access?).
  5. Call the StockValue property to establish the value Y of total stock currently held.
  6. Calculate the value X of the new item of stock that is to be added by multiplying the StockLevel value with the UnitPrice value.
  7. Call the Add method with the new stock data.
  8. Call the StockValue property and verify that it is equal to the value of X + Y.
  9. Call the Item function to obtain a reference to a CStockItem object. Verify that each property matches the original data. Release the reference to the CStockItem object.
  10. Release the reference to the CStockList object.

SERVERDATA.DLL test 2

Members used: Add

Intent: Prove that a new record with a duplicate key value will be rejected.

  1. Create a reference to a CStockList object.
  2. Attempt to add a record that already exists. A predictable error should be raised (that is, client error handler should include a check for this specific error code being raised).
  3. Release the reference to the CStockList object.

SERVERDATA.DLL test 3

Members used: Remove

Intent: Check that an attempt to delete a record that doesn't exist will fail gracefully.

  1. Create a reference to a CStockList object.
  2. Attempt to remove a record that doesn't exist. A predictable error should be raised.
  3. Release the reference to the CStockList object.

SERVERDATA.DLL test 4

Members used: Item, Update

Intent: Prove that the CStockItem.Update method will reject an attempt to modify a record where the StockCode value would be the same as an existing record.

  1. Create a reference to a CStockList object.
  2. Attempt to rename a StockCode value to an existing value. A predictable error should be raised.
  3. Release the reference to the CStockList object.