.. comment all inline tags to start with _how_scpt_testdata_ .. index:: Scripts; How to - Test Data .. index:: Test Data; How to - Scripts .. _how_scpt_testdata_top: ################################################################################### STEPlib SysML: How To use the Scripts to Generate implementation specific test data ################################################################################### .. include:: /pages/common/pageunderconstruction.txt :start-line: 3 This page explains how to use the Scripts of the STEP architecture to generate the implementation specific Test Data files from the Test Data XML exported from |MD|. The instructions for generating the Test Data model can be found in :ref:`ihow_testData_top`. .. contents:: Contents: :local: :depth: 1 :backlinks: top ============= Prerequisites ============= This assumes that: * The **XSD has already been generated** as described in :ref:`how_scpt_xsd_top` * The scripts have been downloaded from http://git2.boost-lab.net/admins/scriptssteplib * java is installed. ============= Execution ============= .. contents:: Contents: :local: :depth: 1 :backlinks: top ------------------------------------ Generate the Test Data XML ------------------------------------ .. contents:: This has the following steps: :local: :depth: 1 :backlinks: top .. note:: These scripts are work in progress and will be consolidated at a future date. The scripts assume that the **XSD has already been generated** as described in :ref:`how_scpt_xsd_top`. .. index:: Video; How to run Test Data scripts .. index:: Test Data; How to - Scripts Video The video shows the steps in this process. .. raw:: html

^^^^^^^^^^^^^^^^^^^^^^^^ Export from |MD| ^^^^^^^^^^^^^^^^^^^^^^^^ #. Download the **scriptssteplib AP243_working** branch from: http://git2.boost-lab.net/admins/scriptssteplib/tree/AP243_working #. In |MD| use **File > Export To > UML 2.5 XMI File** the following to XML files and store in **scriptssteplib**: * Domain Model Test Data model to file **Domain_model_TestData.xml** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Flatten the xsd that was generated as part of the IS documentation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This script flattens the extensions in the XSD. It copies the DataContainer, and then for each complexType it flattens the extensions so that all the elements are listed in the order expected by the sequence. It removes all the inner content for the elements making the output file much smaller, but it is not a valid xsd - only to be used for sorting the TestData XML. Check **scriptssteplib/AntTestData/VariablesData.xml** has the correct value for **DataContainer** and update if necessary. * (in Windows) open a cmd window from the scriptssteplib/AntTestData/ folder and run the following:: java -jar ../saxon9.jar -t ../AntImp/DomainModel.xsd TestData_flatten_xsd.xsl > ../AntImp/DomainModel_flatten.xsd . ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Generate an unsorted XML from the |MD| XML export ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Check **scriptssteplib/AntTestData/VariablesData.xml** has the correct values (including for the xsd as generated in the previous step set as domain_model_xsd_file) and update if necessary. .. tip:: The is the name of the SysML Package below which the TestData will be gathered. All immediate child packages will be created in their own DataContainer, but from then on packages will be flattened. The
is copied directly into the output XML so must be valid, the content for
in VariablesData.xml is illustrative and the minimum valid content. Generate the AP TestDataUnsorted.xml from the Domain_model_TestData.xml as follows: * (in Windows) open a cmd window from the scriptssteplib/AntTestData/ folder and run the following:: java -jar ../saxon9.jar -t ../Domain_model_TestData.xml TestData_to_xml.xsl > TestDataUnsorted.xml . * (in Windows) to generate the results with **debugging** comments run the following:: java -jar ../saxon9.jar -t debugMode=1 ../Domain_model_TestData.xml TestData_to_xml.xsl > TestDataUnsorted.xml . The resultant file is: scriptssteplib/AntTestData/TestDataUnsorted.xml ^^^^^^^^^^^^ Sort the XML ^^^^^^^^^^^^ The next step is to sort the XML into the correct sequence as specified by the flattened XSD created in the first step. Check **scriptssteplib/AntTestData/VariablesData.xml** has the correct values. This script uses the DataContainer and domain_model_xsd_file, where the latter is the file generated in the first step. * (in Windows) open a cmd window from the scriptssteplib/AntTestData/ folder and run the following:: java -jar ../saxon9.jar -t TestDataUnsorted.xml TestData_sort_xml.xsl > TestData.xml . * (in Windows) to generate the results with **debugging** comments run the following:: java -jar ../saxon9.jar -t debugMode=1 TestDataUnsorted.xml TestData_sort_xml.xsl > TestData.xml . The resultant file is: scriptssteplib/AntTestData/TestData.xml ------------------------------------- Generate the Test Data JSON ------------------------------------- .. todo:: text for this section .. sectionauthor:: |Judith Crockford| .. include:: /keywords.rst