= Unit Testing = There are a variety of unit tests written to test the encryptiong functionality, various io components, the local data store, remote data store, and servlets. This is a brief listing of the unit test suites and what they contain. They can all be found in the org.sharedrecords.tests namespace. Some of the large tests suites are highlighted below. * '''org.sharedrecords.tests.storageprovider.!LocalStorageProviderTest''': To execute the local data store unit tests, run the org.sharedrecords.test.!LocalStorageProviderTest Suite. When using the local data store tests, ensure that etc\org.sharedrecords.properties has the org.sharedrecords.core.!FileStoreRoot property uncommented and set to your target local data store. * '''org.sharedrecords.tests.storageprovider.!RemoteStorageProviderTest''': To execute the remote data store unit tests, run the org.sharedrecords.test.!RemoteStorageProviderTest Suite. Ensure that the URL is correctly set for your target server in the !GlobalTestVars.targetURL. The target URL will override whatever is in the org.sharedrecords.properties settings. '''NOTE 1:''' Both of these classes subclass !StorageProviderTest which has the actual implementation to test the storage provider methods. The two subclasses simply handle the setUp and tearDown methods that are different for local and remote testing. The calls go through our reference implementation of IStorageProvider, which in turn uses the !DataStore objects. These unit tests do not directly operate on the !DataStore object except to cleanup after the unit tests have completed. '''NOTE 2:''' If creating your own test cases, a useful base class to sub class is '''org.sharedrecords.tests.!BaseTestEnv'''. This class creates user accounts in the data store for testing and contains the methods to clean them up when done. * '''org.sharedrecords.tests.servletconnection.!AllServletTests''': To test the servlet web API methods on their own, run org.sharedrecords.tests.servlet!AllServletTest. This will ensure that all servlet communcation is reaching the server and no error is being thrown during execution of the servlet. The servlet tests can also be run individually and are found in the namespace org.sharedrecords.test.servlet. The test suite !AllServletTests will execute all of the servlet tests at once. Again, you will need to specify your target URL in the !GlobalTestVars class. '''NOTE 3:''' These test cases only evaluate that the servlet calls are correct reaching the server and being handed off the the server's local data store and no errors are been thrown in the communication. For the most part, these servlet methods test trivial return codes by passing in non-existent account and record requests. For full integration testing, you must use the !RemoteStorageProviderTest suite. * '''org.sharedrecords.tests.!DemoTransactionTest''': To test the controller API's found in the Transaction class. This test mimics the API's that the Demo application calls but has implemented bypasses to allow the tests to be run without a UI. This tests account creation and deletion, ownerless and owned record creation and retreival, and adding metadata to a record. * '''org.sharedrecords.tests.!AllTests''': Runs all available unit tests in the org.sharedrecords.tests namespace, this does not include the basic servlet tests but does include the !RemoteStorageProviderTest suite.