Scenario is for example: I am automating a form (containing text fields, checkbox...) and using log file to print logs. Here i wanted to print the logs in text file. can anyone help me out?


You can use either basic language tool-set for logging or use well-known logging frameworks:

  1. This is the example on how to use log4j framework in Java
  2. This is the example on how to use log4net framewrok in C#
  3. This is the example on how to use Python logging feature

So for making meaningful logs I'd suggest to have at least following information for each record:

  • Test Name
  • Step Description
  • Locator used
  • User friendly definition of the object you're interacting with

You should also consider that normally the log messages can have different types. Some messages can be logged as Info some as Debug, some as Trace. Those type distinguish the level of details that is logged within those message. Then having such the messages segregated you can filter them using your logging framework configuration.

| improve this answer | |
  • sure thank you Alexey. Got some idea I will try it out!!! – Indhu Mathi Dec 3 '18 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.