Annulleret

A framework for testing XML

We need a framework that tests applications that produce XML as output.

This project requires expertise in XML, xpath and xml schemas.

A detailed spec is available.

A simple test suite for a simple "hello world" application that uses this framework is shown below. The hello world application is an application that responds to hello command.

This application can be run as

hello sayhello

This command generates the following output

<XMLResponse status="200" statusText="OK" xmlns="http://xmlconsole.org/2008-04/pc">

<body>

<Hello>XMLUnitTest</Hello>

</body>

</XMLResponse>

This application has been compiled and the executable is placed in folder "Release"

To be able to test this application using XMLUnitTest, the test cases must be defined and saved in a file. For this example, let's assume that the test case is helloworldtest.xml. For this example, let's assume that the desired test is checking whether the content of the "Hello" element is "XMLUnitTest".

<TestCase name="helloworldtest" xmlns="http://xmlunittest.org/2008-06/testcase#">

<ActionSequence>

<Action name="sayhello" >

<Command path="Release/hello" args="sayhello">

<Asserts>

<Assert method="Equal" check="/XMLResponse/body/Hello" value="XMLUnitTest" />

</Asserts>

</Action>

</ActionSequence>

</TestCase>

To run the testcase, the executable "xmlunittest" is used.

xmlunittest -case [url removed, login to view]

<XMLResponse status="200" statusText="OK" xmlns="http://xmlconsole.org/2008-04/pc">

<body>

<TestCaseResult name="helloworldtest" passed="1" failed="0" skipped="0" xmlns="http://xmlunittest.org/2008-06/testcase#">

<ConfigurationResult name="default" passed="1" failed="0" skipped="0">

<ActionTestResults>

<ActionTestResult name="sayhello" passed="1" failed="0" skipped="0">

<Command path="Release/hello" args="sayhello">

<AssertResults>

<AssertResult status="passed" method="Equal" check="/XMLResponse/body/Hello">

<Expected>XMLUnitTest</Expected>

<Actual>XMLUnitTest</Actual>

</AssertResult>

</AssertResults>

</ActionTestResult>

</ActionTestResults>

</ConfigurationResult>

<TestCaseResult>

<body>

</XMLResponse>

This output indicates that the Assert statement has been evaluated and the executable "Release/hello" has behaved as expected and generated a Hello element that contains the the text node "XMLUnitTest".

Færdigheder: XML

Se mere: testing test, xml &, a name for, testing framework, test case, test applications, hello world, framework c, xml http, xml application, xmlns, testing content, http command, xml quot, schemas, statement application, test framework, method available, suite application project, xml simple, generates, check output, action name, testing text, Method Statement

Om arbejdsgiveren:
( 121 bedømmelser ) Belfast, Ireland

Projekt-ID: #265395