Trigerring Test Method from normal function. Processing each CSV record for test #2011
-
Hi, Is there a way, i can create a test result for each record after reading it from the csv file. Alternately, i made the processor_method as test_processor_method and called the required test_method as normal method_name and it runs for all the records in the csv file and creates one test result for me. But for any assertion failure for any record, it either fails the entire test or when i handle the assertion it just moves to next record with warning on console. but I wanted to create a test failure for each record if assertion fails and move to next record as new test call. Is there a way i can accomplish this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
The output of |
Beta Was this translation helpful? Give feedback.
-
Can I do it with SeleniumBase? instead of pytest. As I'm trying to build the test framework with SeleniumBase, wanted to know how to get the results, like Pass or Fail for each test iteration of the test method for a single record. I'm new in building this and wanted to understand if this can be possible |
Beta Was this translation helpful? Give feedback.
The output of
pytest --co -q
is a test address, such asbasic_test.py::MyTestClass::test_basics
, which can be called directly withpytest
. If you put each row into a CSV file, you can easily map tests to results. So if you build a CSV parser, you can pull the test address, run it withpytest
, and then put the result back into the CSV file. This seems kind of off-topic for SeleniumBase, (since it is directly tied topytest
at that point), but this should point you in the right direction.