antonmi

antonmi

ESpec - Elixir Behaviour Driven Development

Hi, colleagues!

I’ve discovered this awesome forum recently and I wanna share my projects and ideas.
First of all, I create a topic about ESpec testing framework.
ESpec is inspired by RSpec Ruby library and implements its DSL.

There is also espec_phoenix project - a lightweight wrapper around ESpec which brings BDD to Phoenix web framework.

Let’s discuss your questions or proposals here!

Thank you!

Most Liked

Azolo

Azolo

I think it’s not necessarily a difference in functionality as much as style.

I don’t like calling Espec and Rspec BDD because I don’t think they are necessarily “pure” BDD like Cucumber is.

But the style is cleaner, the DSL is robust, and it tries to be “readable”. It basically has the same end result but a different way to get there.

Some people swear by RSpec in the Ruby world. Personally, I just used whatever I’m told to or what’s more convenient.

I do think that if you haven’t ever used a library with the expect/should you should. It definitely promotes a different way of thinking that causes you to write tests a little bit differently, which led me to write better tests overall.

Plus you may enjoy using that style better than an assert style.

antonmi

antonmi

Hi, Bobby!
Thanks for interesting in ESpec!
There are many cool features that present in ESpec but does not exist in ExUnit.
Just off the top of my head:

  • Nested context blocks with an ability to specify “before” block in each of them.
  • “let” macro which allows creating “memoizable” functions that caches result across multiple calls.
  • Built-in mocking functionality on top of Erlang “meck” library.
  • “Shared” and “generated” examples wich allows to avoid test duplication.
  • “Custom matchers” for testing specific functionality.

And, of course, the style of tests is different.
You may find some cool examples in ESpec spec folder or there are examples of using in Phoenix project

bobbypriambodo

bobbypriambodo

Hi! I’ve never used Ruby (and therefore, RSpec) before, I’ve skimmed through the (quite long) readme and you said

It is NOT a wrapper around ExUnit but a completely new testing framework written from scratch.

I apologize for the basic question, but what exactly does ESpec have that ExUnit doesn’t? Why would I use it over ExUnit?

Where Next?

Popular in Announcing Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29305 241
New
devonestes
Introducing assertions, the library that helps you write really great test assertions! GitHub: https://github.com/devonestes/assertions ...
New
brainlid
LangChain is short for Language Chain. An LLM, or Large Language Model, is the “Language” part. This library makes it easier for Elixir a...
New
tmbb
I’ve been working on two packages (not on hex.pm yet) to build admin interfaces for phoenix apps: bureaucrat - which contains a bunch ...
New
mbuhot
Leverage Open Api 3.0 (Swagger) to document, test, validate and explore your Plug and Phoenix APIs. Generate and serve a JSON Open API ...
New
bryanjos
Hi, I just published version 0.23.0 of Elixirscript. Most of the changes are around JavaScript interop now that Elixirscript uses the ...
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
archan937
It is a well-know topic within the Elixir community: “To mock or not to mock? :)” Every alchemist probably has his / her own opinion con...
New
zoltanszogyenyi
Hey everyone :wave: Excited to join this forum - I am one of the founders and current project maintainers of a popular and open-source U...
New
pkrawat1
Hey guyz We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it. Have...
New

Other popular topics Top

malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
RisingFromAshes
I've read in another post that it may be possible with a router helper - but I couldn't find an appropriate one, and tbh, I'm still just ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35953 110
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31107 143
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New

We're in Beta

About us Mission Statement