Skip to content

I want to print the exact text as the file "basic_text_info.txt" to my customized tear down method. how can i do that? #1604

Answered by mdmintz
poojapatel14710 asked this question in Q&A
Discussion options

You must be logged in to vote

If you call super().tearDown() from your customized tearDown() method, then the basic_text_info.txt file will be generated if the test has failed, and then you can use Python File-IO to get the data from the latest_logs folder.

    def tearDown(self):
        # do things before regular tearDown()
        super().tearDown()
        # do things after regular tearDown()

This will get you the full folder path where the individual test logs are stored per test:

import os

os.path.join(os.path.abspath("."), self.log_path, self._BaseCase__get_test_id())

Remember that basic_text_info.txt is only generated for failing tests.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@poojapatel14710
Comment options

Answer selected by mdmintz
Comment options

You must be logged in to vote
3 replies
@mdmintz
Comment options

@mdmintz
Comment options

@poojapatel14710
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants