generate log files with the name of the test scripts

10 views
Skip to first unread message

Satya Rao

unread,
May 25, 2017, 9:54:21 AM5/25/17
to Python Pune
Hi 
 I am working on an automation framework in Python and my tests are using pytest framework.
 Following is my folder structure.

 +test_fwk
      +helper_methods
      +resources
      +bins
      +src
          +targets
          +extensions
       custom.logger.py
       +xyz
  +tests
       +functional_tests
           test_a.py
        +stability_tests
           test_b.py
        +negative_tests
           test_c.py


Now I am running all my tests with the following command
    > pytest -v -s tests
which runs all my 3 tests above.

My requirement is for all these 3 tests 3 different log files should be created in a user given log folder with the respective script names, like below

under "tests" folder above "logs" folder should be created and in this folder I should get following log files.
   
      +logs
          test_a.log
          test_b.log
          test_c.log

And in these log files, logs from different other python modules (if uses) should be captured.


Could you please help me with this?

Abhijeet Kasurde

unread,
May 25, 2017, 10:58:07 AM5/25/17
to pytho...@googlegroups.com
Hi Satya,

Have you tried `pytest-logger` ? It works exactly what you want. Try
that and let us know.
Thanks and Regards,

Abhijeet Kasurde
Explore. Dream. Discover
> --
> You received this message because you are subscribed to the Google Groups
> "Python Pune" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pythonpune+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages