Ingrid Martínez wrote:
>
> Hi,
>
> I want to include some data as value in parameter using <![CDATA, how
> can use it ? I like to use to avoid escaping the special charaters.
>
> I'm try try to use like follow, but doesn't work
>
> <suite name="Suite1" verbose="1">
> <test name="Constraints">
> <classes>
> <class
>
> name="com.qoslabs.phronesis.episteme.constraints.ContraintParserTest" /
>>
> <methods>
> <include name="contraintParser" />
> </methods>
> </classes>
> <parameter>
> <name>constraint</name>
> <value>
> <![CDATA[
>
> Set { InstanceOf {T(otro)} Data Pattern {"qwe"}}
> Set { InstanceOf {T(otro)} Data Pattern {"qwe"}}
> Set { InstanceOf {T(otro)} Data Pattern {"qwe"}}
> Set { InstanceOf {T(otro)} Data Pattern {"qwe"}}
>
> }
>
> ]]>
> </value>
>
> </parameter>
>
> </test>
> </suite>
>
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "testng-users" group.
> To post to this group, send email to testng...@googlegroups.com.
> To unsubscribe from this group, send email to
> testng-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/testng-users?hl=en.
>
>
>
--
View this message in context: http://old.nabble.com/How-can-I-use-CDATA-inside-Parameters-tp29453592p32691791.html
Sent from the testng-users mailing list archive at Nabble.com.
<suite name="Platform API Functional Test">
<test name="PLTFM-1">
<classes>
<class name="TestCase"/>
</classes>
<parameter name="description" value="Create an Account"/>
<parameter name="service" value="ipinfo.ondemand.production.quova"/>
<parameter name="APICalls" value="simple data"/>
</test>
<test name="PLTFM-2">
<classes>
<class name="TestCase"/>
</classes>
<parameter name="description" value="Create an Asset"/>
<parameter name="service" value="ipinfo.ondemand.production.quova"/>
<parameter name="APICalls" value="<![CDATA[<data>my data</data>]]>"/>
</test>
<test name="PLTFM-3">
<classes>
<class name="TestCase"/>
</classes>
<parameter name="description" value="Create an Identity"/>
<parameter name="service" value="ipinfo.ondemand.production.quova"/>
<parameter name="APICalls" value="simple data"/>
</test>
</suite>
Here is my Java:
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
public class TestCase {
@Parameters ({ "description", "service", "APICalls" })
@Test
public void myMethod(String description, String service, String apiCalls)
{
System.out.println(description);
System.out.println(service);
System.out.println(apiCalls);
assert apiCalls.equals("simple data");
}
}
Here is the error:
org.testng.TestNGException: org.xml.sax.SAXParseException: The value of
attribute "value" associated with an element type "null" must not contain
the '<' character.
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:305)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Caused by: org.xml.sax.SAXParseException: The value of attribute "value"
associated with an element type "null" must not contain the '<' character.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
at
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
at
com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:932)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanAttribute(XMLDocumentFragmentScannerImpl.java:1539)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1316)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:17)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:10)
at org.testng.xml.Parser.parse(Parser.java:170)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:275)
... 3 more
--
View this message in context: http://old.nabble.com/How-can-I-use-CDATA-inside-Parameters-tp29453592p32725097.html
http://testng.org/testng-1.0.dtd.php has this:
<!ELEMENT parameter ANY>
<!ATTLIST parameter
name CDATA #REQUIRED
value CDATA #REQUIRED >
shouldn't that take care of it?
thanks, Mark
Cedric Beust wrote:
>
> An attribute needs to be declared of CDATA type in order to allow CDATA
> value, which the TestNG DTD doesn't do in this case.
>
> Source <http://en.wikipedia.org/wiki/CDATA#CDATA-type_attribute_value>.
--
View this message in context: http://old.nabble.com/How-can-I-use-CDATA-inside-Parameters-tp29453592p32725742.html
so, if the value attribute were a text element within the parameter element,
we could put CDATA in there.
example:
<test name="PLTFM-2">
<classes>
<class name="TestCase"/>
</classes>
<parameter name="APICalls">
<value> <![CDATA[<data>mydata</data>]]> </value>
</parameter>
</test>
But, value is an attribute, not a nested element within parameter. The
person who originally started this
thread (Martinez), appeared to be trying to use value as a nested element,
but was unsuccessful.
I was not able to get that to parse either.
Having CDATA as parameter input is very useful, if we could accomplish it.
Then we can have XML data
structures passed in as parameters to our tests without all the < kind of
escaping.
thanks to all
--
View this message in context: http://old.nabble.com/How-can-I-use-CDATA-inside-Parameters-tp29453592p32738417.html