14#include "arcane/utils/ScopedPtr.h"
16#include "arcane/core/IUnitTest.h"
17#include "arcane/core/ISubDomain.h"
18#include "arcane/core/IApplication.h"
19#include "arcane/core/ITimeLoop.h"
20#include "arcane/core/ITimeLoopMng.h"
21#include "arcane/core/IXmlDocumentHolder.h"
22#include "arcane/core/IIOMng.h"
23#include "arcane/core/ArcaneException.h"
24#include "arcane/core/TimeLoopEntryPointInfo.h"
25#include "arcane/core/Directory.h"
26#include "arcane/core/XmlNode.h"
27#include "arcane/core/IParallelMng.h"
28#include "arcane/core/DomUtils.h"
30#include "arcane/std/UnitTest_axl.h"
45:
public ArcaneUnitTestObject
59 void unitTestInit()
override;
60 void unitTestDoTest()
override;
61 void unitTestExit()
override;
70 void _checkCreateXmlTestDocument();
84, m_tests_doc(domutils::createXmlDocument())
94staticInitialize(ISubDomain* sd)
96 String time_loop_name(
"UnitTest");
97 ITimeLoopMng* tlm = sd->timeLoopMng();
98 ITimeLoop* time_loop = tlm->createTimeLoop(time_loop_name);
101 List<TimeLoopEntryPointInfo> clist;
102 clist.add(TimeLoopEntryPointInfo(
"UnitTest.UnitTestBuild"));
107 List<TimeLoopEntryPointInfo> clist;
108 clist.add(TimeLoopEntryPointInfo(
"UnitTest.UnitTestInit"));
113 List<TimeLoopEntryPointInfo> clist;
114 clist.add(TimeLoopEntryPointInfo(
"UnitTest.UnitTestDoTest"));
119 List<TimeLoopEntryPointInfo> clist;
120 clist.add(TimeLoopEntryPointInfo(
"UnitTest.UnitTestExit"));
126 clist.add(
"UnitTest");
127 clist.add(
"ArcanePostProcessing");
128 time_loop->setRequiredModulesName(clist);
131 tlm->registerTimeLoop(time_loop);
141 service->buildInitializeTest();
144 service->buildInitializeTest();
157 service->initializeTest();
160 service->initializeTest();
171 for (IUnitTest* service :
options()->test)
172 service->executeTest();
174 if (
options()->xmlTest.size() > 0) {
175 XmlNode xtests =
m_tests_doc->documentNode().documentElement();
176 for (IXmlUnitTest* service :
options()->xmlTest) {
177 XmlNode xservice = xtests.createAndAppendElement(
"service");
178 if (!service->executeTest(xservice))
190 for (IUnitTest* service :
options()->test)
191 service->finalizeTest();
193 for (IXmlUnitTest* service :
options()->xmlTest)
194 service->finalizeTest();
196 if (
options()->xmlTest.size() > 0) {
200 if (pm->isMasterIO()) {
201 Directory listing_dir(
subDomain()->listingDirectory());
202 String filename(listing_dir.file(
"unittests.xml"));
203 info() <<
"Output of the report of the unit test in '" << filename <<
"'";
209 ARCANE_FATAL(
"Some errors have occured in the unit tests.");
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
ISubDomain * subDomain() const override
Sub-domain associated with the module.
Generation de la classe de base du Module.
CaseOptionsUnitTest * options() const
Options du jeu de données du module.
VariableScalarReal m_global_deltat
Global Delta T.
virtual bool writeXmlFile(IXmlDocumentHolder *doc, const String &filename, const bool indented=false)=0
Writes the XML tree of the document doc to the file filename.
Interface of the subdomain manager.
virtual IIOMng * ioMng()=0
Returns the I/O manager.
virtual IParallelMng * parallelMng()=0
Returns the parallelism manager.
virtual ITimeLoopMng * timeLoopMng()=0
Returns the time loop manager.
virtual void stopComputeLoop(bool is_final_time, bool has_error=false)=0
Indicates that the compute loop must stop.
static const char * WExit
called upon termination of the code.
static const char * WBuild
called when reading the dataset
static const char * WComputeLoop
called during the calculation loop
static const char * WInit
called during initialization, initialization of a restart, or a new case
Interface of a unit test service.
Interface of a unit test service providing a test report in the form of an XML node.
Information for building a module.
Encapsulation of an automatically destructing pointer.
TraceMessage info() const
Flow for an information message.
ScopedPtrT< IXmlDocumentHolder > m_tests_doc
Unit test traces.
VersionInfo versionInfo() const override
Module version.
bool m_success
True as long as a unit test has not returned an error.
void unitTestBuild() override
points d'entrée
Information about a version.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
List< String > StringList
Unicode string list.