How to Validate elements from app. log file

Best practices, code snippets for common functionality, examples, and guidelines.
Wirtuoz
Posts: 2
Joined: Fri Apr 23, 2021 9:33 am

How to Validate elements from app. log file

Post by Wirtuoz » Fri Apr 23, 2021 9:46 am

Hi,

What will the best way to validate or to track elements in the 'log' file generated from the running application?

Example: like DateTime or true/false bits, generated in a text log file.

Rgds,

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6544
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to Validate elements from app. log file

Post by odklizec » Mon Apr 26, 2021 6:43 am

Hi,

I'm afraid, it's pretty hard to suggest something reliable, without seeing the log file and exact description of what you want to validate in it.

Generally speaking, you will have to write some code for parsing your log file, searching what you want to validate and then validate the obtained value(s). I'm afraid, there is no code-less way to achieve this kind of file-based string validation.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Wirtuoz
Posts: 2
Joined: Fri Apr 23, 2021 9:33 am

Re: How to Validate elements from app. log file

Post by Wirtuoz » Mon Apr 26, 2021 8:01 am

Hi,

Thank you for your helpful reply.

This is JSON format log file description example:
"body": {
"transactionInfo": {
"transactionTypeCode": "Transaction",
"copyTransaction": "false",
"transactionDateTime": "2020-04-23T17:07:54.257811+02:00",
"transactionID": "1234567890123",
"abortTransaction": "false",
"trainingTransaction": "false",
"WorkstationID": "MTOS01",
"Id": "00022",
"lTransactionID": "",
"tableNumber": "10",
"mergeTransaction": "false",
"transferTransaction": "false"
},

I would like validated underline string values

rgds,

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6544
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to Validate elements from app. log file

Post by odklizec » Mon Apr 26, 2021 8:31 am

Hi,

Could you please post entire json file, not just excerpt? Basically, you need to write JSON reading method, which reads the file and then extracts values from given properties. I'm afraid, I can't help you without valid JSON file.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration