Git Product home page Git Product logo

approvaltests.swift's Introduction

ApprovalTests

Capturing Human Intelligence - ApprovalTests is an open source assertion/verification library to aid unit testing.

ApprovalsTest Swift is compatible with the XCUnit testing framework

What can it be used for?

Approval Tests can be used for verifying objects that require more than a simple assert.

You can watch a bunch of short videos on getting started and using ApprovalTests in .Net at YouTube

Podcasts

If you prefer auditory learning, you might enjoy the following podcast

How to get it

CocoaPods

target 'MyApp' do
  use_frameworks!

  # Pods for MyApp 

  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing
    pod 'ApprovalTests_Swift', :git => 'https://github.com/approvals/ApprovalTests.Swift.git'
  end

end

Examples

Sample Code

class SampleTest: XCTestCase {

    	func testList() throws {
        	var names: [String] = ["Llewellyn", "James", "Dan", "Jason", "Katrina"]
        	names.sort()
        	try Approvals.verifyAll("", names);
    	}
}

Will Produce a File

SampleTest.testList.received.txt
[0] = Dan
[1] = James
[2] = Jason
[3] = Katrina
[4] = Llewellyn

Simply rename this to SampleTest.testList.approved.txt and the test will now pass.

Approved File Artifacts

The *.approved.* files must be checked into source your source control. ApprovalTests now ignores line endings by default (so you can remove *.approved.* binary from your .gitattributes file if you added previously).

If you would like to verify line endings, simply add [assembly: IgnoreLineEndingsAttribute(false)] to your AssemblyInfo.cs

Do not add *.received.* files to your source control (they are transitory, and some SCMs like TFS will lock them or mark them read-only, which will break every dependent test).

More Info

LICENSE

Apache 2.0 License

Questions?

ask on twitter: @LlewellynFalco or #ApprovalTests

approvaltests.swift's People

Contributors

micg-il avatar jonreid avatar mcarlson-sb avatar lt-dustinson avatar isidore avatar totomo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.