Service Virtualization

  • 1.  Reading the value from the Excel sheet in an Assertion as Regular Expression

    Posted Aug 16, 2018 01:19 PM
      |   view attached

    Scenario Description 

     

    Rest Service With XML input , Method Put 

    The XML input has multiple fields, which I parameterised to read from an excel sheet 

    Then I have a JDBC step to read the data which I have written in the input 

    I added an EnsureResultsetcontainsExpression assertion here Where in I am reading the data from the database column 

     

    Question: 

    I know the input so I am giving the value in the Regular Expression field here 

    Instead of me manually giving the value, Is there a way where I can diretly pick this from the input excel sheet 

    Attachment(s)

    docx
    RegExpAssertion.docx   79 KB 1 version


  • 2.  Re: Reading the value from the Excel sheet in an Assertion as Regular Expression

    Broadcom Employee
    Posted Aug 17, 2018 12:55 AM

    Hi,

     

    What version of DevTest are you using?
    Sorry but I am little bit confused about your requirement.
    1. Do you want to use "Ensure Result Contains Expression Assertion" without defining Regular Expression field?(but this is impossible)
    Or
    2. Do you want to replace the feature to get the GTIN value from the database on behalf of "Ensure Result Set Contains Expression Assertion"?
    Or
    3. Do you want to remove the "SQL Database Execution (JDBC) step" in your test case?


    Thank you,



  • 3.  Re: Reading the value from the Excel sheet in an Assertion as Regular Expression

    Posted Aug 17, 2018 10:39 AM

    I am using Devtest 8.4.0

    My input is the excel sheet
    the service writes the data from the excel sheet into db
    and then I read the data in the db from a select query to ensure that its inserted

    I want to compare the value in the excel under he colum GTIN and check if thats present in the Result set that is obtained from the query out in the JDBC Step



  • 4.  Re: Reading the value from the Excel sheet in an Assertion as Regular Expression
    Best Answer

    Posted Aug 17, 2018 12:17 PM

    You have access to the value in the excel by using the column name as a DevTest property (variable). So if the column name is "GTIN", then you can dereference the value in that colulmn by using this syntax: {{GTIN}}. During runtime that variable will be dereferenced into whatever value is in that column for the given row execution. You can also access the resultset by adding a filter that extracts the value into a DevTest property/variable and once again you can dereference that property/variable value and compare it to the one in the excel sheet.

     

    Refer to "properties" in our documents Properties - DevTest Solutions - 10.1 - CA Technologies Documentation 



  • 5.  Re: Reading the value from the Excel sheet in an Assertion as Regular Expression

    Posted Aug 21, 2018 02:09 AM

    Yeah we have tried with the above option and it worked  Thanks for your help.