question

cwhitty avatar image
cwhitty asked cwhitty posted

floating types as key values

I built a table response map for the following:

 

TrialNumber FrameSizeType ConfiguredFrameSize AvgFrameSize iMIXDistribution IntendedLoad(%) OfferedLoad(%) Result Throughput(%) MaxLatencyThresholdExceeded OutOfSeqThresholdExceeded TxFrameCount RxFrameCount FrameLoss PercentLoss OfferedLoad(fps) ForwardingRate(fps) MinimumLatency(us) MaximumLatency(us) AverageLatency(us) MinimumJitter(us) MaximumJitter(us) AverageJitter(us) OutOfSequenceCount FloodFrameCount UnexpectedRxSignatureFrames Duration(sec)
1 Fixed 1280.0 1280.0 N/A 17.5 17.501 Passed 17.501 False False 13462 13462 0 0.0 1682.75 1682.63 10183.51 13182.83 10598.01 3.13 2539.49 122.021 0 0 No 8.0
1 Fixed 1518.0 1518.0 N/A 16.0 16.001 Passed 16.001 False False 10404 10404 0 0.0 1300.5 1300.34 10681.61 12371.66 11293.84 0.05 956.65 106.022 0 0 No 8.0

 

The 3rd value in each row (in this case, 1280.0 and 1518.0) are my key values.  So, I want iTest to create queries using this as an index and then chart the results in a bar chart.  If I manipulate the output so that 'ConfiguredFrameSize' is 1280 and 1518, I can use [query Tput Throughput_by_ConfiguredFrameSize($i)] where $i is 1280 or 1518.  But, in its raw form as a floating type, iTest throws up and says:

"Error Cannot convert "" to number 3.3.1 3.1 display2544TputResults"

 

Can I not use floating types as key values for my queries?

iTestresponse map
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
EricGregMiller avatar image
EricGregMiller answered EricGregMiller posted

You can use floating point values in your queries. In fact, you can perform numeric comparisons beyond simple equality if you wish.

 

I build a sample test out of your data and ran into the same problem you are experiencing. In my test the problem is caused because the xpath queries get confused between string and floating point data.

 

In the response map, iTest generates queries that look like the following:

Query: Result_by_ConfiguredFrameSize. Xpath: mapped/Tabular/table1/table/row[ConfiguredFrameSize='{0}']/Result

 

The generated xpath treats the index value as a string, which is seen in the ConfiguredFrameSize='{0}' portion. This looks up the row where ConfiguredFrameSize is equal to the input argument, represented by {0}. However the input argument is surround by quotes, '{0}', which means the query treats the comparison data as a string, not a floating point number.

 

Meanwhile, iTest's analysis rule wizard builds a query like this: Result_by_ConfigureFrameSize(1280.0). Or you build one without the ".0" like this Result_by_ConfigureFrameSize(1280). Either way the index is treated as a floating point. A comparison is made between string and floating point, which causes a problem.

 

There are two ways to make this work. The first is to change the index sent to the query to a string: Result_by_ConfigureFrameSize('1280.0'). This is doable, but I don't think it's what you want.

 

The second way to fix this is to edit the queries in your response map. In the response map select the Queries tab. In the Queries generated by response map section select the query you want to edit and push the Customize button. This is shown below for the FrameSizeType query.

CustomizeButton.png

 

After you push the customize button, the query will show up in the Custom queries section, where you can edit it. In the Values query field remove the quotes from the xpath. The new xpath looks like this: mapped/Tabular/table1/table/row[ConfiguredFrameSize={0}]/FrameSizeType.

 

I hope this helps. Thanks for bringing an interesting issue to our forum.


CustomizeButton.png (100.7 KiB)
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.