Ph.D. - geht es zur Homepage der Informatik des Fachbereiches 3 ...
Ph.D. - geht es zur Homepage der Informatik des Fachbereiches 3 ...
Ph.D. - geht es zur Homepage der Informatik des Fachbereiches 3 ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
9.7. Verification and Validation<br />
in Section 4.4). This means even if functional t<strong>es</strong>ts show the correct implementation of<br />
CGOPPRRTransformer, it is not guaranteed that the XML file is generated correctly by<br />
MetaEdit+. Additionally, the implementation of t<strong>es</strong>ts for the MERL GOPPRR XML generator<br />
is not easy to realise because MERL scripts only may run in the context of certain GOPRR<br />
instanc<strong>es</strong>. The b<strong>es</strong>t possible solution to avoid this problem is to generate the t<strong>es</strong>ts directly<br />
from the MetaEdit+ model as C++ source code.<br />
Similar to the MERL generator for creating the GOPPRR XML file, this can be done in a<br />
general manner not specialised for a certain meta model. Only, all graphs have to be proc<strong>es</strong>sed<br />
to generate for each GOPPRR element t<strong>es</strong>t statements to check their existence in a CProject<br />
object or rather abstract syntax model. Th<strong>es</strong>e statements look like the following example,<br />
which is only a small excerpt:<br />
1 : : GOPPRR : : CGraph∗ pGraph ( 0 ) ;<br />
2 : : GOPPRR : : CObject ∗ pObject ( 0 ) ;<br />
3 : : GOPPRR : : CProperty ∗ pProperty ( 0 ) ;<br />
4<br />
5<br />
6 // BEGIN: a s s e r t s f o r graph openETCS Case Study with oid 3_256<br />
7 CPPUNIT_ASSERT( p P r o j e c t −>m_GraphSet . f i n d ( "3_256" ) != p P r o j e c t −>m_GraphSet . end ( ) ) ;<br />
8 pGraph = &( p P r o j e c t −>m_GraphSet [ "3_256" ] ) ;<br />
9 // BEGIN: a s s e r t s f o r o b j e c t F u l l Supervision o f type Mode with oid 3_283<br />
10 CPPUNIT_ASSERT( pGraph−>m_ObjectSet . f i n d ( "3_283" ) != pGraph−>m_ObjectSet . end ( ) ) ;<br />
11 pObject = pGraph−>m_ObjectSet [ "3_283" ] ;<br />
12 CPPUNIT_ASSERT( pObject−>m_ID == : : s t d : : s t r i n g ( " F u l l ␣ S u p e r v i s i o n " ) ) ;<br />
13 CPPUNIT_ASSERT( pObject−>m_Type == : : s t d : : s t r i n g ( "Mode" ) ) ;<br />
14 CPPUNIT_ASSERT( pObject−>m_OID == : : s t d : : s t r i n g ( "3_283" ) ) ;<br />
15 CPPUNIT_ASSERT( pObject−>m_Properti<strong>es</strong> . f i n d ( "3_285" ) != pObject−>m_Properti<strong>es</strong> . end ( ) ) ;<br />
16 pProperty = pObject−>m_Properti<strong>es</strong> [ "3_285" ] ;<br />
17 CPPUNIT_ASSERT( pProperty−>m_Value == : : s t d : : s t r i n g ( " F u l l ␣ S u p e r v i s i o n " ) ) ;<br />
18 CPPUNIT_ASSERT( pProperty−>m_Type == : : s t d : : s t r i n g ( "ModeName" ) ) ;<br />
19 CPPUNIT_ASSERT( pProperty−>m_OID == : : s t d : : s t r i n g ( "3_285" ) ) ;<br />
20 [ . . . ]<br />
The CPPUNIT_ASSERT() [16] macro is part of the CppUnit framework and defin<strong>es</strong> assertions [79],<br />
which must be fulfilled for a certain t<strong>es</strong>t case. Initially, the existence of the graph instance is<br />
checked. Afterwards, objects and their properti<strong>es</strong> are checked and so on. A great advantage<br />
is that the OIDs are used as key valu<strong>es</strong> for the maps in the GOPPRR C++ abstract syntax<br />
model. Thus, the acc<strong>es</strong>s to the elements is easy definable in the MERL generator. Since a lot<br />
of assertions for each graph are generated in this manner, those are grouped in C++ functions<br />
for each graph. Finally, a function is generated that calls all those graph functions and can be<br />
integrated in any t<strong>es</strong>ting application.<br />
Because the t<strong>es</strong>t can always be generated along with the GOPPRR XML intermediate model,<br />
it can be guaranteed that all GOPRR or rather GOPPRR elements of the model instance in<br />
MetaEdit+ also exist in the GOPPRR C++ abstract syntax model or rather in the CProject<br />
object. This covers Req.9 for the transformation proc<strong>es</strong>s and is not limited to the openETCS<br />
meta model.<br />
As already explained for the GOPPRR XML generator in Section 4.4, a small drawback is<br />
that no assertions can be generated, due to MetaEdit+ / MERL limitations, for properti<strong>es</strong><br />
that are non-properti<strong>es</strong>. For those, always a specialised generator for the concrete meta model<br />
has to be added. The full code of the assertion generators can be found in Section F.2.<br />
The realisation of t<strong>es</strong>ts to ensure Req.9 for the C++ source code generation by CCPPGenerator<br />
is much more complicated. It can also be interpreted as a transformation but not in<br />
such a general way as for the internal MetaEdit+ GOPRR repr<strong>es</strong>entation to the GOPPRR<br />
C++ abstract syntax model. Therefore, again generating t<strong>es</strong>ts directly from MetaEdit+ is not<br />
175