inc/qa.h

Go to the documentation of this file.
00001 /* qa - Module to help do testing, especially on html based apps. */
00002 
00003 #ifndef QA_H
00004 #define QA_H
00005 
00006 #ifndef HTMLPAGE_H
00007 #include "htmlPage.h"
00008 #endif
00009 
00010 char *qaStringBetween(char *text, char *startPattern, char *endPattern);
00011 /* Return text that occurs between startPattern and endPattern,
00012  * or NULL if no startPattern.  (Will return up to 100 characters
00013  * after startPattern if there is no endPattern) */
00014 
00015 char *qaScanForErrorMessage(char *text);
00016 /* Scan text for error message.  If one exists then
00017  * return copy of it.  Else return NULL. */
00018 
00019 int qaCountBetween(char *s, char *startPattern, char *endPattern, 
00020         char *midPattern);
00021 
00022 struct slName *qaRandomSample(char *db, char *table, char *field, int count);
00023 /* Get random sample from database. */
00024 
00025 
00026 struct qaStatus
00027 /* Timing and other info about fetching a web page. */
00028     {
00029     struct qaStatus *next;
00030     int milliTime;      /* Time page fetch took. */
00031     char *errMessage;   /* Error message if any. */
00032     boolean hardError;  /* Crash of some sort. */
00033     };
00034 
00035 struct qaStatus *qaPageGet(char *url, struct htmlPage **retPage);
00036 /* Get info on given url, (and return page if retPage non-null). */
00037 
00038 struct qaStatus *qaPageFromForm(struct htmlPage *origPage, struct htmlForm *form, 
00039         char *buttonName, char *buttonVal, struct htmlPage **retPage);
00040 /* Get update to form based on pressing a button. */
00041 
00042 void qaStatusSoftError(struct qaStatus *qs, char *format, ...);
00043 /* Add error message for something less than a crash. */
00044 
00045 void qaStatusReportOne(FILE *f, struct qaStatus *qs, char *format, ...);
00046 /* Report status */
00047 
00048 struct qaStatistics
00049 /* Stats on one set of tests. */
00050     {
00051     struct qaStatistics *next;
00052     int testCount;      /* Number of tests. */
00053     int softCount;      /* Soft error count. */
00054     int hardCount;      /* Hard error count. */
00055     long milliTotal;    /* Time tests took. */
00056     };
00057 
00058 void qaStatisticsAdd(struct qaStatistics *stats, struct qaStatus *qs);
00059 /* Add test results to totals */
00060 
00061 void qaStatisticsReport(struct qaStatistics *stats, char *label, FILE *f);
00062 /* Write a line of stats to file. */
00063 
00064 #endif /* QA_H */
00065 

Generated on Tue Dec 25 18:39:29 2007 for blat by  doxygen 1.5.2