Test case execution in testlink with Testcase Unique custom field by uploading xml file - testlink

We are using Testlink 1.9.5. I want to execute my testcase using XML file.
But I am facing one issue. my testcases is executing successfully but the custom field result(Actual Time custom field) is not saving. it's like testlink skip it
I am using below XML :-
<?xml version="1.0" encoding="UTF-8"?>
<results>
<testcase external_id="kan-8" >
<tester>shubham</tester>
<result>f</result>
<notes> Test case has been passed scuccessfully </notes>
<custom_fields>
<custom_field>
<name><![CDATA[Actual Time]]></name>
<value><![CDATA[30]]></value>
</custom_field>
</custom_fields>
</testcase>
</results>
I have tried with multiple permutation combeniation but every time I am getting a same result.
My custom fields are define as below :-

Related

Including a CDATA field in a Service Connector

An API I am communicating with is Soap based and requires XML with inner XML (CDATA) in the request.
For the service connector action test I have hard-coded the inner xml with this format:
<![CDATA[
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationCrossReferenceId="123">
...
...
</Application> ]]>
where the dots indicate the data contained.
When running the test the request payload has been transformed to the html entity for < which is $lt; - as seen below :
Is there a way to avoid this?
This is a bug in Informatica. the other characters are decoded back to their original correctly, as described in KB 512858, &gt and &lt however are not decoded.
A bug report has been raised 29.05.2020.
Edit: Further investigation revealed that using CDATA was not necessary in my case, instead I was able to use the following input for the body binding:
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationCrossReferenceId="123">
...
...
</Application>

XMLNS attribute removed by Slow Cheetah transformation

I'm trying to use Slow Cheetah to transform a Windows scheduled task config file. I'm simply trying to add "repetition" node information, like so:
ORIGINAL:
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2013-01-02T09:32:12.2196371</Date>
<Author>xxx</Author>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2013-01-10T01:00:00</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
.....
</Task>
REQUIRED, ADDITIONAL XML
<CalendarTrigger>
<Repetition>
<Interval>PT300S</Interval>
</Repetition>
</CalendarTrigger>
To do this, I have the following transformation file:
<?xml version="1.0" encoding="utf-16" ?>
<Task version="1.2">
<Triggers>
<CalendarTrigger xdt:Transform="Insert">
<Repetition>
<Interval>PT300S</Interval>
</Repetition>
</CalendarTrigger>
</Triggers>
</Task>
The problem I'm having is that all attributes outside of the CalendarTrigger node are removed (and therefore making the resultant transformation config an invalid scheduled task format).
I have tried adding
xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xdt:Transform="SetAttributes" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"
to the Task node, but the attribute is then generated at CalendarTrigger level (and I cannot put this attribute on the original, because I then get "No element in the source document matches '/Task/Triggers' ").
Any pointers?
UPDATE:
The problem seems to be isolated to the xmlns attribute; if I try to include this in the 'Task' node of the original, I get "No element in the source document matches '/Task/Triggers'" - BUT changing this attribute to 'xmlns2' works fine and produces exactly what I need (albeit with an 'xmlns2' attribute!). Is this a known limitation of Slow Cheetah? Anyone know of a potential work-around?
That's because your xdt:Transform="Insert" is one level to high.
This should work:
<?xml version="1.0" encoding="utf-16" ?>
<Task xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<Triggers>
<CalendarTrigger>
<Repetition xdt:Transform="Insert">
<Interval>PT300S</Interval>
</Repetition>
</CalendarTrigger>
</Triggers>
</Task>

Sharepoint batch for MultiChoice field value insertion

So i have a problem regarding usage of sharepoint list webservices.
I need to get the syntax right for Sharepoint batch script for insertion of new items.
Everyhing works fine except multichoice field type.
I insert the data, but nomatter how i do it, it shows up on SP list item details OK, but when trying to edit item in SP, i see, that SP have taken the value i sent to this field as text string, and does not check the items i have saved as selected.
The script for now is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<Batch OnError="Return">
<Method ID='1' Cmd='New'>
<Field Name='SecurityCheckpoints'>1st checkpoint;2nd checkpoint</Field>
</Method>
</Batch>
Definition for that field is like this:
<Field Type="MultiChoice"
DisplayName="Checkpoints allowed"
Required="TRUE"
FillInChoice="FALSE"
ID="{guid-guid-guid-guid-guid}"
SourceID="{guid-guid-guid-guid-guid}"
StaticName="SecurityCheckpoints"
Name="SecurityCheckpoints"
ColName="ntext2"
RowOrdinal="0"
Version="4">
<CHOICES>
<CHOICE>1st checkpoint</CHOICE>
<CHOICE>2nd checkpoint</CHOICE>
<CHOICE>3rd checkpoint</CHOICE>
</CHOICES>
<Default>1st checkpoint</Default>
</Field>
I have to implement something like custom UI for sharepoint in different-purpouse silverlight app, and so i am using my own webservice to be a proxy between SP and SL, i retrieve SP list definition and dinamicaly build UI controls, so user can fill in the forms.
How do i form the script, so items are selected(ticked) in the SP instead of SP saving them as just string value?
If I use script with only one item ("1st checkpoint"), SP processes it ok, it there is many, data is saved as text string?
What i am doing wrong? How do i correctly seperate multiple values?
I have searched high and low, but have not found example of SP update script, where multichoice sample is included.
Thank You in advance!
I found the sollution - it was too easy:
instead of seperating the choice values using semicolon ";", they had to be seperated using ";#", and putting it in front and in behind the whole list.
So rather than using this:
1st checkpoint;2nd checkpoint
<?xml version="1.0" encoding="UTF-8"?>
<Batch OnError="Return">
<Method ID='1' Cmd='New'>
<Field Name='SecurityCheckpoints'>1st checkpoint;2nd checkpoint</Field>
</Method>
</Batch>
It had to be done like this:
;#1st checkpoint;#2nd checkpoint;#
<?xml version="1.0" encoding="UTF-8"?>
<Batch OnError="Return">
<Method ID='1' Cmd='New'>
<Field Name='SecurityCheckpoints'>;#1st checkpoint;#2nd checkpoint;#</Field>
</Method>
</Batch>
PS:I dont know was it correct way to do this, but I answered my own question. Just for others to know.
I run code below successfully.
<?xml version="1.0" encoding="UTF-8"?><ows:Batch OnError="Return">
<Method ID="0"><SetList>3933c528-5747-4fc7-bdec-6465294997dd</SetList>
<SetVar Name="Cmd">Save</SetVar>
<SetVar Name="ID">New</SetVar>
<SetVar Name="urn:schemas-microsoft-com:office:office#Temp_UNID">8D8DE35CFFE9EEEAC12570920052A8FD</SetVar>
<SetVar Name="urn:schemas-microsoft-com:office:office#Title"> - Birch Data Exchange Specification</SetVar>
<SetVar Name="urn:schemas-microsoft-com:office:office#C0370A_Agora_DocNum">8AL020210178ZZASB</SetVar>
<SetVar Name="urn:schemas-microsoft-com:office:office#C0370A_Agora_Phase"></SetVar>
<SetVar Name="urn:schemas-microsoft-com:office:office#C0370A_Agora_Author">Jerome BOURGER</SetVar>
<SetVar Name="urn:schemas-microsoft-com:office:office#C0370A_Agora_ServicesOri"> </SetVar>
<SetVar Name="urn:schemas-microsoft-com:office:office#C0370A_Agora_Type">;#3 - Quality Plan;#Objectives;#Progress Plan;#Follow-up;#Reports;#</SetVar>
<SetVar Name="urn:schemas-microsoft-com:office:office#C0370A_Agora_Keywords"></SetVar> </Method></ows:Batch>

XSLT transformation passing parameters

I am trying to pass parameters during an XSLT transformation. Here is the xsl stylesheet.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="param1" select="'defaultval1'" />
<xsl:param name="param2" select="'defaultval2'" />
<xsl:template match="/">
<xslttest>
<tagg param1="{$param1}"><xsl:value-of select="$param2" /></tagg>
</xslttest>
</xsl:template>
</xsl:stylesheet>
The following in the java code.
File xsltFile = new File("template.xsl");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document stylesheet = builder.parse("template.xsl");
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer xsltTransformer = transformerFactory.newTransformer(new DOMSource(stylesheet));
//Transformer xsltTransformer = transformerFactory.newTransformer(new StreamSource(xsltFile));
xsltTransformer.setParameter("param1", "value1");
xsltTransformer.setParameter("param2", "value2");
StreamResult result = new StreamResult(System.out);
xsltTransformer.transform(new DOMSource(builder.newDocument()), result);
I get following errors:-
ERROR: 'Variable or parameter 'param1' is undefined.'
FATAL ERROR: 'Could not compile stylesheet'
However, if i use the following line to create the transformer everything works fine.
Transformer xsltTransformer = transformerFactory.newTransformer(new StreamSource(xsltFile));
Q1. I just wanted to know whats wrong in using a DOMSource in creating a Transformer.
Q2. Is this one of the ideal ways to substitute values for placeholders in an xml document? If my placeholders were in a source xml document is there any (straightforward) way to substitute them using style sheets (and passing parameters)?
Q1: This is a namespace awareness problem. You need to make the DocumentBuilderFactory namespace aware:
factory.setNamespaceAware(true);
Q2: There are several ways to get the values from an external xml file. One way to do this is with the document function and a top level variable in the document:
<!-- Loads a map relative to the template. -->
<xsl:variable name="map" select="document('map.xml')"/>
Then you can select the values out of the map. For instance, if map.xml was defined as:
<?xml version="1.0" encoding="UTF-8"?>
<mappings>
<mapping key="value1">value2</mapping>
</mappings>
You could remove the second parameter from your template, then look up the value using this line:
<tagg param1="{$param1}"><xsl:value-of select="$map/mappings/mapping[#key=$param1]"/></tagg>
Be aware that using relative document URIs will require that the stylesheet has a system id specified, so you will need to update the way you create your DOMSource:
DOMSource source = new DOMSource();
source.setNode(stylesheet);
source.setSystemId(xsltFile.toURL().toString());
In general, I suggest looking at all of the options that are available in Java's XML APIs. Assume that all of the features available are set wrong for what you are trying to do. I also suggest reading the XML Information Set. That specification will give you all of the definitions that the API authors are using.

Getting and displaying data from database with xforms on submission

I have a database with an xml document in it, and I want to display a transformed xml on my xforms page, when the submission is sent (I'm using orbeon forms).
My solution is, that on the submission my servlet gets the xml from the database, writes it into a file, xslt transforms the xml tree (when and how should I do the transformation?), but I don't know, how to display this file on the xforms page. Maybe the replace="instance" attribute in can help, but i don't know how.
Thanks!
Now, after Alessandro's advice, Im trying to use this xpl thing, but it doesn't work.
In the model:
<xforms:insert nodeset="instance('inst2')"
origin="xxforms:call-xpl('oxf:/resources/pipeline.xpl', 'data',
instance('inst1'), 'data')"/>
in pipeline.xpl:
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<p:param type="input" name="data"/>
<p:param type="output" name="data"/>
<p:processor name="oxf:xslt">
<p:input name="data" href="#data"/>
<p:input name="config" href="transform.xsl"/>
<p:output name="data" ref="data"/>
</p:processor>
My instance, that I want to transform is "complaint-instance", the transformed instance called "trf-instance", the pipeline.xpl file is in the same directory with my xforms page. My styesheet called customerToOperator.xsl. What's wrong in my code?
I just noticed, the note: "If you are using separate deployment, the service and XSLT transformation must be present in the Orbeon WAR file, instead of within your application."
Ehm... Where should I put these files?
my app in details:
a) an xforms page, with 2 instances:
<instance id='inst1'>
<name>
<lastname/>
<firstname/>
</name>
</instance>
<instance id='inst2'>
<fname>
<fullname/>
</fname>
</instance>
I got 2 input fields, referenced on name/lastname and name/firstname.
I have an xforms:insert node, described above, and an xforms:submission node:
<xforms:submission
id="save-submission"
ref="instance('inst2')"
action="/my-servlet"
method="post"
replace="none">
I added 2 files to orbeon/WEB-INF/resources, the pipeline.xpl, (described above) and transform.xsl:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<fname>
<fullname>
<xsl:value-of select="name/firstname"/>
<xsl:value-of select="name/lastname"/>
</fullname>
</fname>
</xsl:template>
</xsl:stylesheet>
And I have a servlet, which writes the posted instance on the console (now it writes inst2 on the console, but without the user input data, only the nodes...)
A really need to fix this...
Thanks again!
To get the XML from a database (relational or not) and apply a transformation, instead of writing my own servlet, I would use an XPL pipeline, and map this pipeline to a URL through the page flow. Now you have a service that answers to an HTTP request and returns XML. To call the service from XForms, you use an <xforms:submission replace="instance">. You end up with the XML in an instance, and you can display it with something like: <xforms:output value="saxon:serialize(instance(), 'xml')"/>.
In all cases (including separate deployment), the pipeline and XSLT file must be in the "resources". Usually, this means the WEB-INF/resources of the Orbeon's web app. But you can also do more fancy things by setting up the Orbeon resource manager to also use other directories on disk.