question

dechaoz05 avatar image
dechaoz05 asked ericnute edited

another xpath question - want to verify all elements in a column have the same value

All, this is my table:

 


Mod  Sub-Module                  Model              Serial       Hw     Status
---- --------------------------- ------------------ ----------- ------- -------
  1  IEEE Voice Daughter Card    WS-F6K-48-AF       SAL1035ZNNZ  2.1    Other
  2  SAMI Daughterboard 1        SAMI-DC-BB         SAD1231052V  1.2    Ok
  2  SAMI Daughterboard 2        SAMI-DC-BB         SAD1231054C  1.2    Ok
  3  SAMI Daughterboard 1        SAMI-DC-BB         SAD114207FE  1.1    Ok
  3  SAMI Daughterboard 2        SAMI-DC-BB         SAD114006X6  1.1    Ok
  4  SAMI Daughterboard 1        SAMI-DC-BB         SAD121603VM  1.1    Ok
  4  SAMI Daughterboard 2        SAMI-DC-BB         SAD121204EP  1.1    Ok
  5  Policy Feature Card 3       7600-PFC3CXL       JAE1139XW3K  1.0    Ok
  5  C7600 MSFC4 Daughterboard   7600-MSFC4         JAE1139Y7YJ  1.1    Ok
  6  SAMI Daughterboard 1        SAMI-DC-BB         SAD113909SL  1.1    Ok
  6  SAMI Daughterboard 2        SAMI-DC-BB         SAD121802YM  1.1    Ok
  7  SAMI Daughterboard 1        SAMI-DC-BB         SAD1231053X  1.2    Ok
  7  SAMI Daughterboard 2        SAMI-DC-BB         SAD1231054A  1.2    Ok
  8  SAMI Daughterboard 1        SAMI-DC-BB         SAD1231052N  1.2    Ok
  8  SAMI Daughterboard 2        SAMI-DC-BB         SAD1231054E  1.2    Ok
  9  SAMI Daughterboard 1        SAMI-DC-BB         SAD121101PP  1.1    Ok
  9  SAMI Daughterboard 2        SAMI-DC-BB         SAD121101PL  1.1    Ok

 

 

I want to have a query that verifies all the Status is "Ok".

 

I tried the following queries

//Status="Ok"

//Status[@*]="Ok"

 

but they will return true as long as ANY element is "Ok". How do I write a query that verifies ALL of them are Ok?

 

thx

Dean

iTestxpath
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

·
KumarS avatar image
KumarS answered KumarS posted

iTest analysis rules are made up two parts:

1. extractors

2. processors

 

Using a query, you can extract data. In this case, you should choose a query which will return a list of matched items. So your query should be such that it returns every value of the Status column.

 

In the processor - you will use "assert". This processor will analyze each value matched by your query and based on these properties, it will execute "true" or "false" sections appropriately.

1. Analyze each separately

2. Do nothing

3. True if all true

4. True if any true

5. Fail Test


analyze_each.PNG (41.3 KiB)
1 comment
10 |950

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

dechaoz05 avatar image dechaoz05 commented ·

thx Kumar, just figured that one out too

 

dean

0 Likes 0 ·

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.