Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider switching to Spectator #115

Open
alexanderadam opened this issue Jan 8, 2021 · 4 comments
Open

Consider switching to Spectator #115

alexanderadam opened this issue Jan 8, 2021 · 4 comments

Comments

@alexanderadam
Copy link

alexanderadam commented Jan 8, 2021

So at the panel discussion @matthewmcgarvey mentioned that he would love to have mocking and additional features available in specs.
I guess by "missing" he meant in reference to RSpec.

Luckily (!), @icy-arctic-fox wrote Spectator, which is a testing framework based on RSpec (> 3).
It has an incredible amount of RSpec features already available.

I guess one of the main decisions whether to switch from an stdlib testing library to an external one, is usually the amount of dependencies but in Lucky's case we are talking about a fully fledged web framework that should allow developers to develop apps as secure, convenient and fast as possible. If someone is looking for a solution that's as tiny as possible, Lucky might not be the optimal choice. There are other tiny web frameworks in Crystal that are focussing on that.

Thus, while the standard Crystal spec is functional and intentionally kept tiny, this doesn't mean that Lucky has to stuck with it.
Ruby's RSpec is also not the standard test library in Ruby but it is yet one of the (or the?) most popular test library.

Also Matthew is most likely not the only web dev who's missing convenient test features that would be solved by switching to Spectator (see here, here, here or various comments in this issue). Which is absolutely understandable, since tests/specs are giving security and allow us to develop better applications that are as stable as possible.

PS: Also using the non-intrusive expect syntax might be an advantage.
PPS: I absolutely understand that this might be a hot topic but I'm sure it it much better to have this discussion at this point than at a much later point where a full developed ecosystem might have been evolved that would make it even harder to switch. I guess a (slow) migration at this point might still be a realistic option and Lucky's users would gain a lot.
PPPS: Thank you so much for Lucky. 🙏 Really. Lucky is wonderful!

@thoran
Copy link

thoran commented Jan 12, 2021

The team I'm working in has been using Spectator with Lucky for a few months now. Switching LuckyFlow over would be good for us at least...

@jwoertink
Copy link
Member

I think this is more of a Lucky related topic than LuckyFlow. LuckyFlow is specifically for interacting with front-end components with a few test helpers. With that said, one of the internal Lucky "guide/rules" is that we avoid including any shard outside of the Lucky org that we can't directly control. That could change in the future as shards become updated more frequently, and releases become more stable. The main reason for that is just when a shard we use breaks, then it requires us to submit an issue / PR, and then wait for a release of that shard which causes blocks for us.

I think instead of adding spectator directly in to the Lucky ecosystem, we should just add some guides to our testing section on how to include it. Now, I've never actually used this shard before, so I'm probably not the best one to write the guides, but if anyone else would like to submit a small section to our testing guides on how to best utilize spectator to really beef up your testing in Lucky, I think that would at least be a great start!

@alexanderadam
Copy link
Author

I think this is more of a Lucky related topic than LuckyFlow.

This absolutely makes sense. I wasn't sure which would be the better place for this.
But I guess moving this issue won't be the major issue here‽ 😉

we avoid including any shard outside of the Lucky org that we can't directly control

While I understand the general idea, I think that this should not hinder improve the development experience.
And as mentioned earlier, the stdlib spec is intentionally kept tiny. So in this way Spectator relates to stdlib spec like Lucky to the integrated HTTP::Server.

Apart from the avoiding external shards thing: did you never miss more advanced spec features so far?
Did you never see any room for improvement in this regards?

The main reason for that is just when a shard we use breaks, then it requires us to submit an issue / PR, and then wait for a release of that shard which causes blocks for us.

Of course. I mean this is true for many other dependencies in many other languages, frameworks and libraries and many of them are doing great although they are often using external libraries.
Otherwise there might also be some solutions like adding a thin abstraction (lucky_spec?) that ensures compatibility.
Or maybe it would make sense to invite @icy-arctic-fox to join the core team to oversee the testing functionality?

I absolutely understand the abstract desire to keep out external dependencies but I won't lose hope yet that those two wonderful projects will find their way to each other. 😉

@jwoertink
Copy link
Member

Apart from the avoiding external shards thing: did you never miss more advanced spec features so far?

The only thing I'm really missing is mocks and stubs which I see spectator supports, but we have a project started to solve this! Just a matter of getting it fleshed out and having time to work on it. Maybe we can just bring over that portion in to our project we started 🤔

We should probably move this to a discussion https://github.com/luckyframework/lucky/discussions and see what others think on the testing front.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants