23 #include <terralib/plugin.h> 29 #include <boost/property_tree/json_parser.hpp> 30 #include <boost/foreach.hpp> 33 #include <cppunit/extensions/HelperMacros.h> 34 #include <cppunit/extensions/TestFactoryRegistry.h> 35 #include <cppunit/BriefTestProgressListener.h> 36 #include <cppunit/CompilerOutputter.h> 37 #include <cppunit/TestResult.h> 38 #include <cppunit/TestResultCollector.h> 39 #include <cppunit/TestRunner.h> 40 #include <cppunit/TextOutputter.h> 41 #include <cppunit/XmlOutputter.h> 54 std::string report_dir = TERRALIB_REPORT_DIR;
55 bool resultStatus =
false;
57 boost::property_tree::ptree drivers;
59 boost::property_tree::read_json(
"../data/json_files/drivers.json", drivers);
61 BOOST_FOREACH(
const boost::property_tree::ptree::value_type& v, drivers.get_child(
"drivers").get_child(
""))
65 const std::string& driver_name = v.second.data();
69 boost::property_tree::ptree driver;
71 boost::property_tree::read_json(driver_name, driver);
73 std::string m_dsType = driver.get_child(
"ds.ds_type").data();
76 CPPUNIT_NS::TestResult controller;
79 CPPUNIT_NS::TestResultCollector result;
81 controller.addListener(&result);
84 CPPUNIT_NS::BriefTestProgressListener progress;
86 controller.addListener(&progress);
89 CppUnit::Test* suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
91 CPPUNIT_NS::TestRunner runner;
93 runner.addTest(suite);
95 runner.run(controller);
97 CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
110 std::string testResultDriver = TERRALIB_REPORT_DIR
"/testResult_" + m_dsType ;
111 std::ofstream file1( (testResultDriver +
"_dos.txt" ).c_str() );
113 CPPUNIT_NS::CompilerOutputter outputter1( &result, file1);
118 CPPUNIT_NS::OFileStream file2( (testResultDriver +
".xml").c_str() );
119 CPPUNIT_NS::XmlOutputter xml( &result, file2 );
120 xml.setStyleSheet(
"report.xsl" );
126 CPPUNIT_NS::OFileStream file3( (testResultDriver +
".txt" ).c_str() );
127 CPPUNIT_NS::TextOutputter outputter3( &result, file3 );
131 resultStatus = result.wasSuccessful();
145 return resultStatus ? EXIT_SUCCESS : EXIT_FAILURE;
void finalize()
It finalizes the TerraLib Platform.
static TerraLib & getInstance()
It returns a reference to the singleton instance.
static void initialize(const std::string driver_name)
It will initialize the resources used by Test Suit: TsDataSource, TsDataSet, TsDataSetTypePersistence...
static void finalize()
It will finalize the resources used in Teste Suit: TsDataSource, TsDataSet, TsDataSetTypePersistence...
A static class for managing the resources used by DataSource test suit.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
void initialize()
It initializes the TerraLib Platform.
This file contains include headers for the TerraLib Common Runtime module.
This file contains include headers for the Data Access module of TerraLib.
void LoadModules()
Load terralib modules.