All Projects → vadymmarkov → Fakery

vadymmarkov / Fakery

Licence: other
👽 Swift fake data generator

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Fakery

Bookstore Ios
 Sample iOS App - A collection of examples and patterns for Unit Testing, UI Testing, handling Result/Optionals, writing documentation, and more. Details in README.
Stars: ✭ 147 (-90.65%)
Mutual labels:  swift-framework, unit-testing
Quiz App
A repository reflecting the progress made on the "How to Build iOS Apps with Swift, TDD & Clean Architecture" YouTube series, by Caio & Mike.
Stars: ✭ 230 (-85.37%)
Mutual labels:  swift-framework, unit-testing
Faker.NET.Portable
C# port of the Ruby Faker gem (http://faker.rubyforge.org/)
Stars: ✭ 22 (-98.6%)
Mutual labels:  unit-testing, fake
Unit Threaded
Advanced unit test framework for D
Stars: ✭ 100 (-93.64%)
Mutual labels:  unit-testing
Swift
🥇Swift基础知识大全,🚀Swift学习从简单到复杂,不断地完善与更新, 欢迎Star❤️,欢迎Fork, iOS开发者交流:①群:446310206 ②群:426087546
Stars: ✭ 1,377 (-12.4%)
Mutual labels:  swift-framework
Rspec
(Rust) Rspec - a BDD test harness for stable Rust
Stars: ✭ 106 (-93.26%)
Mutual labels:  unit-testing
Sequelize Mock
A simple mock interface specifically for testing code relying on Sequelize models
Stars: ✭ 116 (-92.62%)
Mutual labels:  unit-testing
Faker
A library for generating fake data such as names, addresses, and phone numbers.
Stars: ✭ 9,638 (+513.1%)
Mutual labels:  fake
Moderncppci
This is an example of doing a Modern C++ project with CI
Stars: ✭ 109 (-93.07%)
Mutual labels:  unit-testing
Automation Arsenal
Curated list of popular Java and Kotlin frameworks, libraries and tools related to software testing, quality assurance and adjacent processes automation.
Stars: ✭ 105 (-93.32%)
Mutual labels:  unit-testing
Faker Cli
cli wrapper for fakerjs
Stars: ✭ 104 (-93.38%)
Mutual labels:  fake
Xunit.analyzers
Roslyn analyzers for xUnit.net (please open issues in https://github.com/xunit/xunit)
Stars: ✭ 102 (-93.51%)
Mutual labels:  unit-testing
Vaporsecurityheaders
Harden Your Security Headers For Vapor
Stars: ✭ 107 (-93.19%)
Mutual labels:  swift-framework
Webmidikit
Simplest MIDI Swift library
Stars: ✭ 100 (-93.64%)
Mutual labels:  swift-framework
Spring Data Mock
Mock facility for Spring Data repositories
Stars: ✭ 110 (-93%)
Mutual labels:  unit-testing
Impersonator
Ruby library to record and replay object interactions
Stars: ✭ 100 (-93.64%)
Mutual labels:  fake
Awesome Ios
A curated list of awesome iOS ecosystem, including Objective-C and Swift Projects
Stars: ✭ 38,720 (+2363.1%)
Mutual labels:  swift-framework
Swiftui Cardstackview
A easy-to-use SwiftUI view for Tinder like cards on iOS, macOS & watchOS.
Stars: ✭ 102 (-93.51%)
Mutual labels:  swift-framework
Faker
A library for Dart that generates fake data.
Stars: ✭ 103 (-93.45%)
Mutual labels:  fake
Virtual Alexa
🤖 Easily test and debug Alexa skills programmatically
Stars: ✭ 106 (-93.26%)
Mutual labels:  unit-testing

Fakery logo CI Status Carthage Version License Platform

This is a Swift port of Ruby's Faker library that generates fake data.

Are you still bothered with meaningless randomly character strings? Just relax and leave this job to Fakery. It's useful in all the cases when you need to use some dummy data for testing, population of database during development, etc.

NOTE: Generated data is pretty realistic, supports a range of locales, but returned values are not guaranteed to be unique.

Table of Contents

Usage

import Fakery

let faker = Faker(locale: "nb-NO")

let firstName = faker.name.firstName()  //=> "Emilie"
let lastName = faker.name.lastName()    //=> "Hansen"
let city = faker.address.city()         //=> "Oslo"

Localization

Fakery is quite powerful when it comes to generation of locale-specific data. In Resources/Locales you can find JSON files for more than 20 locales, and, of course, it's not a limit. Feel free to contribute and add more!

The default locale is English. When you use one of the available generators and the corresponding key is not found in a JSON file for the currently selected locale Fakery will also check if it exists in "en.json" file.

Generators

Address

faker.address.city() //=> "Oslo"
faker.address.streetName() //=> "North Avenue"
faker.address.secondaryAddress() //=> "Apt. 123"
faker.address.streetAddress(includeSecondary: Bool) //=> "12 North Avenue"
faker.address.buildingNumber() //=> "123"
faker.address.postcode(stateAbbreviation: String) //=> "0884"
faker.address.timeZone() //=> "America/Los_Angeles"
faker.address.streetSuffix() //=> "Avenue"
faker.address.citySuffix() //=> "town"
faker.address.cityPrefix() //=> "North"
faker.address.stateAbbreviation() //=> "CA"
faker.address.state() //=> "California"
faker.address.county() //=> "Autauga County"
faker.address.country() //=> "United States of America"
faker.address.countryCode() //=> "US"
faker.address.latitude() //=> -58.17256227443719
faker.address.longitude() //=> -156.65548382095133
faker.address.coordinate() //=> CLLocationCoordinate2D(latitude: 40.97868, longitude: 29.09306)

App

faker.app.name() //=> "Namfix"
faker.app.version() //=> "0.1.1"
faker.app.author() //=> "Ida Adams"

Business

faker.business.creditCardNumber() //=> "1234-2121-1221-1211"
faker.business.creditCardType() //=> "visa"
faker.business.creditCardExpiryDate() //=> "2020-10-12"

Cat

faker.cat.name() //=> "Shadow"        
faker.cat.breed() //=> "British Semipi-longhair"
faker.cat.registry() //=> "American Cat Fanciers Association"

Commerce

faker.commerce.color() //=> "black"
faker.commerce.department(maximum: Int, fixedAmount: Bool) //=> "Music"
faker.commerce.productName() //=> "Awesome Wooden Hat"
faker.commerce.price() // 90.5

Company

faker.company.name() //=> "Adams Inc"       
faker.company.suffix() //=> "Inc"
faker.company.catchPhrase() //=> "Universal software"        
faker.company.bs() //=> "implement innovative methodologies"
faker.company.logo() // "http://pigment.github.io/fake-logos/logos/medium/color/1.png"

Zelda

faker.zelda.game() //=> "Ocarina of Time"   

Gender

faker.gender.type() //=> "Agender"
faker.gender.binaryType() //=> "Male"

Internet

faker.internet.username(separator: String?) //=> "ida4"       
faker.internet.domainName(alphaNumericOnly: Bool) //=> "example.com"        
faker.internet.domainWord(alphaNumericOnly: Bool) //=> "domainword"        
faker.internet.domainSuffix() //=> "com"
faker.internet.email() // => "[email protected]"
faker.internet.freeEmail() //=> "gmail.com"
faker.internet.safeEmail() //=> "[email protected]"
faker.internet.password(minimumLength: Int, maximumLength: Int) //=> "e2dddhwd1g5qhvhgfi"
faker.internet.ipV4Address() //=> "24.29.18.175"
faker.internet.ipV6Address() //=> "ac5f:d696:3807:1d72:2eb5:4e81:7d2b:e1df"
faker.internet.url() //=> "http://example.com/ida4"
faker.internet.image() //=> "http://lorempixel.com/320/200"
faker.internet.templateImage() //=> "http://dummyimage.com/320x200/000000/ffffff"
faker.internet.hashtag() //=> "#art"

Lorem

faker.lorem.word() //=> "repellendus"         
faker.lorem.words(amount: Int) //=> ["dolores", "adipisci", "nesciunt"]      
faker.lorem.character() //=> "a"        
faker.lorem.characters(amount: Int) // Default = 255
faker.lorem.sentence(wordsAmount: Int) // Default = 4
faker.lorem.sentences(amount: Int) // Default = 3
faker.lorem.paragraph(sentencesAmount: Int) // Default = 3
faker.lorem.paragraphs(amount: Int) // Default = 3

Name

faker.name.name() //=> "Ida Adams"        
faker.name.firstName() //=> "Ida"
faker.name.lastName() //=> "Adams"
faker.name.prefix() //=> "Mrs."
faker.name.suffix() //=> "PhD"
faker.name.title() //=> "Lead"

Number

faker.number.randomBool() //=> true or false
faker.number.randomInt() //=> some Int between 0 and 1000
faker.number.randomInt(min: -100, max:50) //=> some Int between -100 and 50
faker.number.randomFloat() //=> some Float between 0 and 1000
faker.number.randomFloat(min: -10.4, max:50) //=> some Float between -10.4 and 50
faker.number.randomCGFloat() //=> some CGFloat between 0 and 1000
faker.number.randomCGFloat(min: 42.42, max:86) //=> some CGFloat between -42.42 and 86
faker.number.randomDouble() //=> some Double between 0 and 1000
faker.number.randomDouble(min: 0, max:1) //=> some Double between 0 and 1
faker.number.increasingUniqueId() //=> every call returns an unique int

Phone number

faker.phoneNumber.phoneNumber() //=> "1-333-333-3333"        
faker.phoneNumber.cellPhone() //=> "333-333-3333"
faker.phoneNumber.areaCode() //=> "201"
faker.phoneNumber.exchangeCode() //=> "201"
faker.phoneNumber.subscriberNumber() //=> "1234"
faker.phoneNumber.numberExtension(length: Int) // "123"

Team

faker.team.name() //=> "bats"         
faker.team.creature() //=> "Alabama bats"
faker.team.state() // => "Alabama"

Bank

faker.bank.name() //=> "ABN AMRO CORPORATE FINANCE LIMITED"         
faker.bank.swiftBic() //=> "AAFMGB21"
faker.bank.iban() // => "NL45BUNQ2209931378"
faker.bank.bban() //=> ABNA0136468471

Hobbit

faker.hobbit.character() //=> "Bilbo Baggins"         
faker.hobbit.thorinsCompany() //=> "Thorin Oakenshield"
faker.hobbit.quote() // => "Do you wish me a good morning, or mean that it is a good morning whether I want it or not; or that you feel good this morning; or that it is a morning to be good on?"
faker.hobbit.location() //=> "Bree"

Car

faker.car.brand() //=> "BMW"

Programming language

faker.programming_language.name() //=> "Elixir"         
faker.programming_language.creator() //=> "José Valim"         

Vehicle

faker.vehicle.manufacture() //=> "Volkswagen" 
faker.vehicle.make() //=> "BMW"
faker.vehicle.colors() //=> "Red"

Ham

faker.ham.name() //=> "Taylor Ham"         

House

faker.house.furniture() //=> "chair"
faker.house.room() //=> "living room" 

Installation

Fakery is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Fakery'

Or alternatively using the Swift Package Manager:

let package = Package(
    //
    dependencies[
        .package(name: "Fakery", url: "https://github.com/vadymmarkov/Fakery", from: "5.0.0"))
    ],
    targets: [
        .target(name: "Foo", dependencies: ["Fakery"]
    ]
)

Use of the Swift Package Manager requires Swift >=5.3.

Contributing

Please see our playbook for guidelines on contributing.

Author

Vadym Markov, [email protected]

License

Fakery is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].