[xmlparser]Code-Test

/------------------------------ | xmlparser.bat |------------------------------ @echo off java -jar xmlparser.jar com.xml.XMLParser using.xml /------------------------------ | 测试输出 |------------------------------ version=1.0 encoding=null root=#2 document Level=0 [type=2]document Level=1 [type=3] Level=1 [type=2]properties Level=2 [type=3] Level=2 [type=2]title Level=3 [type=3]Using the Maven Cactus plugin Level=2 [type=3] Level=2 [type=2]author Attributes: [[email protected]] Level=3 [type=3]Vincent Massol Level=2 [type=3] Level=1 [type=3] Level=1 [type=2]body Level=2 [type=3] Level=2 [type=2]section Attributes: [name=Using the Cactus plugin] Level=3 [type=3] Level=3 [type=2]ol Level=4 [type=3] Level=4 [type=2]li Level=5 [type=3] Create a Level=5 [type=2]code Level=6 [type=3]src/test-cactus Level=5 [type=3] directory in your project and put your Cactus test classes in it (with the normal package directory structure). Note that the location of the Cactus test sources can be configured through the Level=5 [type=2]code Level=6 [type=3]cactus.src.dir Level=5 [type=3] property. Level=4 [type=3] Level=4 [type=2]li Level=5 [type=3] Create a Level=5 [type=2]code Level=6 [type=3]build.properties Level=5 [type=3] file in your project root directory (where Level=5 [type=2]code Level=6 [type=3]project.xml Level=5 [type=3] is located) and define in it the location of the container you wish to use for the tests. For example, if you wish to run the Cactus tests on Tomcat 4.1.24 and on Resin 2.6, you will write: Level=4 [type=3] Level=4 [type=2]source Level=5 [type=5]<![CDATA[ cactus.home.tomcat4x = C:/Apps/jakarta-tomcat-4.1.24 cactus.home.resin2x = C:/Apps/resin-2.1.6 ]]> Level=4 [type=3] Level=3 [type=3] Level=3 [type=2]subsection Attributes: [name=Running tests packaged in a WAR] Level=4 [type=3] Level=4 [type=2]p Level=5 [type=3] If you're testing Servlets, Filters, JSPs or Taglibs, simply type Level=5 [type=2]code Level=6 [type=3]maven cactus:test Level=5 [type=3] (or Level=5 [type=2]code Level=6 [type=3]maven cactus Level=5 [type=3] for short) to run the Cactus tests. Level=4 [type=3] Level=3 [type=3] Level=3 [type=2]subsection Attributes: [name=Running tests packaged in an EAR] Level=4 [type=3] Level=4 [type=2]p Level=5 [type=3] Make sure you have created a Level=5 [type=2]code Level=6 [type=3]src/webapp/WEB-INF/web.xml Level=5 [type=3] file. You can put inside the Level=5 [type=2]code Level=6 [type=3]<ejb-ref> Level=5 [type=3] entries required to call your EJBs from your Cactus test case classes. Level=4 [type=3] Level=4 [type=2]p Level=5 [type=3] To start your EJB unit tests, simply type Level=5 [type=2]code Level=6 [type=3]maven cactus:test-ear Level=5 [type=3]. Level=4 [type=3] Level=3 [type=3] Level=3 [type=2]subsection Attributes: [name=Custom test jars] Level=4 [type=3] Level=4 [type=2]p Level=5 [type=3] Some jars are used only for testing (for example, DbUnit). These jars can be entered as dependencies in the Level=5 [type=2]code Level=6 [type=3]project.xml Level=5 [type=3] and tagged with Level=5 [type=2]code Level=6 [type=3]cactus.bundle Level=5 [type=3]. When the Cactus plugin finds such jars it will automatically add them to the deployed war. For example: Level=4 [type=3] Level=4 [type=2]source Level=5 [type=5]<![CDATA[ <dependency> <groupId>dbunit</groupId>> <artifactId>dbunit</artifactId>> <version>1.5.5</version> <properties> <cactus.bundle>true</cactus.bundle> </properties> </dependency> ]]> Level=4 [type=3] Level=3 [type=3] Level=2 [type=3] Level=1 [type=3] /------------------------------ | 测试文件using.xml |------------------------------ <?xml version="1.0"?> <document> <properties> <title>Using the Maven Cactus plugin</title> <author email="[email protected]">Vincent Massol</author> </properties> <body> <section name="Using the Cactus plugin"> <ol> <li> Create a <code>src/test-cactus</code> directory in your project and put your Cactus test classes in it (with the normal package directory structure). Note that the location of the Cactus test sources can be configured through the <code>cactus.src.dir</code> property. </li> <li> Create a <code>build.properties</code> file in your project root directory (where <code>project.xml</code> is located) and define in it the location of the container you wish to use for the tests. For example, if you wish to run the Cactus tests on Tomcat 4.1.24 and on Resin 2.6, you will write: </li> <source><![CDATA[ cactus.home.tomcat4x = C:/Apps/jakarta-tomcat-4.1.24 cactus.home.resin2x = C:/Apps/resin-2.1.6 ]]></source> </ol> <subsection name="Running tests packaged in a WAR"> <p> If you're testing Servlets, Filters, JSPs or Taglibs, simply type <code>maven cactus:test</code> (or <code>maven cactus</code> for short) to run the Cactus tests. </p> </subsection> <subsection name="Running tests packaged in an EAR"> <p> Make sure you have created a <code>src/webapp/WEB-INF/web.xml</code> file. You can put inside the <code><ejb-ref></code> entries required to call your EJBs from your Cactus test case classes. </p> <p> To start your EJB unit tests, simply type <code>maven cactus:test-ear</code>. </p> </subsection> <subsection name="Custom test jars"> <p> Some jars are used only for testing (for example, DbUnit). These jars can be entered as dependencies in the <code>project.xml</code> and tagged with <code>cactus.bundle</code>. When the Cactus plugin finds such jars it will automatically add them to the deployed war. For example: </p> <source><![CDATA[ <dependency> <groupId>dbunit</groupId>> <artifactId>dbunit</artifactId>> <version>1.5.5</version> <properties> <cactus.bundle>true</cactus.bundle> </properties> </dependency> ]]></source> </subsection> </section> </body> </document>

你可能感兴趣的:([xmlparser]Code-Test)