Forum Discussion

vivekmit's avatar
vivekmit
Occasional Contributor
7 months ago

Adding a Table data value in Log Message for Keyword Test

Hello All,

I am using keyword test and would like to know if it is possible to customize a log message with Table data value from a csv file.

I have used the data driven loop and need testcomplete to display a customized log message having details for the current table data value. 

I am trying to use code expression option in the "log message" module as below to display a customized message with Table data but i am getting a runtime error when executing the script.

My requirement is to display a message having a customized string + table data(from csv).

Can anyone help me for this requirement.

Regards

Vivek.S

  • Thanks rraghvani and Marsha_R for your suggestions, i was able to get the required log message with customized message + table value via the below post 

    https://community.smartbear.com/discussions/testcomplete-questions/log-message-and-code-expressions/165026/replies/165030

    The code expression i used was 

    "Testing  " + aqConvert.VarToStr(KeywordTests.TestNameVariables.VariableName.Value["Column name of the csv file"])

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    If your variable is of type Table, then you need to call the correct method to return the data, i.e. Item(),

     

    • vivekmit's avatar
      vivekmit
      Occasional Contributor

      hi rraghvani, can you please share more details on what the attribute 1,2 refers to in Item(1,2). Have you tried concatenating a customized message with this table value using "+". Please share the screenshot of the code expression similar to what i have shared.

      • rraghvani's avatar
        rraghvani
        Champion Level 3

        It's row and column as described in the documentation.

        The error message that you are receiving is most likely relating to incorrect syntax being used when referring to the object.

        I don't use keyword testing, I just provided you with a quick example which you should then be able to follow. I suggest you try something simple without concatenating the strings and values.

  • vivekmit's avatar
    vivekmit
    Occasional Contributor

    Thanks rraghvani and Marsha_R for your suggestions, i was able to get the required log message with customized message + table value via the below post 

    https://community.smartbear.com/discussions/testcomplete-questions/log-message-and-code-expressions/165026/replies/165030

    The code expression i used was 

    "Testing  " + aqConvert.VarToStr(KeywordTests.TestNameVariables.VariableName.Value["Column name of the csv file"])