OzFramework / oz

Oz is a behavioral web-ui testing framework developed to reduce test maintenance by using a predictive model rather than a scriptive model when writing tests.
Apache License 2.0
23 stars 7 forks source link

add support for rspec mirroring existing cucumber implementation #135

Closed Castone22 closed 5 years ago

Castone22 commented 5 years ago

Adds basic support for RSpec that behaves in a way that should be familiar to the existing cucumber implementation.

Also adds some examples of its use to the example project.

Some changes were made to cucumber to make this work. One of the big ones is that if rspec is kept in the same project directory as cucumber you have to exclude the spec directory or cucumber tries to run the specs.

I also refactored how the app name is handled in the setup, and moved the setup into the support directory and prefixed it with an underscore so that cucumber would load it automatically before it loads even the env.rb file. The .rspec file still have to manually require the setup file however. This makes it a bit easier to run cucumber tests using rubymine.

Due to some idiosyncrasies with how rspec determines a scenario passed, i can't get this information in a hook (rspec treats the hooks as part of the scenario and will mark a scenario as failing if any of them fail, therefore scenario status is not set until after the world is discarded. More on that later.) and had to define a formatter. Because rspec destroys the example's world before calling the formatter, I can't retrieve the logger from the world anymore so i have to attach it to the example class itself and pull it out in the formatter using instance variable set and get. It's not pretty and I certainly need to deliberate on a better way to accomplish this, but it was the best way i could think of to replicate the existing logging behavior.

This was mostly done because I feel that RSpec falls more in line with the design ideologies that are being communicated for Oz than cucumber.