testing.tex 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. \chapter{Testing}
  2. In order to confirm that the task of interfacing MathML and OpenMath has
  3. been achieved, we must test the program in a variety of situations. We
  4. will be ensuring that all guidelines described in Chapter \ref{analysis}
  5. are properly adhered to. The testing will also prove the efficiency of
  6. the overall design.
  7. The most important feature to look for is that the translation process does not alter or modify the expressions being translated. Additionally, it
  8. is essential that all results produced by the translator are compliant to the OpenMath and MathML standards. We will focus on ensuring semantic
  9. value is preserved as well as making sure that CDs appear correctly next to symbols, MathML attributes are accurate, and that OpenMath symbols not
  10. handled are properly dealt with. Finally we will test MathML outputs with the widespread MathML renderer: IBM TechExplorer.
  11. We will aim to test varios specific aspects in more detail. We will describe the testing method and the results obtained.
  12. The testing should verify whether the program accomplishes its task of translating OpenMath to MathML.
  13. \section{Translation}
  14. In order to verify whether the translation process is attained, we have
  15. created a test suite comprising over 170 MathML and OpenMath examples,
  16. more than 80 of each. Most of these examples come from the standard
  17. specifications and others have been designed to test specific aspects
  18. of the translator. Many of these examples were extensively used
  19. throughout the implementation phase.
  20. By running these examples through the translator, it was possible to
  21. carefully check if the output produced for each example corresponded to
  22. the expected result. This careful analysis, example by example,
  23. has proven that in most cases, semantic value was preserved and a
  24. proper translation was carried out. However, it is important to
  25. concentrate on the difficulties arising from translating OpenMath and
  26. MathML.
  27. \subsection{Content Dictionaries}
  28. \paragraph{Aim:} Given that symbols from different CDs may have the
  29. same name albeit different meanings, we must test the ability of the
  30. translator to relate symbols to their CDs and recognize the difference
  31. in meaning different CDs convey.
  32. \paragraph{Testing method:} In the test suite of 170 examples, there
  33. are a set of expressions testing the ability of the translator to
  34. relate symbols to their CDs. These examples contain expressions with
  35. symbols from different CDs but with the same name, to test the
  36. translator's faculty to properly handle them. There are examples
  37. where correct symbols appear next to wrong CDs and vice versa. The
  38. translator should recognize only the valid CDs.
  39. \paragraph{Results:} All examples were correctly treated. The
  40. translator was capable of recognizing valid symbols by consulting the tables, translating them
  41. accordingly. The results produced by these examples were very satisfactory.
  42. \paragraph{Aim:} To test whether OpenMath expressions generated have
  43. symbols appearing next to the correct CDs.
  44. \paragraph{Testing Method:} Running all the examples contained in {\tt
  45. examples.mml} will generate a large number of OpenMath expressions.
  46. By looking at them carefully we will see if symbols are correctly
  47. related to their CDs.
  48. \paragraph{Results:} All examples analysed were correct. The generated
  49. symbols appeared next to the appropriate CDs. However, whenever a
  50. MathML element mapped to a symbol which belonged to more than one CD
  51. (like {\it inverse} for instance), there was no rule determining which
  52. CD to place. Nevertheless, all translation were correct.
  53. \subsection{MathML Attributes}
  54. \paragraph{Aim 1:} In many cases attribute values modify the semantic
  55. value of MathML expressions and must be taken into account when
  56. translating. We would like to determine if the translator detects
  57. attribute values and takes them into account when translating.
  58. \paragraph{Aim 2:} Various OpenMath symbols map to MathML elements with
  59. specific attribute values. Does the translator detect these symbols in order to
  60. generate MathML elements with their correct attribute values?
  61. \paragraph{Testing Method:} We must gather all examples containing
  62. elements whose attribute values convey semantic meaning. We translate
  63. these elements from MathML to OpenMath and see if the semantic meaning
  64. has been preserved. We then translate back to MathML and the translator
  65. will have recognized these OpenMath elements and reproduced the
  66. original MathML element with the correct attribute value.
  67. \paragraph{Results:} All results were satisfactory. Attribute values were
  68. recognized, correctly interpreted and semantic meaning was preserved in
  69. all cases.
  70. \subsection{Extensibility}
  71. \paragraph{Aim:} To test how well the translator copes with OpenMath
  72. symbols having no equivalent MathML element. We want to determine if they
  73. are properly translated and preserve their structure and meaning.
  74. \paragraph{Testing Method:} There are various types of situations where
  75. extensibility mechanisms must be employed. These are:
  76. \begin{itemize}
  77. \item Both the CD and symbol are not recognized
  78. \item The symbol is not recognized
  79. \item The CD is not recognized
  80. \end{itemize}
  81. In these three cases, the translator must employ MathML \verb|<semantic>|
  82. tags to preserve semantic meaning. We will tes expressions
  83. based on these three cases.
  84. \paragraph{Results:} The translator automatically detected the unknown
  85. symbols and enveloped them inside \verb|<semantic>| tags. The translator
  86. worked well in cases where the OpenMath symbol translated was constructed
  87. by {\it application}. An example of this is the {\tt rank} operator seen
  88. in figure \ref{rank}. In other cases (such as {\it binding}) the results
  89. were poor and in many cases incorrect.
  90. \section{Standard Compliance}
  91. For this translator to produce usable results it must imperatively conform to MathML and OpenMath standards. This implies that all expressions
  92. produced must be lexically and syntactically correct according to the specifications. We must examine that the translator can parse and generate
  93. valid expressions.
  94. \subsection{Parsing of Expressions}
  95. \paragraph{Aim:} Valid MathML and OpenMath expressions must be parsed
  96. without difficulty by the translator. Lexical and syntax errors must be
  97. detected and attribute values must be extracted for use in translating.
  98. \paragraph{Testing Method:} The translator should correctly parse a large
  99. amount of valid MathML and OpenMath examples taken from the standards.
  100. These examples are contained in the 170 examples mentioned earlier and are considered to be correct. The
  101. World Wide Web Consortium also offers a test suite for testing
  102. applications for MathML compliance. This test suite is a series of valid
  103. MathML expressions, which if parsed prove that an application is MathML
  104. compliant. Unfortunately the URL link to this test suite was broken
  105. throughout the duration of this project and has not been able to be used.
  106. We will also introduce incorrect expressions to see if the translator
  107. declares them as erroneous.
  108. \paragraph{Results:} The translator performs well. All supported
  109. operators are correctly parsed. Syntax is validated in both standards, thus distinguishing amongst correct and incorrect expressions.
  110. Unsupported elements as described in section ref{nosupport} cause the
  111. translator to abort. The translator is MathML and OpenMath compliant.
  112. \subsection{Generation of Expressions}
  113. \paragraph{Aim:} To determine if expressions produced by the translator
  114. are MathML and OpenMath compliant.
  115. \paragraph{Testing Method 1:} In order to determine whether the OpenMath
  116. expressions are compliant, we shall introduce them back into the
  117. translator. If the translator correctly parses them then they are
  118. compliant. Additionally, we will check the expressions individually to
  119. ensure they are correct.
  120. \paragraph{Testing Method 2:} To determine if MathML expressions produced
  121. are MathML compliant, we shall translate them back to OpenMath. If the
  122. translator reads through them correctly then we can conclude the
  123. expressions are compliant. Furthermore, we will try and render the
  124. generated MathML expressions using IBM's TechExplorer. If TechExplorer
  125. renders all MathML expressions generated then we have more reason's to
  126. confirm that the MathML output is MathML compliant.
  127. \paragraph{Results:} The testing procedures all produced satisfying results. The translator's output can be parsed by itself validating the
  128. expressions. Furthermore, IBM's TechExplorer successfully parsed and rendered a large number
  129. of generated MathML1.0 expressions. \\
  130. The results produced throughout these tests were mostly accurate, and when not, the translator was corrected. We recomend the user to run all the
  131. examples in {\tt examples.om} and {\tt examples.mml} to get a better idea of the translation efficiency. It is possible that mistakes have pased
  132. unnoticed. Reassuringly, the design is robust enough and most bugs should be quick to eliminate.
  133. \section{Interface Limitations}
  134. Testing of the interface has also revealed its limitations. Various
  135. aspects of the translation process have not been properly solved. It is
  136. important that we enumerate the areas where the translator performs
  137. poorly.
  138. In section \ref{boundvars} we mentioned that some OpenMath operators
  139. encoded their bound variables within lambda expressions. We also said
  140. that this was not compulsory. The translator however only deals with
  141. expressions where the bound variable is within a lambda expression. Other
  142. cases cause the translator to abort promptly.
  143. The analysis in section \ref{scope} discussed the importance of defining
  144. each operator's scope. The OpenMath/MathML translator gets confused when
  145. scopes are ambiguous and aborts.
  146. MathML element {\tt partialdiff} is not translated properly in most
  147. cases. Only when the variables of differentiation have an order of
  148. derivation equal to one. In all other cases the translator produces
  149. incorrect results or aborts.
  150. The translator will reject MathML expressions containing operators
  151. defined within \verb|<semantic>| tags. This is clearly something which
  152. will have to be implemented in the future, since the \verb|<semantic>|
  153. tags may contain OpenMath code.
  154. The translator is capable of distinguishing incorrect expressions from valid ones. Unfortunately there was not enough time to implement a
  155. constructive set of error messages. These error messages should have been able to quickly inform the user why a translation might have been
  156. aborted, or what problems there are with the input impeding tranlation.
  157. Finally, there is an aspect of REDUCE which limits the interface.
  158. Contrary to XML, which is case sensitive as is stated in the XML
  159. standard~\cite{xml}, REDUCE is case insensitive. Consequently when
  160. translating an expression with variables or function names using
  161. capital letters, REDUCE will produce only small letters. This may in
  162. some occasions create confusion for the user or even distort the
  163. semantics.
  164. \section{Conclusion}
  165. Although 170 examples might not be enough to test the translator in all situations, they did demonstrate that the translator coped well with the
  166. difficulties of OpenMath/MathML translation. Because these examples are a representative selection of most OpenMath and MathML operators and
  167. situations, the satisfying results confirm that the task of accurate translating has been achieved.