jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lal Mani Kashyap" <Lal.Kash...@infogain.com>
Subject RE: Need help in x-path extraxter in xml
Date Tue, 03 Jun 2014 11:00:32 GMT
Hi Eric,

As we know  Xpath extracter is used as per below documentation:

XPath Extractor : Why we use this ?
- To extract info from structured response. Ex- 
-to get a table's nth field's value(using query)
-to get attribute's name(using query)

Basic elements are : 
Apply to : It will indicate where the extracted information will be used
Main sample only (information useable in main/used sample)
Sub-samples only (information useable in sub-samples
Main sample and sub-samples - information useable to both.
JMeter Variable - information will be checked with the variable declared here.
Note: This variable should be present previously.
Use Tidy (tolerant parser) :
-check this for HTML response, it will be converted to valid XHTML using Tidy
-Un check this for XHTML and XML responses.(like - RSS Feed)
Quiet : Sets the Tidy Quiet flag(enabled with tidy)
Report Errors : If a Tidy error occurs, then set the Assertion accordingly(enabled with tidy)
Show warnings : Sets the Tidy showWarnings option(enabled with tidy) 
Use Namespaces : (if tidy is not selected)
-XML parser will use namespace resolution
Note : Namespaces declared on the root element will be recognized
Validate XML : Check the document against its schema.(if tidy is not selected)
Ignore Whitespace :Ignore Element Whitespace.(if tidy is not selected)
Fetch External DTDs : If selected, external DTDs are fetched(if tidy is not selected)
If "Return entire XPath fragment instead of text content?" is selected, the fragment will
be returned rather than the text content.
Reference Name : The variable name that we choose to use the extracted info.
XPath Query : Desire XPath query . I will provide different post for this. 
Default Value : If no match, which value will be used.


Reference Name: Response_Date_Time_GMT
Xpath Query:
//Response_Header/Response_Header_Info/@Response_Date_Time_GMT = "2014-05-29T16:38:27.000000000"
XML Parsing Options=Use Namespaces
Apply to Main sample only
Default Value: Not found

I have used Debug sampler and getting Response data  value as JMeter Variables:
JMeterThread.last_sample_ok=true
JMeterThread.pack=org.apache.jmeter.threads.SamplePackage@1c8b2d5d
Response_Date_Time_GMT=false
Response_Date_Time_GMT_1=false
Response_Date_Time_GMT_matchNr=1
START.HMS=111409
START.MS=1401774249317
START.YMD=20140603
TESTSTART.MS=1401791901242


Please let me know Response_Date_Time_GMT is correct or not ?

Thanks in advance
Lalmani


-----Original Message-----
From: Everman, Eric [mailto:eeverman@usgs.gov] 
Sent: Monday, June 2, 2014 8:44 PM
To: JMeter Users List
Subject: Re: Need help in x-path extraxter in xml

Hi Lal -

As an example, you could use this XPath as an XPath Assertion:
//Request_Header/Request_Header_Info/@Request_Date_Time_GMT = '2014-05-29T16:38:27.000000000’

That should return TRUE for the document you posted in your question.


Good Luck,

—ee

On Mon, Jun 2, 2014 at 5:01 AM, Lal Mani Kashyap <Lal.Kashyap@infogain.com>
wrote:

> Hi All,
>
>
>
> I am getting response against xml request in Jmeter.
>
> I need to validate the xml.
>
>
>
> So I want to extract values with Post Processor (Xpath extractor) and 
> then like add xpath assertion.
>
>
>
> Can anyone give an example which will me a lot  : my xml is given 
> below
>
>
>
> <?xml version="1.0" ?>
>
> <Credit_Request xmlns="http://Zoot.zootweb.com/services">
>
>   <Request_Header>
>
>     <Request_Header_Info
>
>         Request_Date_Time_GMT="2014-05-29T16:38:27.000000000"
>
>         Request_Date_Time_Local="2014-05-29T11:38:27.000000000">
>
>       <Header_Info
>
>           Request_Response_Trans_ID="lYtQrlnzwdMTzUVH9y7"
>
>           Service_Version_ID="02_00_00"/>
>
>     </Request_Header_Info>
>
>     <Requestor_Info
>
>         Client_Ref_ID="000000000"
>
>         Requestor_Channel_Code="STORE"
>
>         Requestor_Location_ID="ABC 3-FLINT"
>
>         Requestor_Location_State_Code="TX"
>
>         Requestor_Organization_Code="ABC WAREHOUSE"
>
>         Requestor_POS_System_ID="WEB"
>
>         Requestor_User_ID="dev"/>
>
>   </Request_Header>
>
>   <Credit_Request_Info
>
>       Consumer_Initiated_Flag="F"
>
>       Requestor_Transaction_Amount="100.0">
>
>     <Consumer_Info>
>
>       <General_Consumer_Info
>
>           Birth_Date="1987-11-11"
>
>           Home_Telephone_Number="1111111111"
>
>           SSN_Or_Tax_ID="999999911"
>
>           Stated_Income_Frequency_Type="ANNUALLY"
>
>           Stated_Income_Or_Revenue_Amount="1000">
>
>         <Consumer_Name
>
>             First_Name="dfd"
>
>             Last_Name="dfd"/>
>
>         <Current_Physical_Address
>
>             Address_City="dfd"
>
>             Address_Disposition_Type="OWN"
>
>             Address_Line_1="dfd"
>
>             Address_Postal_Code="12345"
>
>             Address_State_Code="LA"
>
>             Monthly_Payment="100"/>
>
>       </General_Consumer_Info>
>
>     </Consumer_Info>
>
>   </Credit_Request_Info>
>
> </Credit_Request>
>
>
>
> *Thanks & Regards,*
>
> *[image: Description: Description: Description: Description: Infogain
> Logo_E-mail]* <http://www.infogain.com/>
>
> *LAL MANI KASHYAP *| Sr. Software Engineer
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Mime
View raw message