1
Good night!
I’m organizing my test suite and looking for the best ways to create a bug report when a test fails. I’ve already implemented a log in. txt with the test name that runs (using Testcontext), the test run time, its status (passed, error, timeout...), and saving prints in case the test fails.
However, if the test fails, I would also like to save the reason for the error, as well as Visual Studio points out when debugging, or appears the reason for the failure in the test suite itself. The point is, I’ll run a service test at dawn, and I won’t have access to the written reasons for the failure.
I thought of some possible solutions, but I didn’t implement them because I believe there are better ways. For example, one of the possibilities I imagined was to treat all the tests with Try/catch, and save the error inside the catchs.
I am using the latest stable version of Selenium Webdriver in a C#project, with structure based on Microsoft.VisualStudio.Testtools.UnitTesting. Thanks in advance!
And what is your question? What have you done? Where are you facing trouble?
– Maniero
– Striter Alfa
There are different ways to log Selenium errors: 1) take a screenshot of the screen at the time of error. 2) save the error information from the browser log. 3) save the error information from Selenium itself, as mentioned.
– Dherik
Dherik, I’m trying to do exactly what you said at the end, save the error information from Lenium itself, but without using Try/catch in all testcases. The other cases I’ve implemented in the suite
– Striter Alfa
Since Selenium in C# can use Nunit, the Nunit Addins API should be what you need because it logs Nunit errors into a file. Is this what you’re looking for? If it is, I’ll put it in answer.
– Dherik
Coming home, I’ll check it out. Is it possible to use it together with Microsoft’s Unittesting? Otherwise I’ll have to make a giant change in the test project
– Striter Alfa
@Dherik , I will use your advice, you can put as a response
– Striter Alfa