Menu

Use of hu-table-validation tag

prachi
2006-03-09
2013-04-25
  • prachi

    prachi - 2006-03-09

    How to validate contents of table using hu-table-validation tag?
    In our application,clicking on one particular link result page gets opened.
    This page has table.
    So what will be the best practice to write the test case for validating this table.
    Contents of table will be based on whatever data is entered on previous page.

     
    • Christian Hargraves

      Here is an example test case with some documentation. Let me know if this answers your question:

      <qa:testcase xmlns:qa="jelly:jameleon" >
        <qa:httpunit-session application="multi" beginSession="true">
            <qa:hu-table-validation
              functionId="Any row in the table with a colum value 'First Name:' followed by 'Kim' in the next column">
                <qa:hu-table-param>
                    <qa:hu-table-param-name>First Name:</qa:hu-table-param-name>
                    <qa:hu-table-param-value>Kim</qa:hu-table-param-value>
                </qa:hu-table-param>
            </qa:hu-table-validation>

            <qa:hu-table-validation
              functionId="1st table 2nd column 9th row and the 1st table in there.">
              <!-- Look for any column to have 2+2, followed by any column to have 4, but it must exist in the 2nd row -->
                <qa:hu-table-param tableIndex="1->(2,9)1">
                    <qa:hu-table-param-name>2+2</qa:hu-table-param-name>
                    <qa:hu-table-param-value row="2">4</qa:hu-table-param-value>
                </qa:hu-table-param>
            </qa:hu-table-validation>

            <qa:hu-table-validation
              functionId="1st table 2nd column 9th row and the 1st table in there.">
              <!-- Look for any column to have 2+2, then in the 2nd column there be 4, and they must exist in the 2nd row -->
                <qa:hu-table-param tableIndex="1->(2,9)1">
                    <qa:hu-table-param-name>2+2</qa:hu-table-param-name>
                    <qa:hu-table-param-value row="2" col="2">4</qa:hu-table-param-value>
                </qa:hu-table-param>

            </qa:hu-table-validation>

            <qa:hu-table-validation
              functionId="Find a table with the id or name set to 'test3'">
              <!-- Any column must have 2+2, followd by any column that must have 5 -->
                <qa:hu-table-param tableIdentifier="test3">
                    <qa:hu-table-param-name>2+2</qa:hu-table-param-name>
                    <qa:hu-table-param-value>5</qa:hu-table-param-value>
                </qa:hu-table-param>
            </qa:hu-table-validation>

            <qa:hu-table-validation
              functionId="Find a table with the id or name set to 'test3'">
              <!-- The 2nd column must have 5 and don't worry about whether it's capitol or not -->
                <qa:hu-table-param tableIdentifier="test3">
                    <qa:hu-table-param-value col="2">FIVE</qa:hu-table-param-value>
                    <qa:hu-table-param-type>textEqualsIgnoreCase</qa:hu-table-param-type>
                </qa:hu-table-param>
            </qa:hu-table-validation>

            <qa:hu-table-validation
              functionId="Find a table with the id or name set to 'test3'">
              <!-- The 2nd column must have 5-->
                <qa:hu-table-param tableIdentifier="test3">
                    <qa:hu-table-param-value row="2">5</qa:hu-table-param-value>
                </qa:hu-table-param>
            </qa:hu-table-validation>

            <qa:hu-table-validation
              functionId="Find the 1st table in the 10th row, first column of the 1st table on the page">
              <!-- The 2nd column, 2nd row must have the value 5-->
                <qa:hu-table-param  tableIndex="1->(1,10)1">
                    <qa:hu-table-param-value row="2" col="2">5</qa:hu-table-param-value>
                </qa:hu-table-param>

            </qa:hu-table-validation>

            <qa:hu-table-validation
              functionId="Find a link with the text 'This is a link' preceeded by the previous column having 'Link Test:'">
              <!-- The 2nd column, 2nd row must have the value 5-->
                <qa:hu-table-param>
                    <qa:param-name>Link test:</qa:param-name>
                    <qa:hu-table-param-value>This is a link</qa:hu-table-param-value>
                    <qa:hu-table-param-type>link</qa:hu-table-param-type>
                </qa:hu-table-param>

            </qa:hu-table-validation>

        </qa:httpunit-session>
      </qa:testcase>

       
    • prachi

      prachi - 2006-03-14

      I know al the param tags used in the jameleon.
      But my question is what is best way to validate the contents of the table?
      Like i will give you one example.
      There is one table having three columns
      Employee Name, Employee id & Salary
      Uder these three columns thre are several rows
      giving information about many employes.
      So whether to validate each row or how?

       
      • Christian Hargraves

        I guess it depends. Do you care that it is in the 3rd row? Do you want to validate each row? Are you testing  a tool that adds Employees to a data source and you want to validate a specific user was added?

        If you want to validate several users, you could wrap a csv tag around the single validation tag. A new feature coming out soon will allow you to data-drive just your param tags.

        If you want to simply click on a link for each user, you could write a data-drivable tag that iterates over the rows in the table.

        There are several other mehtodologies, but they all depend on exactly what you are trying to do.

        Does this come closer to answering your question?

         
    • prachi

      prachi - 2006-03-15

      As stated in the above example if i want to validate coulmn name text as 'employee name' & also validate value in the 3rd row of the same column which is 'prachi'.
      There is only one table in the application.
      So i will write
      <qa:hu-table-param>
      What will i include here?
      </qa:hu-table-param>

       
      • Christian Hargraves

        So then you want to validate values on the same column? You would need to pass in two hu-table-param tags.

        Something like:

        <qa:hu-table-param tableIndex="1->(2,9)1">
           <qa:hu-table-param>
            <qa:hu-table-param-name row="1" column="1">Employee Name</qa:hu-table-param-name> 
           </qa:hu-table-param>
           <qa:hu-table-param>
            <qa:hu-table-param-name row="3" column="1">prachi</qa:hu-table-param-name> 
           </qa:hu-table-param>
        </qa:hu-table-validation>

        I guess I need to rename the tags ;-)

         
    • prachi

      prachi - 2006-03-15

      <qa:hu-table-validation 
      functionId="1st table 2nd column 9th row and the 1st table in there.">
      <!-- Look for any column to have 2+2, followed by any column to have 4, but it must exist in the 2nd row -->
      <qa:hu-table-param tableIndex="1->(2,9)1">
      <qa:hu-table-param-name>2+2</qa:hu-table-param-name> 
      <qa:hu-table-param-value row="2">4</qa:hu-table-param-value>
      </qa:hu-table-param>
      </qa:hu-table-validation>
      In above example you want to say that u want to validate column name '2+2' & value in the column name which is 4.

       
      • Christian Hargraves

        Once you get to the table that above example would validate this:

        |Joe    |Blow    |123 lizard way|Hamilton | MT
        |Jake   |Marshal |4+4           |4        | WA

        It would find the "4+4" and the "4" next to each other on the second row. NOTE: I added spaces only to help visualize the example.

        |Joe    |Blow    |123 lizard way|Hamilton | MT
        |Jake   |4+4     |Marshal       |4        | WA

        I think it would also match the above, but I can't remember right now. In other words.

        The "name" and "value" tags are misleading. I should have named them something else. The idea of the name tag is to find the column matching. The idea behind the value tag is to find the a colum matching the provided text that is somewhere AFTER the name tag. This idea works great for form verification pages where there are key-value pairs on row like the following:

        First Name:   |Joe
        Last  Name:   |Blow
        Address:      |123 somewhere drv
        City:         |Hamilton
        State:        |MT

        In this case the name tag would be "First Name:".
        The value tag would be "Joe". And if you didn't care that it showed it first or second, you wouldn't need to worry about wich it was on.

         
    • prachi

      prachi - 2006-03-17

      I want to validate link named as 'image1' which in the 3rd row & 5th column of table.
      There is only one table.
      <qa:param-name row="3"column="5">image1</qa:param-name>
        <qa:hu-table-param-type>link</qa:hu-table-param-type>
      </qa:hu-table-param>

      Is it correct?
       

       
      • Christian Hargraves

        all except you are missing your hu-table-validation tag that should wrap around the param tags. if there is only one table, tnen I believe you still need to define a table identitifer

         

Log in to post a comment.