title | date | author | tags | keywords | categories | reward | reward_title | reward_wechat | reward_alipay | source_url | translator | translator_url |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Spek – A Specification Framework |
2014-02-17 09:20:00 -0800 |
Hadi Hariri |
官方动态 |
false |
Have a nice Kotlin! |
For a while now, a few of us have been working on a project called Spek, a framework that allows you to write executable specifications. It allows you to write specifications (i.e. tests) in a more human-readable, and what’s more important, descriptive manner, without having to resort to long test names, underscores or regular expressions.
{% raw %}
{% endraw %}
It’s now reached its first milestone where it’s suitable enough to start being used on projects and we’re ready for feedback and feature requests! It even has its own site .
Spek is a Specification Framework. If you’re familiar with Jasmine, Mocha, RSpec or Machine Specifications, then you’ll immediately see the resemblance.
{% raw %}
{% endraw %}If you’re not familiar, let me briefly explain:
- Given – Establish the context of the test, i.e, Arrange
- On – Execute the action, i.e. Act
- It – Validate the results, i.e. Assert
Spek allows you to have more than one action for the same context. That is for the same givenyou can have multiple on’s. It also allows you to have more than assertion (*it) *for the same action.
Spek is written in Kotlin. Specifications you write will also be in Kotlin. However, as Kotlin is 100% compatible with Java, you can test new and existing Java code with Spek.
IntelliJ IDEA supports Spek, so does TeamCity. There’s also a console runner which outputs Text and HTML (needs improvement).
{% raw %}
{% endraw %}Hoping that you like what you see, head over to the Spek web site to find out more. It’s still in “EAP” so the more issues reported, the better. And since it’s OSS (Apache 2) contributions are more than welcome .