{"id":7033,"date":"2014-07-04T18:56:11","date_gmt":"2014-07-04T15:56:11","guid":{"rendered":"http:\/\/railsware.com\/blog\/?p=7033"},"modified":"2021-08-16T11:48:49","modified_gmt":"2021-08-16T08:48:49","slug":"bdd-style-testing-in-swift-with-sleipnir","status":"publish","type":"post","link":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/","title":{"rendered":"BDD-style testing in Swift with Sleipnir"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Introduction<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In Objective-C people use different frameworks to write BDD-style tests for their code. Some of them are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/github.com\/pivotal\/cedar\" target=\"_blank\" rel=\"noreferrer noopener\">Cedar<\/a><\/li><li><a href=\"https:\/\/github.com\/kiwi-bdd\/Kiwi\" target=\"_blank\" rel=\"noreferrer noopener\">Kiwi<\/a><\/li><li><a href=\"https:\/\/github.com\/specta\/specta\" target=\"_blank\" rel=\"noreferrer noopener\">Specta<\/a><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">With the inroduction of Swift we&#8217;ve decided to create BDD-style testing framework in pure Swift.<br>After a couple weeks of implementation we are making the first public version of the framework called <a href=\"https:\/\/github.com\/railsware\/Sleipnir\" target=\"_blank\" rel=\"noreferrer noopener\">Sleipnir<\/a>.<br>Sleipnir is highly inspired by <a href=\"https:\/\/github.com\/pivotal\/cedar\">Cedar<\/a> and allows you to write BDD-style tests in Swift:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">class SampleSpec : SleipnirSpec {\n    var spec : () = describe(\"Horse\") {\n        context(\"usual\") {\n            it(\"is not awesome\") {\n                let usualHorse = UsualHorse()\n                expect(usualHorse.legsCount).to(equal(4))\n                expect(usualHorse.isAwesome()).to(beFalse())\n            }\n        }\n        \n        context(\"Sleipnir\") {\n            it(\"is awesome\") {\n                let sleipnirHorse = Sleipnir()\n                expect(sleipnirHorse.legsCount).to(equal(8))\n                expect(sleipnirHorse.isAwesome()).to(beTrue())\n            }\n        }\n    }\n}\n<\/pre>\n\n\n\n<!--more-->\n\n\n\n<h3 class=\"wp-block-heading\">Core principles of Sleipnir<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>Sleipnir is not dependent of <code class=\"\" data-line=\"\">NSObject<\/code>, it is pure Swift BDD testing framework<\/li><li>Sleipnir is not using <code class=\"\" data-line=\"\">XCTest<\/code><\/li><li>Sleipnir has nice command line output and support for custom test reporters<\/li><li>Other features, like seeded random tests invocation, focused and excluded examples\/groups, etc.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">We&#8217;ve found some other alternatives for Swift BDD testing, like <a href=\"https:\/\/github.com\/modocache\/Quick\" target=\"_blank\" rel=\"noreferrer noopener\">Quick<\/a>. Choosing between different solutions is a matter of preference.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Usage sample<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s define two classes <code class=\"\" data-line=\"\">Book<\/code> and <code class=\"\" data-line=\"\">Library<\/code> and write tests for them.<br><code class=\"\" data-line=\"\">Book<\/code> contains information about an author and a title of the book.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted toolbar:1 lang:swift decode:true\">class Book {    \n    var title: String\n    var author: String\n    \n    init(title: String, author: String) {\n        self.title = title\n        self.author = author\n    }   \n}\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code class=\"\" data-line=\"\">Library<\/code> is a simple collection of books.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted toolbar:1 lang:swift decode:true\">class Library {  \n    var books: Book[]\n    \n    init() {\n        self.books = Book[]()\n    }\n    \n    func addBook(book: Book) {\n        books.append(book)\n    }\n    \n    func removeLastBook() {\n        books.removeLast()\n    }\n    \n    func clear() {\n        books.removeAll()\n    }\n    \n    func size() -&gt; Int {\n        return books.count\n    }\n    \n    func hasBooks() -&gt; Bool {\n        return size() &gt; 0\n    }\n    \n    func filterBy(#author: String) -&gt; Book[] {\n        return books.filter { $0.author == author }\n    }\n    \n    func filterBy(#title: String) -&gt; Book[] {\n        return books.filter { !$0.title.rangeOfString(title).isEmpty }\n    }\n}\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">First let&#8217;s test that instances of <code class=\"\" data-line=\"\">Book<\/code> are initialized correctly:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted toolbar:1 lang:swift decode:true\">class LibrarySpec : SleipnirSpec {\n    \n    var book : () = context(\"Book\") {\n        \n        var swiftBook: Book?\n        beforeAll {\n            swiftBook = Book(title: \"Introduction to Swift\", author: \"Apple Inc.\")\n        }\n        \n        it(\"has title\") {\n            expect(swiftBook!.title).to(equal(\"Introduction to Swift\"))\n        }\n       \n        it(\"has author\") {\n            expect(swiftBook!.author).to(equal(\"Apple Inc.\"))\n        }\n    }\n}\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We&#8217;ve created a <code class=\"\" data-line=\"\">LibrarySpec<\/code> class which inherits from <code class=\"\" data-line=\"\">SleipnirSpec<\/code>. It has a main context and two examples which check properties of a created <code class=\"\" data-line=\"\">Book<\/code> instance.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An instance of <code class=\"\" data-line=\"\">Book<\/code> is created in <code class=\"\" data-line=\"\">beforeAll{ }<\/code> block.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sleipnir supports several blocks for specs initialization: <code class=\"\" data-line=\"\">beforeAll<\/code>, <code class=\"\" data-line=\"\">afterAll<\/code>, <code class=\"\" data-line=\"\">beforeEach<\/code> and <code class=\"\" data-line=\"\">afterEach<\/code>.<br>All the top-level example groups in a spec should be assigned to a variable in order to evaluate:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var book : () = context(\"Book\") {  }\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now let&#8217;s test a behaviour of a <code class=\"\" data-line=\"\">Library<\/code> class:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted toolbar:1 lang:swift decode:true\">class LibrarySpec : SleipnirSpec {\n    \n    ...\n\n    var library : () = context(\"Library\") {\n        \n        var swiftLibrary: Library?\n        beforeAll {\n            swiftLibrary = Library()\n        }\n        \n        afterAll {\n            swiftLibrary = nil\n        }\n        \n        describe(\"empty\") {\n            it(\"has no books\") {\n                expect(swiftLibrary!.hasBooks()).to(beFalse())\n            }\n        }\n        \n        describe(\"with books\") {\n            \n            beforeEach {\n                swiftLibrary!.addBook(Book(title: \"Introduction to Swift\", author: \"Apple Inc.\"))\n                swiftLibrary!.addBook(Book(title: \"Using Swift with Cocoa\", author: \"Apple Inc.\"))\n                swiftLibrary!.addBook(Book(title: \"Swift tutorials\", author: \"John Doe\"))\n                swiftLibrary!.addBook(Book(title: \"Programming iOS with Swift\", author: \"Vladimir Swiftin\"))\n            }\n            \n            afterEach {\n                swiftLibrary!.clear()\n            }\n            \n            it(\"is not empty\") {\n                expect(swiftLibrary!.hasBooks()).to(beTrue())\n            }\n            \n            it(\"has correct number of books\") {\n                expect(swiftLibrary!.size()).to(equal(4))\n                swiftLibrary!.removeLastBook()\n                expect(swiftLibrary!.size()).to(equal(3))\n            }\n            \n            describe(\"filters books\") {\n                it(\"by author\") {\n                    expect(swiftLibrary!.filterBy(author: \"Apple Inc.\").count).to(equal(2))\n                }\n                \n                it(\"by title\") {\n                    expect(swiftLibrary!.filterBy(title: \"tutorials\").count).to(equal(1))\n                }\n            }\n        }\n    }\n}\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Running those specs will produce the following command line output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Running With Random Seed: 657464010\n\n.......\n\n\nFinished in 0.0091 seconds\n\n7 examples, 0 failures\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In case of a failed example you will see a detailed information about the failure including file and line number:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Running With Random Seed: 2027508247\n\n..F....\n\nFAILURE Library with books has correct number of books:\n\/Users\/atermenji\/Coding\/objc\/Sleipnir\/Sample\/LibrarySpec.swift:64 Expected 3 to equal [2]\n\n\nFinished in 0.0043 seconds\n\n7 examples, 1 failures\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">As you can see we&#8217;ve tested the behaviour of a <code class=\"\" data-line=\"\">Library<\/code> class using simple expectations and matchers.<br>Sleipnir currently supports only three matchers: <code class=\"\" data-line=\"\">equal<\/code>, <code class=\"\" data-line=\"\">beTrue<\/code> and <code class=\"\" data-line=\"\">beFalse<\/code>, but more of them will be added soon.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What&#8217;s next<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Since this is a first public release, a lot of features are not yet implemented. We have a roadmap for the nearest future which includes:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Distribution as a framework<\/li><li>Pending examples support<\/li><li>Focused and excluded examples\/groups support implementation<\/li><li>XCode templates<\/li><li>Shared examples support<\/li><li><code class=\"\" data-line=\"\">should<\/code> syntax support<\/li><li>Specs for Sleipnir using Sleipnir<\/li><li>Wiki documentation<\/li><li>More matchers, including:\n<ul>\n<li><code class=\"\" data-line=\"\">beNil<\/code><\/li>\n<li><code class=\"\" data-line=\"\">beGreaterThan<\/code>, <code class=\"\" data-line=\"\">beLessThan<\/code>, <code class=\"\" data-line=\"\">beInRangeOf<\/code><\/li>\n<li>asynchronous matchers (<code class=\"\" data-line=\"\">will<\/code>, <code class=\"\" data-line=\"\">willNot<\/code>, <code class=\"\" data-line=\"\">after<\/code>)<\/li>\n<li>matchers on collections\/strings (<code class=\"\" data-line=\"\">contains<\/code>, <code class=\"\" data-line=\"\">haveCount<\/code>, <code class=\"\" data-line=\"\">beginWith<\/code>, <code class=\"\" data-line=\"\">endWith<\/code>, etc.)<\/li>\n<\/ul>\n<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You may post your ideas or issues to the <a href=\"https:\/\/github.com\/railsware\/Sleipnir\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Sleipnir repo<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In Objective-C people use different frameworks to write BDD-style tests for their code. Some of them are: CedarKiwiSpecta With the inroduction of Swift we&#8217;ve decided to create BDD-style testing framework in pure Swift.After a couple weeks of implementation we are making the first public version of the framework called Sleipnir.Sleipnir is highly inspired by&#8230;<\/p>\n","protected":false},"author":58,"featured_media":9466,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[3],"tags":[],"coauthors":["Artur Termenji"],"class_list":["post-7033","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"Introduction In Objective-C people use different frameworks to write BDD-style tests for their code. Some of them are: CedarKiwiSpecta With the inroduction of Swift we&#039;ve decided to create BDD-style testing framework in pure Swift.After a couple weeks of implementation we are making the first public version of the framework called Sleipnir.Sleipnir is highly inspired by\" \/>\n\t<meta name=\"robots\" content=\"max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n\t<meta name=\"author\" content=\"Artur Termenji\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"| Blog on Engineering, Product Management, Transparency, Culture and many more...\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"BDD-style testing in Swift with Sleipnir | Railsware Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Introduction In Objective-C people use different frameworks to write BDD-style tests for their code. Some of them are: CedarKiwiSpecta With the inroduction of Swift we&#039;ve decided to create BDD-style testing framework in pure Swift.After a couple weeks of implementation we are making the first public version of the framework called Sleipnir.Sleipnir is highly inspired by\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2017\/12\/Sleipnir.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2017\/12\/Sleipnir.png\" \/>\n\t\t<meta property=\"og:image:width\" content=\"360\" \/>\n\t\t<meta property=\"og:image:height\" content=\"360\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2014-07-04T15:56:11+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2021-08-16T08:48:49+00:00\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/#article\",\"name\":\"BDD-style testing in Swift with Sleipnir | Railsware Blog\",\"headline\":\"BDD-style testing in Swift with Sleipnir\",\"author\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/artur-termenji\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/12\\\/Sleipnir.png\",\"width\":360,\"height\":360,\"caption\":\"BDD-style testing in Swift with Sleipnir\"},\"datePublished\":\"2014-07-04T18:56:11+03:00\",\"dateModified\":\"2021-08-16T11:48:49+03:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/#webpage\"},\"articleSection\":\"Engineering\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/railsware.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/category\\\/development\\\/#listItem\",\"name\":\"Engineering\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/category\\\/development\\\/#listItem\",\"position\":2,\"name\":\"Engineering\",\"item\":\"https:\\\/\\\/railsware.com\\\/blog\\\/category\\\/development\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/#listItem\",\"name\":\"BDD-style testing in Swift with Sleipnir\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/#listItem\",\"position\":3,\"name\":\"BDD-style testing in Swift with Sleipnir\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/category\\\/development\\\/#listItem\",\"name\":\"Engineering\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#organization\",\"description\":\"Blog on Engineering, Product Management, Transparency, Culture and many more...\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/Logo-circle.png\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/#organizationLogo\",\"width\":3137,\"height\":1054,\"caption\":\"Railsware logo\"},\"image\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/#organizationLogo\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/artur-termenji\\\/#author\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/artur-termenji\\\/\",\"name\":\"Artur Termenji\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/#authorImage\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/artur-termenji-96x96.jpg\",\"width\":96,\"height\":96,\"caption\":\"Artur Termenji\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/#webpage\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/\",\"name\":\"BDD-style testing in Swift with Sleipnir | Railsware Blog\",\"description\":\"Introduction In Objective-C people use different frameworks to write BDD-style tests for their code. Some of them are: CedarKiwiSpecta With the inroduction of Swift we've decided to create BDD-style testing framework in pure Swift.After a couple weeks of implementation we are making the first public version of the framework called Sleipnir.Sleipnir is highly inspired by\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/artur-termenji\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/artur-termenji\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/12\\\/Sleipnir.png\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/#mainImage\",\"width\":360,\"height\":360,\"caption\":\"BDD-style testing in Swift with Sleipnir\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/bdd-style-testing-in-swift-with-sleipnir\\\/#mainImage\"},\"datePublished\":\"2014-07-04T18:56:11+03:00\",\"dateModified\":\"2021-08-16T11:48:49+03:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/\",\"description\":\"Blog on Engineering, Product Management, Transparency, Culture and many more...\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"BDD-style testing in Swift with Sleipnir | Railsware Blog","description":"Introduction In Objective-C people use different frameworks to write BDD-style tests for their code. Some of them are: CedarKiwiSpecta With the inroduction of Swift we've decided to create BDD-style testing framework in pure Swift.After a couple weeks of implementation we are making the first public version of the framework called Sleipnir.Sleipnir is highly inspired by","canonical_url":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/","robots":"max-snippet:-1, max-image-preview:large, max-video-preview:-1","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/#article","name":"BDD-style testing in Swift with Sleipnir | Railsware Blog","headline":"BDD-style testing in Swift with Sleipnir","author":{"@id":"https:\/\/railsware.com\/blog\/author\/artur-termenji\/#author"},"publisher":{"@id":"https:\/\/railsware.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2017\/12\/Sleipnir.png","width":360,"height":360,"caption":"BDD-style testing in Swift with Sleipnir"},"datePublished":"2014-07-04T18:56:11+03:00","dateModified":"2021-08-16T11:48:49+03:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/#webpage"},"isPartOf":{"@id":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/#webpage"},"articleSection":"Engineering"},{"@type":"BreadcrumbList","@id":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/railsware.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/category\/development\/#listItem","name":"Engineering"}},{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/category\/development\/#listItem","position":2,"name":"Engineering","item":"https:\/\/railsware.com\/blog\/category\/development\/","nextItem":{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/#listItem","name":"BDD-style testing in Swift with Sleipnir"},"previousItem":{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/#listItem","position":3,"name":"BDD-style testing in Swift with Sleipnir","previousItem":{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/category\/development\/#listItem","name":"Engineering"}}]},{"@type":"Organization","@id":"https:\/\/railsware.com\/blog\/#organization","description":"Blog on Engineering, Product Management, Transparency, Culture and many more...","url":"https:\/\/railsware.com\/blog\/","logo":{"@type":"ImageObject","url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2020\/11\/Logo-circle.png","@id":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/#organizationLogo","width":3137,"height":1054,"caption":"Railsware logo"},"image":{"@id":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/#organizationLogo"}},{"@type":"Person","@id":"https:\/\/railsware.com\/blog\/author\/artur-termenji\/#author","url":"https:\/\/railsware.com\/blog\/author\/artur-termenji\/","name":"Artur Termenji","image":{"@type":"ImageObject","@id":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/#authorImage","url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2021\/06\/artur-termenji-96x96.jpg","width":96,"height":96,"caption":"Artur Termenji"}},{"@type":"WebPage","@id":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/#webpage","url":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/","name":"BDD-style testing in Swift with Sleipnir | Railsware Blog","description":"Introduction In Objective-C people use different frameworks to write BDD-style tests for their code. Some of them are: CedarKiwiSpecta With the inroduction of Swift we've decided to create BDD-style testing framework in pure Swift.After a couple weeks of implementation we are making the first public version of the framework called Sleipnir.Sleipnir is highly inspired by","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/railsware.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/#breadcrumblist"},"author":{"@id":"https:\/\/railsware.com\/blog\/author\/artur-termenji\/#author"},"creator":{"@id":"https:\/\/railsware.com\/blog\/author\/artur-termenji\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2017\/12\/Sleipnir.png","@id":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/#mainImage","width":360,"height":360,"caption":"BDD-style testing in Swift with Sleipnir"},"primaryImageOfPage":{"@id":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/#mainImage"},"datePublished":"2014-07-04T18:56:11+03:00","dateModified":"2021-08-16T11:48:49+03:00"},{"@type":"WebSite","@id":"https:\/\/railsware.com\/blog\/#website","url":"https:\/\/railsware.com\/blog\/","description":"Blog on Engineering, Product Management, Transparency, Culture and many more...","inLanguage":"en-US","publisher":{"@id":"https:\/\/railsware.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"| Blog on Engineering, Product Management, Transparency, Culture and many more...","og:type":"article","og:title":"BDD-style testing in Swift with Sleipnir | Railsware Blog","og:description":"Introduction In Objective-C people use different frameworks to write BDD-style tests for their code. Some of them are: CedarKiwiSpecta With the inroduction of Swift we've decided to create BDD-style testing framework in pure Swift.After a couple weeks of implementation we are making the first public version of the framework called Sleipnir.Sleipnir is highly inspired by","og:url":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/","og:image":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2017\/12\/Sleipnir.png","og:image:secure_url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2017\/12\/Sleipnir.png","og:image:width":360,"og:image:height":360,"article:published_time":"2014-07-04T15:56:11+00:00","article:modified_time":"2021-08-16T08:48:49+00:00"},"aioseo_meta_data":{"post_id":"7033","title":null,"description":null,"keywords":[],"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":{"id":"aioseo-article-6385f5b1cff8b","slug":"article","graphName":"Article","label":"Article","properties":{"type":"BlogPosting","name":"#post_title","headline":"#post_title","description":"#post_excerpt","image":"","keywords":"","author":{"name":"#author_name","url":"#author_url"},"dates":{"include":true,"datePublished":"","dateModified":""}}},"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":{"locations":{"business":{"name":"","businessType":"","image":"","areaServed":"","urls":{"website":"","aboutPage":"","contactPage":""},"address":{"streetLine1":"","streetLine2":"","zipCode":"","city":"","state":"","country":"","addressFormat":"#streetLineOne\n#streetLineTwo\n#city, #state #zipCode"},"contact":{"email":"","phone":"","phoneFormatted":"","fax":"","faxFormatted":""},"ids":{"vat":"","tax":"","chamberOfCommerce":""},"payment":{"priceRange":"","currenciesAccepted":"","methods":""}}},"openingHours":{"useDefaults":true,"show":true,"alwaysOpen":false,"use24hFormat":false,"timezone":"","labels":{"closed":"","alwaysOpen":""},"days":{"monday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"tuesday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"wednesday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"thursday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"friday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"saturday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"sunday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"}}}},"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-01-04 12:44:30","updated":"2025-09-26 11:21:39","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/railsware.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/railsware.com\/blog\/category\/development\/\" title=\"Engineering\">Engineering<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tBDD-style testing in Swift with Sleipnir\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/railsware.com\/blog"},{"label":"Engineering","link":"https:\/\/railsware.com\/blog\/category\/development\/"},{"label":"BDD-style testing in Swift with Sleipnir","link":"https:\/\/railsware.com\/blog\/bdd-style-testing-in-swift-with-sleipnir\/"}],"categories_data":[{"name":"Engineering","link":"https:\/\/railsware.com\/blog?category=development"}],"post_thumbnails":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2017\/12\/Sleipnir.png","article_background":"","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/7033","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/users\/58"}],"replies":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/comments?post=7033"}],"version-history":[{"count":27,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/7033\/revisions"}],"predecessor-version":[{"id":14090,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/7033\/revisions\/14090"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/media\/9466"}],"wp:attachment":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/media?parent=7033"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/categories?post=7033"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/tags?post=7033"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/coauthors?post=7033"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}