Closed glassenbury closed 6 years ago
Hi,
I will try to answer.
Thanks for the quick reply.
I agree this is part of the scenario. In the past we had been using the tags as parameters to pass into a scenario. I have added another step to a step base class.
Determining the result of the test, I probably didn't go into enough detail. I restarted the browser on failed tests as there might be a popup in the UI or brower is mobile view and it was easier to start again with new browser instance. This does defy Xunit design guidelines to re-use the current browser over different tests but it cut's in half the execution time. The other option I have is not to dispose the browser in the steps file but at the end of the test run. Unfortunately I don't know in code when all of the tests are complete to shut the browser down. Is this possible? I have a kill any left over tasks/browsers in job outside of the test run.
In summary, we can use it as is by starting a new browser then shutting it down at the end of scenario. This is cleaner, especially when different browser sizes for different scenarios. It will just take longer but we are hoping to parallel run these in containers.
Okay, thanks for understanding why I follow the Xunit guidelines.
You asked how to determine that all the tests ran. You can do that using Xunit collection fixtures. Simply attach the same fixture to all feature classes. You can see an example of this here: https://github.com/xunit/samples.xunit/blob/master/CollectionFixtureExample/InsertTests.cs Point is that the fixture gets disposed when all the corresponding tests have ran already.
I would also suggest to find a way and go to home page before every test. If there is a popup, or if it's a mobile view, then you should ensure to close the popup and reset to the default non-mobile view. Whatever it takes to reset the state, you should be doing that at the beginning of every unit test. That's how I would recommend.
I hope this helps.
Thanks, this has been very useful.
This is more a questions than issues. I've being using the Xunit.Gherkin.Quick to run UI tests in .netcore and selenium. I have got this working but have these issues: