00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 #ifndef TESTABLE_H 00011 #define TESTABLE_H 00012 00013 #include <ostream> 00014 00015 class Progress; 00016 00017 /** 00018 * A common testing interface for all plug-ins. 00019 * 00020 * This class defines the generic testing interface to all plug-ins. This 00021 * interface is used to verify plug-ins in an operational environment as well 00022 * as to run a full suite of automated tests. 00023 */ 00024 class Testable 00025 { 00026 public: 00027 /** 00028 * Executes operational tests generically. 00029 * 00030 * This method is used to run basic tests and to make sure the plug-in is 00031 * operating properly. Running this method on all plug-ins can be used to 00032 * relatively quickly determine if the application has been installed 00033 * properly and all plug-ins are operational. 00034 * 00035 * @param pProgress 00036 * On input, \em pProgress provides an object for the plug-in to 00037 * update the progress of the testing. This allows the 00038 * application to update the user with a progress dialog and to 00039 * show current status. 00040 * @param failure 00041 * On output, \em failure is an output stream in which the plug-in 00042 * can record detailed formatted text about what went wrong in 00043 * with the test. This parameter should not be used to record 00044 * general status information. Nothing should be logged to this 00045 * stream unless the tests failed and \b false is returned from 00046 * the method. 00047 * 00048 * @return Returns \b true if the operational tests executed successfully; 00049 * otherwise returns \b false. 00050 */ 00051 virtual bool runOperationalTests(Progress* pProgress, std::ostream& failure) = 0; 00052 00053 /** 00054 * Executes the full suite of tests. 00055 * 00056 * This method is used to run a full set of tests and to make sure the 00057 * plug-in is operating properly. This method can be called on all 00058 * plug-ins to run a full set of tests and to determine if the current 00059 * build works completely. This method is used more for automated testing 00060 * during the development and formal testing process. 00061 * 00062 * @param pProgress 00063 * On input, \em pProgress provides an object for the plug-in to 00064 * update the progress of the testing. This allows the 00065 * application to update the user with a progress dialog and to 00066 * show current status. 00067 * @param failure 00068 * On output, \em failure is an output stream in which the plug-in 00069 * can record detailed formatted text about what went wrong in 00070 * with the test. This parameter should not be used to record 00071 * general status information. Nothing should be logged to this 00072 * stream unless the tests failed and \b false is returned from 00073 * the method. 00074 * 00075 * @return Returns \b true if the all tests executed successfully; 00076 * otherwise returns \b false. 00077 */ 00078 virtual bool runAllTests(Progress* pProgress, std::ostream& failure) = 0; 00079 00080 protected: 00081 /** 00082 * This should be destroyed by calling PlugInManagerServices::destroyPlugIn. 00083 */ 00084 virtual ~Testable() {} 00085 }; 00086 00087 #endif