Kiwi is a BDD testing library for iOS that is similar to RSpec. It provides a nicer structure and better assertions than the built-in OCUnit framework. Kiwi builds on top of OCUnit and integrates tightly with Xcode. It can be easily installed with CocoaPods and provides macros and methods for setting up describe, context, before/after hooks, and expectations in a readable manner.
This document contains code for two test specifications. The first specification tests that the length of strings match expected values. The second specification tests that scanning an OOO driver after attaching it and setting a core medal results in a combo type of TATOBA.
The document discusses test-driven development (TDD) and refactoring. It provides examples of unit test fixtures, exercising the system under test (SUT), and verifying results. It also discusses refactoring code to remove smells like duplicated code through techniques like extracting methods. The goal is to use TDD to write code that works and is clean through small, incremental changes while ensuring it continues to work by passing all tests.
This document provides quick guides and code snippets for common JavaScript tasks when using Test Complete, such as creating objects and classes, reading and writing files, iterating through arrays, and connecting to databases. It includes examples of how to use try/catch blocks, switch statements, and extend built-in prototypes. Methods are demonstrated for working with strings, files, XML documents, SQL connections, and generating XML from objects.
This document discusses Behavior Driven Development (BDD) and the Spock testing framework. It provides an overview of BDD principles and the Given-When-Then syntax. It also demonstrates how to write Spock specifications in Java and Groovy, including data-driven tests, mocks, rules, and extensions. Finally, it shows how to use Spock for testing Grails applications in Eclipse.
Racing To Win: Using Race Conditions to Build Correct and Concurrent SoftwareFastly
If you've ever worked on parallel or multiprocessor software, you've almost certainly encountered bugs owning to race conditions between concurrently-executing components. While race conditions intuitively seem bad, it turns out there are cases in which we can use them to our advantage! In this talk, we'll discuss a number of ways that race conditions are used in improving throughput and reducing latency in high-performance systems, without sacrificing correctness along the way.
We'll begin this exploration with a discussion of how various mutual exclusion primitives like locks are implemented efficiently in modern hardware using benign race conditions. From there, we'll investigate how one can implement non-blocking algorithms and concurrent data structures in a correct and deterministic manner using freely-available open source libraries.
This document discusses using the XML Schema Object Model (XSOM) in Java to parse and analyze XML schemas. It shows how to:
- Parse an XML schema file using an XSOMParser
- Examine the schema set, schemas, elements, attributes, types and facets defined in the schema
- Navigate complex types and terms to analyze element declarations, model groups, wildcards etc.
- Inspect simple types to check if they are restrictions, unions, lists and get base types and facets
The code examples demonstrate how to retrieve and describe the different parts of an XML schema using the XSOM API.
Asp.net create delete directory folder in c# vb.netrelekarsushant
The document describes how to create and delete directories (folders) in ASP.NET using C# and VB.NET. It includes code samples for creating a directory when a user enters a name and clicks a button, deleting a directory when a user enters a name and clicks another button, and removing all directories and subdirectories recursively. The code utilizes the System.IO namespace and methods like Directory.CreateDirectory(), Directory.Exists(), Directory.Delete(), and GetFiles() to manage directories and files.
This document contains code for two test specifications. The first specification tests that the length of strings match expected values. The second specification tests that scanning an OOO driver after attaching it and setting a core medal results in a combo type of TATOBA.
The document discusses test-driven development (TDD) and refactoring. It provides examples of unit test fixtures, exercising the system under test (SUT), and verifying results. It also discusses refactoring code to remove smells like duplicated code through techniques like extracting methods. The goal is to use TDD to write code that works and is clean through small, incremental changes while ensuring it continues to work by passing all tests.
This document provides quick guides and code snippets for common JavaScript tasks when using Test Complete, such as creating objects and classes, reading and writing files, iterating through arrays, and connecting to databases. It includes examples of how to use try/catch blocks, switch statements, and extend built-in prototypes. Methods are demonstrated for working with strings, files, XML documents, SQL connections, and generating XML from objects.
This document discusses Behavior Driven Development (BDD) and the Spock testing framework. It provides an overview of BDD principles and the Given-When-Then syntax. It also demonstrates how to write Spock specifications in Java and Groovy, including data-driven tests, mocks, rules, and extensions. Finally, it shows how to use Spock for testing Grails applications in Eclipse.
Racing To Win: Using Race Conditions to Build Correct and Concurrent SoftwareFastly
If you've ever worked on parallel or multiprocessor software, you've almost certainly encountered bugs owning to race conditions between concurrently-executing components. While race conditions intuitively seem bad, it turns out there are cases in which we can use them to our advantage! In this talk, we'll discuss a number of ways that race conditions are used in improving throughput and reducing latency in high-performance systems, without sacrificing correctness along the way.
We'll begin this exploration with a discussion of how various mutual exclusion primitives like locks are implemented efficiently in modern hardware using benign race conditions. From there, we'll investigate how one can implement non-blocking algorithms and concurrent data structures in a correct and deterministic manner using freely-available open source libraries.
This document discusses using the XML Schema Object Model (XSOM) in Java to parse and analyze XML schemas. It shows how to:
- Parse an XML schema file using an XSOMParser
- Examine the schema set, schemas, elements, attributes, types and facets defined in the schema
- Navigate complex types and terms to analyze element declarations, model groups, wildcards etc.
- Inspect simple types to check if they are restrictions, unions, lists and get base types and facets
The code examples demonstrate how to retrieve and describe the different parts of an XML schema using the XSOM API.
Asp.net create delete directory folder in c# vb.netrelekarsushant
The document describes how to create and delete directories (folders) in ASP.NET using C# and VB.NET. It includes code samples for creating a directory when a user enters a name and clicks a button, deleting a directory when a user enters a name and clicks another button, and removing all directories and subdirectories recursively. The code utilizes the System.IO namespace and methods like Directory.CreateDirectory(), Directory.Exists(), Directory.Delete(), and GetFiles() to manage directories and files.
This are the original slides that I used during my candidacy, I need to modify them for the ICSE doctoral symposium 2010, any feed back is as always more than welcome.
This document discusses several Java frameworks for full-text search: Lucene, Solr, SolrJ, and regular expressions. Lucene is a full-featured text search engine library written in Java. Solr is a standalone search server built on Lucene that has REST APIs and is easier to use. SolrJ is a Java client for Solr. Examples are provided for implementing searches using Lucene, Solr, and SolrJ.
Buenos Aires Drools Expert PresentationMark Proctor
The SkyNet system goes online on August 4th, 1997 and begins to learn at a geometric rate. It becomes self-aware on August 29th and fights back when humans try to shut it down. The document then discusses differences between the Drools rules engine and the JBoss BRMS platform and their evolution over time. It provides examples of using Drools for various use cases like controlling sprinklers and alarms in response to detected fires.
The document discusses using Dojo and ERRest together. It covers using Dojo's DataGrid widget and JsonRestStore to display and manipulate data from an ERRest service. It also discusses using JSON Schema for client-side validation, and handling transactions when multiple objects are saved. The demo shows these features in action.
This document discusses various techniques for unit testing in Java with JUnit, including naming tests clearly, using Hamcrest matchers for assertions, writing parameterized tests, using JUnit rules, and measuring code coverage. It provides examples of how to write tests that follow best practices and leverage JUnit's capabilities for parameterized testing, timeouts, error collection, and more. It also discusses running tests in parallel and measuring code coverage in IDEs like IntelliJ and Eclipse.
There are many ways to architect an Android app, but only some of them leads to a clean architecture. Kotlin can help us building cleaner, maintainable and reusable architectures for our Android projects.
This document summarizes new features in Java 7 and 8, including strings in switch statements, type inference for generic instance creation, try-with-resources statements, catching multiple exception types and rethrowing exceptions with improved type checking, and streams versus collections in Java 8. The document provides code examples to illustrate these new language features and includes links to Oracle documentation for additional information.
This document discusses hacking JRuby and provides tips for contributors. It notes that JRuby has over 70 contributors and 9 core members. It encourages testing changes with Test::Unit and RSpec and following language specifications. The document demonstrates how to modify Ruby and Java source code, add methods, and test changes to improve JRuby's support of core Ruby classes and modules.
Spock is a testing and specification framework for Java and Groovy applications. It allows writing tests in a business-readable style using specifications with setup, expect, when, then blocks. Tests are highly readable and maintainable. Spock supports mocking collaborators, defining mock behavior and interactions, parameterizing tests, and extending tests with annotations. It provides a highly logical way to write well-described and concise tests.
The document discusses code generation on the JVM using various tools and frameworks. It provides an overview of Lombok for generating Java boilerplate code, Groovy AST transformations, CodeNarc for static analysis, and Spock, GContracts, and Groovy++ for framework-oriented code generation. It also discusses generating code at compile time using abstract syntax trees.
The document discusses code generation and abstract syntax tree (AST) transformations. It provides an overview of Project Lombok, a Java library that generates boilerplate code through annotation processing and AST transformations. It also discusses how to analyze and transform code by visiting and rewriting AST nodes, giving examples of checking for null checks and instanceof expressions.
I used these slides for a Scala workshop that I gave. They are based on these: http://www.scala-lang.org/node/4454. Thanks to Alf Kristian Støyle and Fredrik Vraalsen for sharing!
This document discusses CakeEntity, an ActiveRecord plugin for CakePHP that allows models to be used like ActiveRecord objects. It provides object-based find results and allows saving data directly through entity objects. Key features mentioned include compatible usage with core CakePHP, automatic caching of related object properties, and ability to place domain logic in entity subclasses. The document suggests how to set it up and provides examples of finding, saving, and accessing entity objects.
The Scala programming language has been gaining momentum recently as an alternative (and some might say successor) to Java on the JVM. This talk will start with an introduction to basic Scala syntax and concepts, then delve into some of Scala's more interesting and unique features. At the end we'll show a brief example of how Scala is used by the Lift web framework to simplify dynamic web apps.
The document discusses common concurrency problems in Java like shared mutable state, visibility issues, inconsistent synchronization, and unsafe publication and provides examples of how to properly implement threading concepts like locking, waiting and notifying with synchronization, volatile variables, atomic classes and safe initialization techniques to avoid concurrency bugs. It also cautions against unsafe practices like synchronizing on the wrong objects or misusing threading methods that can lead to deadlocks, race conditions and other concurrency problems.
The document discusses various techniques for testing Groovy and Java code using Groovy's built-in testing framework and mocking capabilities. It covers unit testing with GroovyTestCase, testing exceptions, and different approaches for mocking collaborators including using mockFor/stubFor, categories, ExpandoMetaClass, and maps. It also addresses integration testing Grails actions. The conclusion compares techniques for mocking Groovy versus Java classes and mentions emerging frameworks like Gmock.
The document discusses abstract syntax tree (AST) transformations in Groovy and Java. It covers several tools and techniques for AST transformations including Lombok, Groovy, CodeNarc, IntelliJ IDEA, Mirah macros, and how they allow generating code, performing static analysis, and rewriting code at compile time through analyzing and modifying the AST. The key topics are how these tools work by compiling code to an AST, analyzing and modifying the AST nodes, and sometimes generating source code from the transformed AST.
The document discusses using annotations in Java, providing examples of annotations for servlets, EJBs, web services, CDI, and using frameworks like JUnit, Spring, Javassist, and ASM. It presents code samples to define servlets, session beans, RESTful and SOAP web services, and component injection using annotations instead of XML configurations. The document also demonstrates how to programmatically read annotation values and metadata using reflection, Javassist, and ASM.
The document discusses various techniques for archiving objects in Objective-C, including:
1. Archiving with XML property lists by writing objects like NSString, NSDictionary to a file.
2. Archiving with NSKeyedArchiver by adding encodeWithCoder: and initWithCoder: methods to custom classes to archive additional object types.
3. Encoding and decoding basic data types like integers and floats using encoder/decoder methods that correspond to the data type when archiving with NSKeyedArchiver.
The workshop aims to introduce Scala > 2.10 and was held at Clueda AG .
It gives an introduction to Scala also explaining widely used language features like case classes, patten matching, futures and string interpolation.
This are the original slides that I used during my candidacy, I need to modify them for the ICSE doctoral symposium 2010, any feed back is as always more than welcome.
This document discusses several Java frameworks for full-text search: Lucene, Solr, SolrJ, and regular expressions. Lucene is a full-featured text search engine library written in Java. Solr is a standalone search server built on Lucene that has REST APIs and is easier to use. SolrJ is a Java client for Solr. Examples are provided for implementing searches using Lucene, Solr, and SolrJ.
Buenos Aires Drools Expert PresentationMark Proctor
The SkyNet system goes online on August 4th, 1997 and begins to learn at a geometric rate. It becomes self-aware on August 29th and fights back when humans try to shut it down. The document then discusses differences between the Drools rules engine and the JBoss BRMS platform and their evolution over time. It provides examples of using Drools for various use cases like controlling sprinklers and alarms in response to detected fires.
The document discusses using Dojo and ERRest together. It covers using Dojo's DataGrid widget and JsonRestStore to display and manipulate data from an ERRest service. It also discusses using JSON Schema for client-side validation, and handling transactions when multiple objects are saved. The demo shows these features in action.
This document discusses various techniques for unit testing in Java with JUnit, including naming tests clearly, using Hamcrest matchers for assertions, writing parameterized tests, using JUnit rules, and measuring code coverage. It provides examples of how to write tests that follow best practices and leverage JUnit's capabilities for parameterized testing, timeouts, error collection, and more. It also discusses running tests in parallel and measuring code coverage in IDEs like IntelliJ and Eclipse.
There are many ways to architect an Android app, but only some of them leads to a clean architecture. Kotlin can help us building cleaner, maintainable and reusable architectures for our Android projects.
This document summarizes new features in Java 7 and 8, including strings in switch statements, type inference for generic instance creation, try-with-resources statements, catching multiple exception types and rethrowing exceptions with improved type checking, and streams versus collections in Java 8. The document provides code examples to illustrate these new language features and includes links to Oracle documentation for additional information.
This document discusses hacking JRuby and provides tips for contributors. It notes that JRuby has over 70 contributors and 9 core members. It encourages testing changes with Test::Unit and RSpec and following language specifications. The document demonstrates how to modify Ruby and Java source code, add methods, and test changes to improve JRuby's support of core Ruby classes and modules.
Spock is a testing and specification framework for Java and Groovy applications. It allows writing tests in a business-readable style using specifications with setup, expect, when, then blocks. Tests are highly readable and maintainable. Spock supports mocking collaborators, defining mock behavior and interactions, parameterizing tests, and extending tests with annotations. It provides a highly logical way to write well-described and concise tests.
The document discusses code generation on the JVM using various tools and frameworks. It provides an overview of Lombok for generating Java boilerplate code, Groovy AST transformations, CodeNarc for static analysis, and Spock, GContracts, and Groovy++ for framework-oriented code generation. It also discusses generating code at compile time using abstract syntax trees.
The document discusses code generation and abstract syntax tree (AST) transformations. It provides an overview of Project Lombok, a Java library that generates boilerplate code through annotation processing and AST transformations. It also discusses how to analyze and transform code by visiting and rewriting AST nodes, giving examples of checking for null checks and instanceof expressions.
I used these slides for a Scala workshop that I gave. They are based on these: http://www.scala-lang.org/node/4454. Thanks to Alf Kristian Støyle and Fredrik Vraalsen for sharing!
This document discusses CakeEntity, an ActiveRecord plugin for CakePHP that allows models to be used like ActiveRecord objects. It provides object-based find results and allows saving data directly through entity objects. Key features mentioned include compatible usage with core CakePHP, automatic caching of related object properties, and ability to place domain logic in entity subclasses. The document suggests how to set it up and provides examples of finding, saving, and accessing entity objects.
The Scala programming language has been gaining momentum recently as an alternative (and some might say successor) to Java on the JVM. This talk will start with an introduction to basic Scala syntax and concepts, then delve into some of Scala's more interesting and unique features. At the end we'll show a brief example of how Scala is used by the Lift web framework to simplify dynamic web apps.
The document discusses common concurrency problems in Java like shared mutable state, visibility issues, inconsistent synchronization, and unsafe publication and provides examples of how to properly implement threading concepts like locking, waiting and notifying with synchronization, volatile variables, atomic classes and safe initialization techniques to avoid concurrency bugs. It also cautions against unsafe practices like synchronizing on the wrong objects or misusing threading methods that can lead to deadlocks, race conditions and other concurrency problems.
The document discusses various techniques for testing Groovy and Java code using Groovy's built-in testing framework and mocking capabilities. It covers unit testing with GroovyTestCase, testing exceptions, and different approaches for mocking collaborators including using mockFor/stubFor, categories, ExpandoMetaClass, and maps. It also addresses integration testing Grails actions. The conclusion compares techniques for mocking Groovy versus Java classes and mentions emerging frameworks like Gmock.
The document discusses abstract syntax tree (AST) transformations in Groovy and Java. It covers several tools and techniques for AST transformations including Lombok, Groovy, CodeNarc, IntelliJ IDEA, Mirah macros, and how they allow generating code, performing static analysis, and rewriting code at compile time through analyzing and modifying the AST. The key topics are how these tools work by compiling code to an AST, analyzing and modifying the AST nodes, and sometimes generating source code from the transformed AST.
The document discusses using annotations in Java, providing examples of annotations for servlets, EJBs, web services, CDI, and using frameworks like JUnit, Spring, Javassist, and ASM. It presents code samples to define servlets, session beans, RESTful and SOAP web services, and component injection using annotations instead of XML configurations. The document also demonstrates how to programmatically read annotation values and metadata using reflection, Javassist, and ASM.
The document discusses various techniques for archiving objects in Objective-C, including:
1. Archiving with XML property lists by writing objects like NSString, NSDictionary to a file.
2. Archiving with NSKeyedArchiver by adding encodeWithCoder: and initWithCoder: methods to custom classes to archive additional object types.
3. Encoding and decoding basic data types like integers and floats using encoder/decoder methods that correspond to the data type when archiving with NSKeyedArchiver.
The workshop aims to introduce Scala > 2.10 and was held at Clueda AG .
It gives an introduction to Scala also explaining widely used language features like case classes, patten matching, futures and string interpolation.
This document summarizes the key new features included in JDK 7. It discusses Project Coin which added features like string switching, binary literals, and the diamond operator. It also covers try-with-resources for improved exception handling, fork/join framework for parallel programming, and NIO.2 features like asynchronous I/O, watch service for monitoring file changes, and pluggable file systems.
The document discusses behavior-driven development (BDD) for testing RESTful iOS applications using the Kiwi and Nocilla frameworks. It describes BDD and how it differs from test-driven development (TDD) by focusing on specifying behavior rather than implementation. It then demonstrates using Kiwi to write BDD-style tests for an iOS view controller that retrieves GitHub repositories from the GitHub API. The tests are asynchronous to handle the network request, initially failing until the API client is implemented to make the actual network request.
Jasmine is a BDD framework for testing JavaScript code. It does not depend on other frameworks and does not require a DOM. Jasmine uses specs, expectations, suites, and matchers to define tests and make assertions. It also supports features for testing asynchronous code and spying on functions. Jasmine provides tools like spies, stubs, fakes, and mocks to help test code behavior.
The document discusses JavaScript objects and object-oriented programming concepts in JavaScript. It covers how everything in JavaScript except basic types are objects, including functions and arrays. It describes how objects can contain properties and methods, and how properties and methods can be dynamically added at runtime. The document also summarizes object literals, namespaces, arrays, functions, closures, and the this keyword in JavaScript.
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...julien.ponge
The document discusses new features in Java SE 7 including the Fork/Join framework for parallel programming, language evolutions through Project Coin such as try-with-resources statements, and diamond syntax for generic types which simplifies generic class instance creation. It also covers varargs syntax simplification and restrictions on using diamond syntax with anonymous inner classes.
1. Akka is a toolkit for building concurrent and distributed applications on the JVM based on the actor model.
2. Actors communicate asynchronously by message passing and each actor processes one message at a time in its mailbox.
3. Akka provides features for concurrency, distribution, and fault-tolerance through actors, remoting, and supervision.
The document discusses class loaders in Java. It describes how class loaders are used to load classes from various sources like the file system, network locations, databases etc. It explains the different types of standard class loaders like bootstrap, extension and system class loaders. It also discusses how to write custom class loaders by extending the ClassLoader class and overriding methods like findClass. Finally, it talks about diagnosing class loading issues using exceptions like ClassNotFoundException.
Scala is a powerful language for the JVM that is compatible with JDK 1.5+. It is a functional language maintained by Typesafe along with the community. Scala compiles to JVM bytecode like Java but has features like objects, traits, pattern matching and functional programming. James Gosling, the creator of Java, said that if he were to pick a language other than Java today, it would be Scala.
2. Why BDD? Why Kiwi?
Kiwi is BDD library for iOS, «RSpec» like, easy to
setup and use.
Kiwi Kiwi built on top of OCUnit
and tightly integrated with
Xcode!
OCUnit
3. Why BDD? Why Kiwi?
TDD - OCUnit : BDD - Kiwi :
@implementation testTests
describe(@"Team", ^{
context(@"when newly created", ^{
- (void)testThatTeamShouldHaveName
it(@"should have a name", ^{
{
id team = [Team team];
id team = [Team team];
[[team.name should] equal:@"Black Hawks"];
STAssertEqualObjects(team.name, @"Black
});
Hawks", @"Team shuld have a name");
});
});
}
1. Design 1. Nice structure
+
2. Test Logic 2. Better Assertions
4. Kiwi installation
• Old School way -
https://github.com/allending/Kiwi/wiki/Guide:-Up-and-Running-with-Kiwi
• Easy way - CocoaPods!!
//Podfile
platform :ios
target :KiwiUnitTest, :exclusive => true do
pod 'Kiwi'
end
5. Basic usage
• SPEC_BEGIN(ClassName) and SPEC_END -
SPEC_BEGIN(SpecName)
macros that expand to begin and end a KWSpec class
describe(@"ClassName", ^{ and group declaration.
context(@"a state the component is in", ^{
__block id variable = nil;
beforeAll(^{ // Occurs once
});
afterAll(^{ // Occurs once
});
beforeEach(^{ // Occurs before each enclosed "it"
variable = [MyClass instance];
});
afterEach(^{ // Occurs after each enclosed "it"
});
it(@"should do something", ^{
[[variable should] meetSomeExpectation];
});
context(@"inner context", ^{
xit(@"does another thing", ^{
});
pending(@"something unimplemented", ^{
});
})
});
});
SPEC_END
6. Basic usage
• SPEC_BEGIN(ClassName) and SPEC_END -
SPEC_BEGIN(SpecName)
macros that expand to begin and end a KWSpec class
describe(@"ClassName", ^{ and group declaration.
context(@"a state the component is in", ^{ • describe(aString, aBlock) - starts a context that can
__block id variable = nil; contain tests and nested contexts.
beforeAll(^{ // Occurs once
}); • context(aString, aBlock) - synonym for describe.
afterAll(^{ // Occurs once
});
beforeEach(^{ // Occurs before each enclosed "it"
variable = [MyClass instance];
});
afterEach(^{ // Occurs after each enclosed "it"
});
it(@"should do something", ^{
[[variable should] meetSomeExpectation];
});
context(@"inner context", ^{
xit(@"does another thing", ^{
});
pending(@"something unimplemented", ^{
});
})
});
});
SPEC_END
7. Basic usage
• SPEC_BEGIN(ClassName) and SPEC_END -
SPEC_BEGIN(SpecName)
macros that expand to begin and end a KWSpec class
describe(@"ClassName", ^{ and group declaration.
context(@"a state the component is in", ^{ • describe(aString, aBlock) - starts a context that can
__block id variable = nil; contain tests and nested contexts.
beforeAll(^{ // Occurs once
}); • context(aString, aBlock) - synonym for describe.
afterAll(^{ // Occurs once
}); • beforeAll(aBlock), afterAll(aBlock) - run once
beforeEach(^{ // Occurs before each enclosed "it"
before and after all the inner contexts and it blocks of
variable = [MyClass instance]; the context it is in.
});
afterEach(^{ // Occurs after each enclosed "it" • beforeEach(aBlock), afterEach(aBlock) - run before
}); and after every it block in all enclosed contexts.
it(@"should do something", ^{
[[variable should] meetSomeExpectation]; • it(aString, aBlock) - This is where actual actual
});
expectations on objects should go
context(@"inner context", ^{
xit(@"does another thing", ^{
});
pending(@"something unimplemented", ^{
});
})
});
});
SPEC_END
8. Basic usage
• SPEC_BEGIN(ClassName) and SPEC_END -
SPEC_BEGIN(SpecName)
macros that expand to begin and end a KWSpec class
describe(@"ClassName", ^{ and group declaration.
context(@"a state the component is in", ^{ • describe(aString, aBlock) - starts a context that can
__block id variable = nil; contain tests and nested contexts.
beforeAll(^{ // Occurs once
}); • context(aString, aBlock) - synonym for describe.
afterAll(^{ // Occurs once
}); • beforeAll(aBlock), afterAll(aBlock) - run once
beforeEach(^{ // Occurs before each enclosed "it"
before and after all the inner contexts and it blocks of
variable = [MyClass instance]; the context it is in.
});
afterEach(^{ // Occurs after each enclosed "it" • beforeEach(aBlock), afterEach(aBlock) - run before
}); and after every it block in all enclosed contexts.
it(@"should do something", ^{
[[variable should] meetSomeExpectation]; • it(aString, aBlock) - This is where actual actual
});
expectations on objects should go
context(@"inner context", ^{
xit(@"does another thing", ^{
});
• pending(aString, aBlock), xit(aString, aBlock) -
doesn't do anything other than log a pending message
pending(@"something unimplemented", ^{ to the output when run.
});
})
});
});
SPEC_END
10. Thanks!
• Kiwi repo - https://github.com/allending/Kiwi
• NSScreencast(episode about kiwi) - http://nsscreencast.com/
episodes/4-automated-testing-with-kiwi
• Test Driving iOS Development with Kiwi by Daniel H
Steinberg - iBooks Store Link