コード例 #1
0
ファイル: HttpEntUnitTests.php プロジェクト: kanbang/Colt
 public function main()
 {
     HtmlPrinter::PrintHtmlHeader("HttpEnt Tests");
     HtmlPrinter::PrintFormHeader("Run.php");
     //Add your tests here
     //HtmlPrinter::PrintTestCases("YourTestName", "Path to database file where your data is stored", "Http")
     HtmlPrinter::PrintTestCases("FeatureService", "../../TestData/FeatureService/FeatureServiceTest.dump", "HttpEnt");
     HtmlPrinter::PrintSelectTestMode();
     HtmlPrinter::PrintSelectOutput();
     HtmlPrinter::PrintFormFooter("HttpEnt", "RunTests");
     HtmlPrinter::PrintHtmlFooter();
 }
コード例 #2
0
ファイル: HttpUnitTests.php プロジェクト: kanbang/Colt
 public function main()
 {
     HtmlPrinter::PrintHtmlHeader("Http Tests");
     HtmlPrinter::PrintFormHeader("Run.php");
     //Add your tests here
     //HtmlPrinter::PrintTestCases("YourTestName", "Path to database file where your data is stored", "Api")
     HtmlPrinter::PrintTestCases("ResourceService", "../../TestData/ResourceService/ResourceServiceTest.dump", "Http");
     HtmlPrinter::PrintTestCases("DrawingService", "../../TestData/DrawingService/DrawingServiceTest.dump", "Http");
     HtmlPrinter::PrintTestCases("FeatureService", "../../TestData/FeatureService/FeatureServiceTest.dump", "Http");
     HtmlPrinter::PrintTestCases("MappingService", "../../TestData/MappingService/MappingServiceTest.dump", "Http");
     HtmlPrinter::PrintTestCases("SiteServiceTests", "../../TestData/SiteService/SiteServiceTest.dump", "Http");
     HtmlPrinter::PrintTestCases("WfsTests", "../../TestData/Wfs/WfsTest.dump", "Http");
     HtmlPrinter::PrintTestCases("WmsTests", "../../TestData/Wms/WmsTest.dump", "Http");
     HtmlPrinter::PrintSelectTestMode();
     HtmlPrinter::PrintSelectOutput();
     HtmlPrinter::PrintFormFooter("Http", "RunTests");
     HtmlPrinter::PrintHtmlFooter();
 }
コード例 #3
0
ファイル: Run.php プロジェクト: kanbang/Colt
 function RunTest(&$testsRun, $file)
 {
     try {
         $actualResult = new Result();
         $exitStatus = 0;
         $testName = $_POST['testName'];
         //Add the test in the log file
         $entry = "\n\n************************************************************\n";
         $entry .= sprintf("Executing %s\n", $testName);
         $entry .= "************************************************************\n\n";
         fwrite($file, $entry);
         //Get the list of operations to be executed for this test. This list should comma separated, no spaces.
         $this->unitTestVm->Execute("Select ParamSets from TestCase where TestName=\"{$testName}\"");
         $sets = $this->unitTestVm->GetString("ParamSets");
         $paramSet = strtok($sets, ",");
         if ($_POST['output'] == "html") {
             //Start the HTML table for the results
             HtmlPrinter::PrintResultTableHeader($_POST['requestType'] . " Test " . $testName);
         }
         //For each operation in the list
         //Execute the operation and validate the result
         while ($paramSet != "") {
             $this->unitTestVm->Execute("Select ParamValue from Params where ParamSet={$paramSet} AND ParamName=\"OPERATION\";");
             $paramValue = $this->unitTestVm->GetString("ParamValue");
             $testsRun++;
             //Add the operation to the log file
             $this->AddLogFileEntry($file, $paramValue, $paramSet, $this->unitTestResultVm);
             $actualResult = $this->operation->Execute($paramSet, $paramValue);
             if (substr_count($_POST['requestType'], "Http")) {
                 $status = $this->validate->ValidateHttpRequest($_POST['testName'], $paramSet, $paramValue, $actualResult, $file);
             } else {
                 $status = $this->validate->ValidateApiRequest($_POST['testName'], $paramSet, $paramValue, $actualResult, $file);
             }
             $exitStatus += $status;
             $paramSet = strtok(",");
         }
         //Closes the Html table. Also outputs hidden fields that are needed for Generation mode
         if ($_POST['output'] == "html") {
             HtmlPrinter::printTableEnd();
             HtmlPrinter::PrintGenerateFormHiddenFields();
             HtmlPrinter::PrintFormFooter($_POST['requestType'], "Generate");
         }
         if ($_POST['testExecutionMode'] == "generate") {
             Utils::CreateDumpFile($this->unitTestDb);
         }
         return $exitStatus;
     } catch (MgException $e) {
         print $e->GetExceptionMessage("en") . "\n";
     } catch (SqliteException $s) {
         print $s->GetExceptionMessage() . "\n";
     }
 }