Git Product home page Git Product logo

Comments (4)

ttutisani avatar ttutisani commented on June 10, 2024

Hi,

I will try to answer.

  1. Accessing tags.
    You cannot access tags of the scenario from the step method. But maybe you can set the browser windowsize some other way? e.g. make it part of the scenario. Otherwise if you remove the tag, the scenario will fail. That actually tells me that maybe it's part of the scenario? What do you say?
  2. Determining pass/failure result.
    You cannot do that. Xunit does not have such thing as test context because they believe it's bad to share any information between various test executions. I could theoretically expose it but I hesitate to do so yet, again because I don't want to go against Xunit design guidelines. I'm curious though - why do you want to shut down the browser when the test fails? What's wrong with going to the home page regardless of failure or success?

from xunit.gherkin.quick.

glassenbury avatar glassenbury commented on June 10, 2024

Thanks for the quick reply.

  1. 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.

  2. 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.

from xunit.gherkin.quick.

ttutisani avatar ttutisani commented on June 10, 2024

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.

from xunit.gherkin.quick.

glassenbury avatar glassenbury commented on June 10, 2024

Thanks, this has been very useful.

from xunit.gherkin.quick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.