├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── Example ├── .gitignore ├── Default-568h@2x.png ├── OCSlimProject.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ ├── OCSlimProjectTestBundleSupportTests.xcscheme │ │ ├── OCSlimProjectTestBundleSupportTestsMac.xcscheme │ │ ├── OCSlimProject_AcceptanceTests.xcscheme │ │ ├── OCSlimProject_AcceptanceTestsMac.xcscheme │ │ ├── OCSlimProject_AcceptanceUnitTestBundle.xcscheme │ │ ├── OCSlimProject_AcceptanceUnitTestBundleMac.xcscheme │ │ ├── OCSlimProject_Example.xcscheme │ │ └── OCSlimProject_ExampleMac.xcscheme ├── OCSlimProject │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Info.plist │ └── ViewController.swift ├── OCSlimProjectTestBundleSupportTests-Resources │ ├── Fitnesse-Test-Report.xml │ ├── Info.plist │ ├── SuiteTestResultErrors.xml │ ├── SuiteTestResultFailures-3.xml │ ├── SuiteTestResultFailures-Exceptions.xml │ ├── SuiteTestResultFailures-NotFound.xml │ ├── SuiteTestResultFailures.xml │ ├── SuiteTestResultSuccess-3.xml │ ├── SuiteTestResultSuccess-Empty.xml │ └── SuiteTestResultSuccess.xml ├── OCSlimProject_AcceptanceTests │ ├── Empty.xib │ ├── FixtureExample.swift │ ├── Info.plist │ ├── OCSlimProject_AcceptanceTests-Bridging-Header.h │ ├── OCSlimProject_AcceptanceTests.m │ └── SlimTables.h ├── OCSlimProject_AcceptanceTestsMac │ ├── Empty.xib │ ├── FixtureExample.swift │ ├── Info.plist │ ├── OCSlimProject_AcceptanceTestsMac-Bridging-Header.h │ ├── OCSlimProject_AcceptanceTestsMac.m │ └── SlimTables.h ├── OCSlimProject_AcceptanceUnitTestBundle │ ├── Info.plist │ └── OCSlimProjectTestBundleSupport.m ├── OCSlimProject_AcceptanceUnitTestBundleMac │ ├── Info.plist │ └── OCSlimProjectTestBundleSupport.m ├── OCSlimProject_ExampleMac │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ └── MainMenu.xib │ ├── Info.plist │ └── main.m ├── OCSlimProject_ExampleTests │ ├── Info.plist │ └── OCSlimProject_ExampleTests.m └── Podfile ├── Icon.png ├── Images ├── Fitnesse-App-Architecture-Diagram.jpeg ├── Icon.png ├── iOS-Acceptance-Test-Template.png └── iOS-Acceptance-Unit-Test-Template.png ├── LICENSE ├── OCSlimProject-iOS-Diagram-Redux.msd ├── OCSlimProject-iOS-Diagram.msd ├── OCSlimProject.podspec ├── OCSlimProjectTestBundleSupport.podspec ├── Pod ├── Classes │ └── OCSlimProject.h ├── Resources │ └── en.lproj │ │ └── Localizable.strings ├── Support │ ├── OSX │ │ └── RunTestsTargetWithSlimPort │ ├── SharedSupport │ │ ├── FitNesseRoot │ │ │ ├── FrontPage │ │ │ │ ├── content.txt │ │ │ │ └── properties.xml │ │ │ ├── OCSlimProjectExamplePage │ │ │ │ ├── TestPage │ │ │ │ │ ├── content.txt │ │ │ │ │ └── properties.xml │ │ │ │ ├── content.txt │ │ │ │ └── properties.xml │ │ │ └── content.txt │ │ ├── LICENCE.txt │ │ ├── LaunchFitnesse │ │ ├── fitnesse-standalone.jar │ │ ├── ocsp-generate-fitnesse-test-report.sh │ │ ├── ocsp-generate-fitnesse-test-system-scripts.sh │ │ └── ocsp-generate-fitnesse-test-system-template.sh │ └── iOS │ │ ├── RunTestsTargetWithSlimPort │ │ └── simctl └── TestClasses │ ├── OCSPAssertRecorder.h │ ├── OCSPAssertRecorder.m │ ├── OCSPJUnitXMLParser.h │ ├── OCSPJUnitXMLParser.m │ ├── OCSPJUnitXMLParserTests.m │ ├── OCSPLocalizedMessageTable.h │ ├── OCSPLocalizedMessageTable.m │ ├── OCSPLocalizedMessageTableTests.m │ ├── OCSPPrincipalTestObserver.h │ ├── OCSPPrincipalTestObserver.m │ ├── OCSPPrincipalTestObserverTests.m │ ├── OCSPTestCaseReport.h │ ├── OCSPTestCaseReport.m │ ├── OCSPTestDataManager.h │ ├── OCSPTestDataManager.m │ ├── OCSPTestReportCenter.h │ ├── OCSPTestReportCenter.m │ ├── OCSPTestReportCenterTests.m │ ├── OCSPTestReportReader.h │ ├── OCSPTestReportReader.m │ ├── OCSPTestReportReaderTests.m │ ├── OCSPTestSuite.h │ ├── OCSPTestSuite.m │ ├── OCSPTestSuiteTestable.h │ ├── OCSPTestSuiteTestable.m │ └── OCSPTestSuiteTests.m ├── README.md └── update_pod_testrunner_sripts.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Example/LaunchFitnesse 3 | *.xcworkspace 4 | *.log 5 | Podfile.lock 6 | Example/Pods/ 7 | Example/OCSlimProjectTestRunner.sh 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: 2 | - osx 3 | 4 | language: objective-c 5 | cache: cocoapods 6 | podfile: Example/Podfile 7 | osx_image: xcode11.3 8 | before_install: 9 | - gem install cocoapods # Since Travis is not always on latest version 10 | 11 | xcode_workspace: Example/OCSlimProject.xcworkspace 12 | xcode_destination: platform=iOS Simulator,name=iphone 11 13 | 14 | jobs: 15 | include: 16 | - name: "Build & Test Example (macOS)" 17 | xcode_scheme: OCSlimProject_ExampleMac 18 | xcode_destination: platform=macOS 19 | - name: "Run Test Bundle Unit Tests (macOS)" 20 | xcode_scheme: OCSlimProjectTestBundleSupportTestsMac 21 | xcode_destination: platform=macOS 22 | - name: "Build & Test Example (iOS)" 23 | xcode_scheme: OCSlimProject_Example 24 | - name: "Run Test Bundle Unit Tests (iOS)" 25 | xcode_scheme: OCSlimProjectTestBundleSupportTests 26 | - name: "Pod library lint" 27 | script: 28 | - pod lib lint OCSlimProject.podspec --allow-warnings 29 | - pod lib lint OCSlimProjectTestBundleSupport.podspec --use-libraries --allow-warnings 30 | 31 | 32 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 1.3 (2016-09-06) 2 | === 3 | 4 | #####New Features 5 | 6 | * XCTest Integration 7 | 8 | - Run Fitnesse Acceptance Tests with Xcode using the new Acceptance Unit Test Bundle Template. 9 | - See Fitnesse tests reports as regular XCTest cases. 10 | - Supports xcodebuild and xctool and works with popular CI systems such as Travis and Jenkins. 11 | 12 | ##### OCSlimProject Enhancements 13 | 14 | * Fitnesse (version ) now included, no seperate download needed. 15 | 16 | * Upgrade ios-sim to version 5.0.8, improves stability and removes errors. 17 | 18 | * Support for macOS 10.11 and Xcode 8 19 | 20 | * Improves project resource and script architecture to share resources between multiple targets. 21 | 22 | * Improves project architecture to provide improved flexibility for future script changes. 23 | 24 | ##### LaunchFitnesse 25 | 26 | * New Features 27 | 28 | * Adds --shutdown command. *Performs a clean shutdown of any running instances of Fitnesse.* 29 | 30 | ```$ ./LaunchFitnesse --shutdown ``` 31 | 32 | * Adds --test command. *Runs Tests specified by the Suite Name and redirects output to a file.* 33 | 34 | ```$ ./LaunchFitnesse --test -b ``` 35 | 36 | * Adds --open command. *Opens Fitnesse in a Browser.* 37 | 38 | ```$ ./LaunchFitnesse --open``` 39 | 40 | * Enhancements 41 | 42 | * LaunchFitnesse exits after launching, returning control to the user. 43 | 44 | * Detects existing versions of Fitnesse instead of attempting to launch a new instance 45 | 46 | * Reduces launch time of iPhone Simulator by recyling the last Simulator used by Xcode 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Example/.gitignore: -------------------------------------------------------------------------------- 1 | # FitNesse is not part of the project. Please download it from http://www.fitnesse.org/FitNesseDownload 2 | fitnesse-standalone.jar 3 | 4 | # Created by .ignore support plugin (hsz.mobi) 5 | ### Swift template 6 | # Xcode 7 | # 8 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 9 | 10 | ## Build generated 11 | build/ 12 | DerivedData 13 | 14 | ## Various settings 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | xcuserdata 24 | 25 | ## Other 26 | *.xccheckout 27 | *.moved-aside 28 | *.xcscmblueprint 29 | 30 | ## Obj-C/Swift specific 31 | *.hmap 32 | *.ipa 33 | 34 | # CocoaPods 35 | # 36 | # We recommend against adding the Pods directory to your .gitignore. However 37 | # you should judge for yourself, the pros and cons are mentioned at: 38 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 39 | # 40 | # Pods/ 41 | 42 | # Carthage 43 | # 44 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 45 | # Carthage/Checkouts 46 | 47 | Carthage/Build 48 | 49 | 50 | 51 | ### JetBrains template 52 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio 53 | 54 | *.iml 55 | 56 | ## Directory-based project format: 57 | .idea/ 58 | # if you remove the above rule, at least ignore the following: 59 | 60 | # User-specific stuff: 61 | # .idea/workspace.xml 62 | # .idea/tasks.xml 63 | # .idea/dictionaries 64 | 65 | # Sensitive or high-churn files: 66 | # .idea/dataSources.ids 67 | # .idea/dataSources.xml 68 | # .idea/sqlDataSources.xml 69 | # .idea/dynamic.xml 70 | # .idea/uiDesigner.xml 71 | 72 | # Gradle: 73 | # .idea/gradle.xml 74 | # .idea/libraries 75 | 76 | # Mongo Explorer plugin: 77 | # .idea/mongoSettings.xml 78 | 79 | ## File-based project format: 80 | *.ipr 81 | *.iws 82 | 83 | ## Plugin-specific files: 84 | 85 | # IntelliJ 86 | /out/ 87 | 88 | # mpeltonen/sbt-idea plugin 89 | .idea_modules/ 90 | 91 | # JIRA plugin 92 | atlassian-ide-plugin.xml 93 | 94 | # Crashlytics plugin (for Android Studio and IntelliJ) 95 | com_crashlytics_export_strings.xml 96 | crashlytics.properties 97 | crashlytics-build.properties 98 | 99 | .simctl.pid 100 | Podfile.local 101 | -------------------------------------------------------------------------------- /Example/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulstringer/OCSlimProject/85b250f1b8f88ac32bb63bd89b6111d7c3a468ab/Example/Default-568h@2x.png -------------------------------------------------------------------------------- /Example/OCSlimProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/OCSlimProject.xcodeproj/xcshareddata/xcschemes/OCSlimProjectTestBundleSupportTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 61 | 63 | 69 | 70 | 71 | 72 | 78 | 79 | 85 | 86 | 87 | 88 | 90 | 91 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /Example/OCSlimProject.xcodeproj/xcshareddata/xcschemes/OCSlimProjectTestBundleSupportTestsMac.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 57 | 58 | 60 | 61 | 63 | 64 | 66 | 67 | 68 | 69 | 70 | 71 | 81 | 83 | 89 | 90 | 91 | 92 | 98 | 99 | 105 | 106 | 107 | 108 | 110 | 111 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /Example/OCSlimProject.xcodeproj/xcshareddata/xcschemes/OCSlimProject_AcceptanceTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 42 | 48 | 49 | 50 | 51 | 52 | 62 | 64 | 70 | 71 | 72 | 73 | 79 | 81 | 87 | 88 | 89 | 90 | 92 | 93 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /Example/OCSlimProject.xcodeproj/xcshareddata/xcschemes/OCSlimProject_AcceptanceTestsMac.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 42 | 48 | 49 | 50 | 51 | 52 | 62 | 64 | 70 | 71 | 72 | 73 | 79 | 81 | 87 | 88 | 89 | 90 | 92 | 93 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /Example/OCSlimProject.xcodeproj/xcshareddata/xcschemes/OCSlimProject_AcceptanceUnitTestBundle.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 14 | 15 | 17 | 23 | 24 | 25 | 26 | 27 | 37 | 38 | 44 | 45 | 47 | 48 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Example/OCSlimProject.xcodeproj/xcshareddata/xcschemes/OCSlimProject_AcceptanceUnitTestBundleMac.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 14 | 15 | 17 | 23 | 24 | 25 | 26 | 27 | 37 | 38 | 44 | 45 | 47 | 48 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Example/OCSlimProject.xcodeproj/xcshareddata/xcschemes/OCSlimProject_Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 42 | 48 | 49 | 50 | 51 | 52 | 62 | 64 | 70 | 71 | 72 | 73 | 79 | 81 | 87 | 88 | 89 | 90 | 92 | 93 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /Example/OCSlimProject.xcodeproj/xcshareddata/xcschemes/OCSlimProject_ExampleMac.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 42 | 48 | 49 | 50 | 51 | 52 | 62 | 64 | 70 | 71 | 72 | 73 | 79 | 81 | 87 | 88 | 89 | 90 | 92 | 93 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /Example/OCSlimProject/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // OCSlimProject 4 | // 5 | // Created by Paul Stringer on 11/29/2015. 6 | // Copyright (c) 2015 Paul Stringer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Example/OCSlimProject/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Example/OCSlimProject/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Example/OCSlimProject/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "scale" : "1x", 46 | "size" : "1024x1024" 47 | } 48 | ], 49 | "info" : { 50 | "author" : "xcode", 51 | "version" : 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Example/OCSlimProject/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/OCSlimProject/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Example/OCSlimProject/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // OCSlimProject 4 | // 5 | // Created by Paul Stringer on 11/29/2015. 6 | // Copyright (c) 2015 Paul Stringer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | // Do any additional setup after loading the view, typically from a nib. 16 | } 17 | 18 | override func didReceiveMemoryWarning() { 19 | super.didReceiveMemoryWarning() 20 | // Dispose of any resources that can be recreated. 21 | } 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Example/OCSlimProjectTestBundleSupportTests-Resources/Fitnesse-Test-Report.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | OCSlimProjectExamplePage?pageHistory&resultDate=20160622112522 6 | 7 | -------------------------------------------------------------------------------- /Example/OCSlimProjectTestBundleSupportTests-Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/OCSlimProjectTestBundleSupportTests-Resources/SuiteTestResultErrors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Example/OCSlimProjectTestBundleSupportTests-Resources/SuiteTestResultFailures-3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | OCSlimProjectExampleSuite?pageHistory&resultDate=20160622112522 6 | 7 | 8 | 9 | OCSlimProjectExampleSuite?pageHistory&resultDate=20160622112522 10 | 11 | 12 | 13 | OCSlimProjectExampleSuite?pageHistory&resultDate=20160622112522 14 | 15 | -------------------------------------------------------------------------------- /Example/OCSlimProjectTestBundleSupportTests-Resources/SuiteTestResultFailures-Exceptions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | OCSlimProjectExampleSuite?pageHistory&resultDate=20160622112522 6 | 7 | -------------------------------------------------------------------------------- /Example/OCSlimProjectTestBundleSupportTests-Resources/SuiteTestResultFailures-NotFound.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Not Found:BobLobLaw 8 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 51 | 52 |
53 |
54 | 55 |
56 | The requested resource: BobLobLaw was not found. 57 |
58 | 59 |
60 |
61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /Example/OCSlimProjectTestBundleSupportTests-Resources/SuiteTestResultFailures.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | OCSlimProjectExampleSuite?pageHistory&resultDate=20160622112522 6 | 7 | -------------------------------------------------------------------------------- /Example/OCSlimProjectTestBundleSupportTests-Resources/SuiteTestResultSuccess-3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OCSlimProjectExampleSuite?pageHistory&resultDate=20160622121535 5 | 6 | 7 | OCSlimProjectExampleSuite?pageHistory&resultDate=20160622121535 8 | 9 | 10 | OCSlimProjectExampleSuite?pageHistory&resultDate=20160622121535 11 | 12 | -------------------------------------------------------------------------------- /Example/OCSlimProjectTestBundleSupportTests-Resources/SuiteTestResultSuccess-Empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Example/OCSlimProjectTestBundleSupportTests-Resources/SuiteTestResultSuccess.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OCSlimProjectExampleSuite?pageHistory&resultDate=20160622121535 5 | 6 | -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceTests/Empty.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceTests/FixtureExample.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | @objc(FixtureExample) 4 | 5 | class FixtureExample : NSObject, SlimDecisionTable { 6 | 7 | private var fooValue: String? 8 | private var barValue: String? 9 | 10 | //MARK: Inputs 11 | @objc 12 | var input = "" 13 | 14 | //MARK: 15 | 16 | func execute() { 17 | // 1. Prepare a System Under Test (SUT) using the given inputs. 18 | // e.g. let system = MySystemUnderTestContext(input: input) 19 | // 2. Run your SUT 20 | // 3. Take values from the SUT and return via outputs 21 | fooValue = "bar" 22 | barValue = "baz" 23 | } 24 | 25 | //MARK: Outputs 26 | @objc 27 | public var output: String? { 28 | get { 29 | switch input { 30 | case "foo": 31 | return fooValue 32 | case "bar": 33 | return barValue 34 | default: 35 | return nil 36 | } 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceTests/OCSlimProject_AcceptanceTests-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // OCSlimProject_AcceptanceTests-Bridging-Header.h 3 | // OCSlimProject 4 | // 5 | // Created by OCSlimProject on 05/09/2016. 6 | // MIT License 7 | // © 2016 Paul Stringer 8 | // 9 | 10 | 11 | 12 | #import "SlimTables.h" 13 | -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceTests/OCSlimProject_AcceptanceTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // OCSlimProject_AcceptanceTests.m 3 | // OCSlimProject 4 | // 5 | // Created by OCSlimProject on 05/09/2016. 6 | // MIT License 7 | // © 2016 Paul Stringer 8 | // 9 | 10 | 11 | #import 12 | 13 | #if __has_include() 14 | #else 15 | #pragma GCC error "Target requires pod 'OCSlimProject'. Add the entry \"pod 'OCSlimProject'\" to your Podfile configuration." 16 | #endif 17 | 18 | /* Copy and paste this entry to your projects Podfile and run 'pod install' or 'pod update' as necessary 19 | 20 | target 'OCSlimProject_AcceptanceTests' do 21 | platform :ios 22 | pod 'OCSlimProject' 23 | end 24 | 25 | 26 | https://cocoapods.org/?q=OCSlimProject 27 | 28 | */ 29 | 30 | @interface OCSlimProject_AcceptanceTests : NSObject 31 | @end 32 | @implementation OCSlimProject_AcceptanceTests 33 | @end -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceTests/SlimTables.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | // Slim Decision Table 4 | // http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.DecisionTable 5 | 6 | @protocol SlimDecisionTable 7 | 8 | @optional 9 | - (void)table:(NSArray*)table; 10 | - (void)beginTable; 11 | - (void)endTable; 12 | - (void)reset; 13 | @required 14 | - (void)execute; 15 | 16 | @end 17 | 18 | // Slim Query Table 19 | // http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.QueryTable 20 | 21 | @protocol SlimQueryTable 22 | 23 | @optional 24 | - (void)table:(NSArray*)table; 25 | @required 26 | - (NSArray*)query; 27 | 28 | @end -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceTestsMac/Empty.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceTestsMac/FixtureExample.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | @objc(FixtureExample) 4 | 5 | class FixtureExample : NSObject, SlimDecisionTable { 6 | 7 | private var fooValue: String? 8 | private var barValue: String? 9 | 10 | //MARK: Inputs 11 | @objc 12 | var input = "" 13 | 14 | //MARK: 15 | 16 | func execute() { 17 | // 1. Prepare a System Under Test (SUT) using the given inputs. 18 | // e.g. let system = MySystemUnderTestContext(input: input) 19 | // 2. Run your SUT 20 | // 3. Take values from the SUT and return via outputs 21 | fooValue = "bar" 22 | barValue = "baz" 23 | } 24 | 25 | //MARK: Outputs 26 | @objc 27 | public var output: String? { 28 | get { 29 | switch input { 30 | case "foo": 31 | return fooValue 32 | case "bar": 33 | return barValue 34 | default: 35 | return nil 36 | } 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceTestsMac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | NSMainNibFile 24 | Empty 25 | NSPrincipalClass 26 | OCSlimNSApplicationRunner 27 | 28 | 29 | -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceTestsMac/OCSlimProject_AcceptanceTestsMac-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // OCSlimProject_AcceptanceTestsMac-Bridging-Header.h 3 | // OCSlimProject 4 | // 5 | // Created by OCSlimProject on 05/09/2016. 6 | // MIT License 7 | // © 2016 Paul Stringer 8 | // 9 | 10 | 11 | 12 | #import "SlimTables.h" 13 | -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceTestsMac/OCSlimProject_AcceptanceTestsMac.m: -------------------------------------------------------------------------------- 1 | // 2 | // OCSlimProject_AcceptanceTestsMac.m 3 | // OCSlimProject 4 | // 5 | // Created by OCSlimProject on 05/09/2016. 6 | // MIT License 7 | // © 2016 Paul Stringer 8 | // 9 | 10 | 11 | #import 12 | 13 | #if __has_include() 14 | #else 15 | #pragma GCC error "Target requires pod 'OCSlimProject'. Add the entry \"pod 'OCSlimProject'\" to your Podfile configuration." 16 | #endif 17 | 18 | /* Copy and paste this entry to your projects Podfile and run 'pod install' or 'pod update' as necessary 19 | 20 | target 'OCSlimProject_AcceptanceTestsMac' do 21 | platform :osx 22 | pod 'OCSlimProject' 23 | end 24 | 25 | 26 | https://cocoapods.org/?q=OCSlimProject 27 | 28 | */ 29 | 30 | @interface OCSlimProject_AcceptanceTestsMac : NSObject 31 | @end 32 | @implementation OCSlimProject_AcceptanceTestsMac 33 | @end -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceTestsMac/SlimTables.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | // Slim Decision Table 4 | // http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.DecisionTable 5 | 6 | @protocol SlimDecisionTable 7 | 8 | @optional 9 | - (void)table:(NSArray*)table; 10 | - (void)beginTable; 11 | - (void)endTable; 12 | - (void)reset; 13 | @required 14 | - (void)execute; 15 | 16 | @end 17 | 18 | // Slim Query Table 19 | // http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.QueryTable 20 | 21 | @protocol SlimQueryTable 22 | 23 | @optional 24 | - (void)table:(NSArray*)table; 25 | @required 26 | - (NSArray*)query; 27 | 28 | @end -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceUnitTestBundle/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceUnitTestBundle/OCSlimProjectTestBundleSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // OCSlimProjectTestBundleSupport.m 3 | // OCSlimProjectTestBundleSupport 4 | // 5 | // Created by OCSlimProject on 09/08/2016. 6 | // MIT License 7 | // © 2016 Paul Stringer 8 | // 9 | // 10 | 11 | #if __has_include() 12 | #else 13 | #pragma GCC error "Target requires pod 'OCSlimProjectTestBundleSupport'. Add the entry \"pod 'OCSlimProjectTestBundleSupport'\" to your Podfile configuration." 14 | #endif 15 | 16 | /* Copy and paste this entry to your projects Podfile and run 'pod install' or 'pod update' as necessary 17 | 18 | target 'OCSlimProject_AcceptanceUnitTestBundle' do 19 | platform :ios, 9.0 20 | pod 'OCSlimProjectTestBundleSupport' 21 | end 22 | 23 | https://cocoapods.org/?q=OCSlimProjectTestBundleSupport 24 | 25 | */ -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceUnitTestBundleMac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/OCSlimProject_AcceptanceUnitTestBundleMac/OCSlimProjectTestBundleSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // OCSlimProjectTestBundleSupport.m 3 | // OCSlimProjectTestBundleSupport 4 | // 5 | // Created by OCSlimProject on 10/08/2016. 6 | // MIT License 7 | // © 2016 Paul Stringer 8 | // 9 | // 10 | 11 | #if __has_include() 12 | #else 13 | #pragma GCC error "Target requires pod 'OCSlimProjectTestBundleSupport'. Add the entry \"pod 'OCSlimProjectTestBundleSupport'\" to your Podfile configuration." 14 | #endif 15 | 16 | /* Copy and paste this entry to your projects Podfile and run 'pod install' or 'pod update' as necessary 17 | 18 | target 'OCSlimProject_AcceptanceUnitTestBundleMac' do 19 | platform :osx, 10.8 20 | pod 'OCSlimProjectTestBundleSupport' 21 | end 22 | 23 | https://cocoapods.org/?q=OCSlimProjectTestBundleSupport 24 | 25 | */ -------------------------------------------------------------------------------- /Example/OCSlimProject_ExampleMac/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // OCSlimProject_ExampleMac 4 | // 5 | // Created by Paul Stringer on 10/08/2016. 6 | // Copyright © 2016 CleanKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Example/OCSlimProject_ExampleMac/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // OCSlimProject_ExampleMac 4 | // 5 | // Created by Paul Stringer on 10/08/2016. 6 | // Copyright © 2016 CleanKit. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @property (weak) IBOutlet NSWindow *window; 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 19 | // Insert code here to initialize your application 20 | } 21 | 22 | - (void)applicationWillTerminate:(NSNotification *)aNotification { 23 | // Insert code here to tear down your application 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/OCSlimProject_ExampleMac/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /Example/OCSlimProject_ExampleMac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2016 CleanKit. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Example/OCSlimProject_ExampleMac/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // OCSlimProject_ExampleMac 4 | // 5 | // Created by Paul Stringer on 10/08/2016. 6 | // Copyright © 2016 CleanKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | -------------------------------------------------------------------------------- /Example/OCSlimProject_ExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/OCSlimProject_ExampleTests/OCSlimProject_ExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // OCSlimProject_ExampleTests.m 3 | // OCSlimProject_ExampleTests 4 | // 5 | // Created by Paul Stringer on 07/09/2016. 6 | // Copyright © 2016 CleanKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface OCSlimProject_ExampleTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation OCSlimProject_ExampleTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | 'https://github.com/CocoaPods/Specs.git' 2 | 3 | # Local development dependancies override 4 | local_podfile = "Podfile.local" 5 | eval(File.open(local_podfile).read) if File.exist? local_podfile 6 | 7 | # OCSlimProject Version 8 | version = "1.4" 9 | 10 | target 'OCSlimProject_AcceptanceTests' do 11 | platform :ios, 13.0 12 | pod "OCSlimProject", :git => "https://github.com/paulstringer/OCSlimProject.git", :tag => version.to_s 13 | end 14 | 15 | target 'OCSlimProject_AcceptanceTestsMac' do 16 | platform :osx, 10.15 17 | pod "OCSlimProject", :git => "https://github.com/paulstringer/OCSlimProject.git", :tag => version.to_s 18 | end 19 | 20 | target 'OCSlimProject_AcceptanceUnitTestBundle' do 21 | platform :ios, 13.0 22 | pod 'OCSlimProjectTestBundleSupport', :git => "https://github.com/paulstringer/OCSlimProject.git", :tag => version.to_s 23 | end 24 | 25 | target 'OCSlimProject_AcceptanceUnitTestBundleMac' do 26 | platform :osx, 10.15 27 | pod 'OCSlimProjectTestBundleSupport', :git => "https://github.com/paulstringer/OCSlimProject.git", :tag => version.to_s 28 | end 29 | -------------------------------------------------------------------------------- /Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulstringer/OCSlimProject/85b250f1b8f88ac32bb63bd89b6111d7c3a468ab/Icon.png -------------------------------------------------------------------------------- /Images/Fitnesse-App-Architecture-Diagram.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulstringer/OCSlimProject/85b250f1b8f88ac32bb63bd89b6111d7c3a468ab/Images/Fitnesse-App-Architecture-Diagram.jpeg -------------------------------------------------------------------------------- /Images/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulstringer/OCSlimProject/85b250f1b8f88ac32bb63bd89b6111d7c3a468ab/Images/Icon.png -------------------------------------------------------------------------------- /Images/iOS-Acceptance-Test-Template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulstringer/OCSlimProject/85b250f1b8f88ac32bb63bd89b6111d7c3a468ab/Images/iOS-Acceptance-Test-Template.png -------------------------------------------------------------------------------- /Images/iOS-Acceptance-Unit-Test-Template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulstringer/OCSlimProject/85b250f1b8f88ac32bb63bd89b6111d7c3a468ab/Images/iOS-Acceptance-Unit-Test-Template.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Paul Stringer 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /OCSlimProject-iOS-Diagram-Redux.msd: -------------------------------------------------------------------------------- 1 | #//# -------------------------------------------------------------------------------------- 2 | #//# Created using Sequence Diagram for Mac 3 | #//# https://www.macsequencediagram.com 4 | #//# https://itunes.apple.com/gb/app/sequence-diagram/id1195426709?mt=12 5 | #//# -------------------------------------------------------------------------------------- 6 | participant App as xcodebuild 7 | participant "Acceptance Test Target (iOS)" as atest 8 | participant "Acceptance Test Unit Tests Target" as utest 9 | participant "OCSlimProject" as ocsp 10 | participant FitNesse as Fit 11 | 12 | # Xcodebuild Test Phase 13 | *-> xcodebuild: Test 14 | xcodebuild->atest: Build 15 | atest->utest: Build / Test 16 | activate utest 17 | 18 | # OCSlimProject 19 | activate ocsp 20 | utest->ocsp: Run Script Phase 21 | 22 | # Fitnesse 23 | ocsp->Fit: Launch 24 | activate Fit 25 | Fit->Fit: Running (http://localhost:8080) 26 | ocsp->Fit: Run Test Suite 27 | Fit->ocsp: RunTestTargetWithSlimPort: 28 | loop [wait for slim server] 29 | Fit->Fit: Listen for 30 | end 31 | 32 | # iPhoneimulator 33 | ocsp->atest: Launch On Simulator args 34 | activate atest 35 | atest->atest: Start Slimserver 36 | 37 | # Cslim 38 | loop [Run Test Pages] 39 | Fit->atest: Execute Test (cslim) 40 | atest->xcodebuild: Fixture Call 41 | xcodebuild->atest: Result 42 | atest->Fit: Result (cslim) 43 | end 44 | 45 | # Report Generate 46 | Fit-> atest: Terminate 47 | deactivate atest 48 | Fit->Fit: Generate JUnit Report 49 | fit->ocsp: JUnit XML 50 | ocsp->utest: Write XML to Bundle 51 | ocsp->Fit: terminate 52 | ocsp->utest: Exit 0 53 | deactivate Fit 54 | deactivate ocsp 55 | 56 | # XCTest Junit Parsing 57 | utest->utest: Start XCTest 58 | utest->utest: Parse XML -> XCTestSuite 59 | utest->xcodebuild: XCTestCase Pass/Fail 60 | deactivate utest 61 | 62 | 63 | -------------------------------------------------------------------------------- /OCSlimProject-iOS-Diagram.msd: -------------------------------------------------------------------------------- 1 | #//# -------------------------------------------------------------------------------------- 2 | #//# Created using Sequence Diagram for Mac 3 | #//# https://www.macsequencediagram.com 4 | #//# https://itunes.apple.com/gb/app/sequence-diagram/id1195426709?mt=12 5 | #//# -------------------------------------------------------------------------------------- 6 | participant App as xcodebuild 7 | participant "Acceptance Test Target" as atest 8 | participant "unit test bundle" as utest 9 | participant "generate-fitnesse-test-report.sh" as genfit 10 | participant "LaunchFitnesse.sh" as lfit 11 | participant FitNesse as Fit 12 | participant RunTestsTargetWithSlimPort as slim 13 | participant "ios-sim" as iossim 14 | participant iphonesimulator as iPhone 15 | *-> xcodebuild: Test 16 | xcodebuild->atest: Build 17 | xcodebuild->utest: Test 18 | utest->genfit: Run Script 19 | genfit->lfit: Test 20 | activate lfit 21 | lfit->lfit: check java installed 22 | lfit->lfit: check fitnesse installed 23 | opt [ first run ] 24 | lfit->lfit: Copy FitNesseRoot 25 | end 26 | activate Fit 27 | lfit->Fit: java -jar fitnesse.jar 28 | Fit->Fit: Initialise 29 | loop [ wait ] 30 | lfit->Fit: "curl localhost:8080" 31 | end #end loop 32 | lfit->Fit: curl localhost/TestPageName?suite&format=junit 33 | activate slim 34 | fit->slim: Run 35 | slim->slim: Check Node 36 | slim->slim: Check ios-sim 37 | slim->iossim: launch 38 | loop [ wait ] 39 | note over slim 40 | """ 41 | Could hang! 💥 42 | """ 43 | end note 44 | iossim->iPhone: Acceptance Test App Install 45 | iPhone->atest: Launch 46 | atest->atest: Start Slimserver 47 | slim->slim: Wait for app launch 48 | Fit->atest: Slimserver Detected | Run Suite 49 | atest->Fit: Do Work 50 | Fit-> atest: Terminate 51 | slim->slim: Wait for app terminated 52 | 53 | end 54 | 55 | deactivate slim 56 | 57 | fit->lfit: junit xml 58 | lfit->utest: write junit xml 59 | 60 | alt [ suite test runtime error ] 61 | fit->fit: write error log file 62 | end 63 | 64 | lfit->Fit: terminate 65 | 66 | deactivate Fit 67 | 68 | deactivate lfit 69 | 70 | alt [ test report junit file exists ] 71 | 72 | utest->utest: parse junit to xctest suite 73 | utest->utest: run xctestsuite reporting pass / fails 74 | utest->xcodebuild: Pass / Fail 75 | 76 | else [test report missing or not junit xml] 77 | 78 | utest->xcodebuild: throw exception 79 | 80 | end 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /OCSlimProject.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint OCSlimProject.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | 13 | s.name = "OCSlimProject" 14 | s.version = "1.4" 15 | s.summary = "Lightweight Xcode Project wrapper of cslim to help you get setup writing fast, rock solid, non UI based BDD/Acceptance Tests using Fitnesse" 16 | s.description = <<-DESC 17 | OCSlimProject is a lightweight wrapper around a collection of scripts that automates the steps of creating 'ocslim' 18 | based Xcode Projects for testing using Fitnesse. These tools help you write rock solid, non UI based 19 | acceptance tests that integrates seamlessly with both Xcode development and CI environments. 20 | DESC 21 | 22 | s.homepage = "http://paulstringer.github.io/OCSlimProject" 23 | s.documentation_url = 'http://paulstringer.github.io/OCSlimProject' 24 | 25 | # ――― Licence ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 26 | 27 | s.license = { :type => "MIT", :file => "LICENSE" } 28 | 29 | # ――― Author ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 30 | 31 | s.author = { "Paul Stringer" => "paulstringer@mac.me" } 32 | s.social_media_url = 'https://twitter.com/paulstringer' 33 | 34 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 35 | 36 | s.source = { :git => "https://github.com/paulstringer/OCSlimProject.git", :tag => s.version.to_s } 37 | 38 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 39 | 40 | s.source_files = 'Pod/Classes/**' 41 | s.dependency 'cslim' 42 | 43 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 44 | 45 | support_file_path = 'Pod/Support' 46 | s.user_target_xcconfig = { 'OCSP_SUPPORT_FILE_DIR' => "${PODS_ROOT}/#{s.name}/#{support_file_path}/SharedSupport" } 47 | s.osx.user_target_xcconfig = { 'OCSP_BUNDLE_RESOURCES_DIR' => "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/#{s.name}-Mac.bundle/Contents/Resources" } 48 | s.ios.user_target_xcconfig = { 'OCSP_BUNDLE_RESOURCES_DIR' => "${TARGET_BUILD_DIR}/${EXECUTABLE_FOLDER_PATH}/#{s.name}.bundle" } 49 | s.preserve_paths = "#{support_file_path}/*" 50 | 51 | s.platforms = { ios: "9.0", osx: "10.8" } 52 | 53 | end -------------------------------------------------------------------------------- /OCSlimProjectTestBundleSupport.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint OCSlimProjectTestBundleSupport.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | 13 | s.name = "OCSlimProjectTestBundleSupport" 14 | s.version = "1.4" 15 | s.summary = "Integrate Fitnesse with XCTest to provide running and reporting of fast Fitnesse based BDD/Acceptance Tests right from within Xcode." 16 | s.description = <<-DESC 17 | OCSlimProjectTestBundleSupport enables OSX and iOS Unit Test targets to dynamically run test suites that run and display the results of Fitnesse based Acceptance Tests conveniently right within Xcode. 18 | Use together with 'OCSlimProject' for fast, rock-solid, non UI based acceptance testing that integrates seamlessly with both Xcode development and CI environments. 19 | DESC 20 | 21 | s.homepage = "http://paulstringer.github.io/OCSlimProject" 22 | s.documentation_url = 'http://paulstringer.github.io/OCSlimProject' 23 | # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" 24 | 25 | # ――― Licence ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 26 | 27 | s.license = { :type => "MIT", :file => "LICENSE" } 28 | 29 | # ――― Author ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 30 | 31 | s.author = { "Paul Stringer" => "paulstringer@mac.com" } 32 | s.social_media_url = "http://twitter.com/paulstringer" 33 | 34 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 35 | 36 | s.source = { :git => "https://github.com/paulstringer/OCSlimProject.git", :tag => s.version.to_s } 37 | 38 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 39 | 40 | s.source_files = "Pod/TestClasses/**/*.{h,m}" 41 | s.exclude_files = "Pod/TestClasses/*Test{s,able}.{h,m}" 42 | s.public_header_files = "Pod/TestClasses/OCSPTestSuite.h" 43 | 44 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 45 | 46 | s.resources = "Pod/Resources/*.lproj" 47 | s.framework = "XCTest" 48 | 49 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 50 | 51 | s.user_target_xcconfig = { 'OCSP_TEST_REPORT_FILE_NAME' => 'Fitnesse-Test-Report.xml', 'OCSP_SUPPORT_FILE_DIR' => "${PODS_ROOT}/OCSlimProject/Pod/Support/SharedSupport"} 52 | s.osx.user_target_xcconfig = { 'OCSP_TEST_REPORT_FILE_PATH' => "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${OCSP_TEST_REPORT_FILE_NAME}" } 53 | s.ios.user_target_xcconfig = { 'OCSP_TEST_REPORT_FILE_PATH' => "${TARGET_BUILD_DIR}/${EXECUTABLE_FOLDER_PATH}/${OCSP_TEST_REPORT_FILE_NAME}" } 54 | 55 | s.platforms = { ios: "9.0", osx: "10.8" } 56 | 57 | 58 | end 59 | -------------------------------------------------------------------------------- /Pod/Classes/OCSlimProject.h: -------------------------------------------------------------------------------- 1 | #ifndef OCSlimProject_h 2 | #define OCSlimProject_h 3 | #endif /* OCSlimProject */ 4 | -------------------------------------------------------------------------------- /Pod/Resources/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | EmptyTestSuiteErrorMessage="The specified Test Suite '%@' reported 0 tests. Either a) Begin by adding tests to the suite or b) Modify the 'Generate Fitnesse Test Bundle Resource File' 'build phase' of this target and change the 'FITNESSE_SUITE_NAME=' setting to use a Fitnesse page that contains your acceptance tests."; 2 | 3 | TestPageErrorMessage="Fitnesse test page failed with message - '%@'"; 4 | 5 | TestSuiteParsingErrorMessage="Error occured reading the Fitnesse Test Report XML file - the specified test suite likely does not exist (Check the 'Generate Fitnesse Test Bundle Resource File' 'build phase' setting 'FITNESSE_SUITE_NAME=' is set to a valid test suite name)"; 6 | 7 | TestSuiteDataNotFound="Fitnesse Test Report Data File Not Found. Check log files for possible [OCSP] warnings or errors."; 8 | 9 | TestSuiteErrorsOccurred="Fitnesse test suite failed with %@ errors. Run ./LaunchFitnesse to investigate further these errors manually."; -------------------------------------------------------------------------------- /Pod/Support/OSX/RunTestsTargetWithSlimPort: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | source $1 3 | ENVIRONMENT_SRC=$1 4 | SLIM_PORT=$2 5 | APPLICATION_PATH=${TARGET_BUILD_DIR}/${EXECUTABLE_PATH} 6 | 7 | run_test_system() { 8 | echo "Test System Executable Folder Path: $APPLICATION_PATH" 9 | $APPLICATION_PATH $SLIM_PORT 10 | return $? 11 | } 12 | 13 | main() { 14 | echo "== OCSlimProject: RunSlimTestTargetWithSlimPort~OSX:$SLIM_PORT ==" 15 | echo "Test System Executable Environment: $ENVIRONMENT_SRC" 16 | run_test_system 17 | exit $? 18 | } 19 | 20 | main -------------------------------------------------------------------------------- /Pod/Support/SharedSupport/FitNesseRoot/FrontPage/content.txt: -------------------------------------------------------------------------------- 1 | !1 Welcome to [[FitNesse][FitNesse.FitNesse]]! 2 | !3 ''The fully integrated stand-alone acceptance testing framework and wiki.'' 3 | # Here is a good place to add your first page (WikiWord). For example, MyTopLevelApplicationPage 4 | 5 | To add your first "page", click the [[Edit][.FrontPage?edit]] button and add a [[!-WikiWord-!][.FitNesse.UserGuide.FitNesseWiki.WikiWord]] to the page. 6 | 7 | |'''Hello Xcode Developer!''' | 8 | |[[OCSlimProject Example][.OCSlimProjectExamplePage]]|''Try out your OCSlimProject Acceptance Tests Target''| 9 | 10 | |'''To Learn More...''' | 11 | |[[User Guide][.FitNesse.UserGuide]] |''Answer the rest of your questions here.''| 12 | |[[A Two-Minute Example][.FitNesse.UserGuide.TwoMinuteExample]]|''A brief example. Read this one next.'' | 13 | |[[Acceptance Tests][.FitNesse.SuiteAcceptanceTests]] |''FitNesse's suite of Acceptance Tests'' | 14 | |[[Release Notes][.FitNesse.ReleaseNotes]] |''Find out about FitNesse's new features'' | 15 | 16 | !note Release ${FITNESSE_VERSION} 17 | -------------------------------------------------------------------------------- /Pod/Support/SharedSupport/FitNesseRoot/FrontPage/properties.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Pod/Support/SharedSupport/FitNesseRoot/OCSlimProjectExamplePage/TestPage/content.txt: -------------------------------------------------------------------------------- 1 | !1 OCSlimProject Example Test Page 2 | 3 | Below is a simple Decision Table based Acceptance Test. It sends input to an instance of a Fixture which is implemented in your Xcode project. This is done by adding a class of the same name e.g. 'FixtureExample.swift' to your Acceptance Test target. 4 | 5 | The first column 'input' will set a property of the same name. The expected 'output?' columns are suffixed with '?' and returned by the Fixture and verified against the expected value in that column. 6 | 7 | For this to work you must mark methods with the @objc attribute to make it visible to Objective-C. 8 | 9 | Click 'Test' to run this page and see this in action. After that check out ''!-FixtureExample.swift-!'' in your Xcode project to see the 'FixtureExample.swift' implementation. 10 | 11 | |Fixture Example| 12 | |input |output? | 13 | |foo |bar | 14 | |bar |baz | 15 | 16 | -------------------------------------------------------------------------------- /Pod/Support/SharedSupport/FitNesseRoot/OCSlimProjectExamplePage/TestPage/properties.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | true 5 | true 6 | true 7 | true 8 | true 9 | true 10 | true 11 | true 12 | 13 | -------------------------------------------------------------------------------- /Pod/Support/SharedSupport/FitNesseRoot/OCSlimProjectExamplePage/content.txt: -------------------------------------------------------------------------------- 1 | !1 OCSlimProject Example Test Suite 2 | 3 | This Page is a Test Suite page. Click on the Test Page below to see a basic example of a Decision Table based Acceptance Test. 4 | 5 | !contents -R2 -g -p -f -h 6 | 7 | -------------------------------------------------------------------------------- /Pod/Support/SharedSupport/FitNesseRoot/OCSlimProjectExamplePage/properties.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Pod/Support/SharedSupport/FitNesseRoot/content.txt: -------------------------------------------------------------------------------- 1 | ''Auto Generated By !-OCSlimProject-! Do Not Modify This Page'' 2 | !define TEST_SYSTEM {slim} 3 | !define TEST_RUNNER {!-./OCSlimProjectTestRunner.sh-!} 4 | !define SLIM_VERSION {0.0} 5 | !define COMMAND_PATTERN {%m} 6 | 7 | -------------------------------------------------------------------------------- /Pod/Support/SharedSupport/LICENCE.txt: -------------------------------------------------------------------------------- 1 | Common Public License Version 1.0 2 | 3 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC 4 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM 5 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 6 | 7 | 1. DEFINITIONS 8 | 9 | "Contribution" means: 10 | 11 | a) in the case of the initial Contributor, the initial code and 12 | documentation distributed under this Agreement, and 13 | 14 | b) in the case of each subsequent Contributor: 15 | 16 | i) changes to the Program, and 17 | 18 | ii) additions to the Program; 19 | 20 | where such changes and/or additions to the Program originate from and are 21 | distributed by that particular Contributor. A Contribution 'originates' from a 22 | Contributor if it was added to the Program by such Contributor itself or anyone 23 | acting on such Contributor's behalf. Contributions do not include additions to 24 | the Program which: (i) are separate modules of software distributed in 25 | conjunction with the Program under their own license agreement, and (ii) are not 26 | derivative works of the Program. 27 | 28 | "Contributor" means any person or entity that distributes the Program. 29 | 30 | "Licensed Patents " mean patent claims licensable by a Contributor which are 31 | necessarily infringed by the use or sale of its Contribution alone or when 32 | combined with the Program. 33 | 34 | "Program" means the Contributions distributed in accordance with this Agreement. 35 | 36 | "Recipient" means anyone who receives the Program under this Agreement, 37 | including all Contributors. 38 | 39 | 2. GRANT OF RIGHTS 40 | 41 | a) Subject to the terms of this Agreement, each Contributor hereby grants 42 | Recipient a non-exclusive, worldwide, royalty-free copyright license to 43 | reproduce, prepare derivative works of, publicly display, publicly perform, 44 | distribute and sublicense the Contribution of such Contributor, if any, and such 45 | derivative works, in source code and object code form. 46 | 47 | b) Subject to the terms of this Agreement, each Contributor hereby grants 48 | Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed 49 | Patents to make, use, sell, offer to sell, import and otherwise transfer the 50 | Contribution of such Contributor, if any, in source code and object code form. 51 | This patent license shall apply to the combination of the Contribution and the 52 | Program if, at the time the Contribution is added by the Contributor, such 53 | addition of the Contribution causes such combination to be covered by the 54 | Licensed Patents. The patent license shall not apply to any other combinations 55 | which include the Contribution. No hardware per se is licensed hereunder. 56 | 57 | c) Recipient understands that although each Contributor grants the licenses 58 | to its Contributions set forth herein, no assurances are provided by any 59 | Contributor that the Program does not infringe the patent or other intellectual 60 | property rights of any other entity. Each Contributor disclaims any liability to 61 | Recipient for claims brought by any other entity based on infringement of 62 | intellectual property rights or otherwise. As a condition to exercising the 63 | rights and licenses granted hereunder, each Recipient hereby assumes sole 64 | responsibility to secure any other intellectual property rights needed, if any. 65 | For example, if a third party patent license is required to allow Recipient to 66 | distribute the Program, it is Recipient's responsibility to acquire that license 67 | before distributing the Program. 68 | 69 | d) Each Contributor represents that to its knowledge it has sufficient 70 | copyright rights in its Contribution, if any, to grant the copyright license set 71 | forth in this Agreement. 72 | 73 | 3. REQUIREMENTS 74 | 75 | A Contributor may choose to distribute the Program in object code form under its 76 | own license agreement, provided that: 77 | 78 | a) it complies with the terms and conditions of this Agreement; and 79 | 80 | b) its license agreement: 81 | 82 | i) effectively disclaims on behalf of all Contributors all warranties and 83 | conditions, express and implied, including warranties or conditions of title and 84 | non-infringement, and implied warranties or conditions of merchantability and 85 | fitness for a particular purpose; 86 | 87 | ii) effectively excludes on behalf of all Contributors all liability for 88 | damages, including direct, indirect, special, incidental and consequential 89 | damages, such as lost profits; 90 | 91 | iii) states that any provisions which differ from this Agreement are offered 92 | by that Contributor alone and not by any other party; and 93 | 94 | iv) states that source code for the Program is available from such 95 | Contributor, and informs licensees how to obtain it in a reasonable manner on or 96 | through a medium customarily used for software exchange. 97 | 98 | When the Program is made available in source code form: 99 | 100 | a) it must be made available under this Agreement; and 101 | 102 | b) a copy of this Agreement must be included with each copy of the Program. 103 | 104 | Contributors may not remove or alter any copyright notices contained within the 105 | Program. 106 | 107 | Each Contributor must identify itself as the originator of its Contribution, if 108 | any, in a manner that reasonably allows subsequent Recipients to identify the 109 | originator of the Contribution. 110 | 111 | 4. COMMERCIAL DISTRIBUTION 112 | 113 | Commercial distributors of software may accept certain responsibilities with 114 | respect to end users, business partners and the like. While this license is 115 | intended to facilitate the commercial use of the Program, the Contributor who 116 | includes the Program in a commercial product offering should do so in a manner 117 | which does not create potential liability for other Contributors. Therefore, if 118 | a Contributor includes the Program in a commercial product offering, such 119 | Contributor ("Commercial Contributor") hereby agrees to defend and indemnify 120 | every other Contributor ("Indemnified Contributor") against any losses, damages 121 | and costs (collectively "Losses") arising from claims, lawsuits and other legal 122 | actions brought by a third party against the Indemnified Contributor to the 123 | extent caused by the acts or omissions of such Commercial Contributor in 124 | connection with its distribution of the Program in a commercial product 125 | offering. The obligations in this section do not apply to any claims or Losses 126 | relating to any actual or alleged intellectual property infringement. In order 127 | to qualify, an Indemnified Contributor must: a) promptly notify the Commercial 128 | Contributor in writing of such claim, and b) allow the Commercial Contributor to 129 | control, and cooperate with the Commercial Contributor in, the defense and any 130 | related settlement negotiations. The Indemnified Contributor may participate in 131 | any such claim at its own expense. 132 | 133 | For example, a Contributor might include the Program in a commercial product 134 | offering, Product X. That Contributor is then a Commercial Contributor. If that 135 | Commercial Contributor then makes performance claims, or offers warranties 136 | related to Product X, those performance claims and warranties are such 137 | Commercial Contributor's responsibility alone. Under this section, the 138 | Commercial Contributor would have to defend claims against the other 139 | Contributors related to those performance claims and warranties, and if a court 140 | requires any other Contributor to pay any damages as a result, the Commercial 141 | Contributor must pay those damages. 142 | 143 | 5. NO WARRANTY 144 | 145 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN 146 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR 147 | IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, 148 | NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each 149 | Recipient is solely responsible for determining the appropriateness of using and 150 | distributing the Program and assumes all risks associated with its exercise of 151 | rights under this Agreement, including but not limited to the risks and costs of 152 | program errors, compliance with applicable laws, damage to or loss of data, 153 | programs or equipment, and unavailability or interruption of operations. 154 | 155 | 6. DISCLAIMER OF LIABILITY 156 | 157 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY 158 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, 159 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST 160 | PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 161 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 162 | OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS 163 | GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 164 | 165 | 7. GENERAL 166 | 167 | If any provision of this Agreement is invalid or unenforceable under applicable 168 | law, it shall not affect the validity or enforceability of the remainder of the 169 | terms of this Agreement, and without further action by the parties hereto, such 170 | provision shall be reformed to the minimum extent necessary to make such 171 | provision valid and enforceable. 172 | 173 | If Recipient institutes patent litigation against a Contributor with respect to 174 | a patent applicable to software (including a cross-claim or counterclaim in a 175 | lawsuit), then any patent licenses granted by that Contributor to such Recipient 176 | under this Agreement shall terminate as of the date such litigation is filed. In 177 | addition, if Recipient institutes patent litigation against any entity 178 | (including a cross-claim or counterclaim in a lawsuit) alleging that the Program 179 | itself (excluding combinations of the Program with other software or hardware) 180 | infringes such Recipient's patent(s), then such Recipient's rights granted under 181 | Section 2(b) shall terminate as of the date such litigation is filed. 182 | 183 | All Recipient's rights under this Agreement shall terminate if it fails to 184 | comply with any of the material terms or conditions of this Agreement and does 185 | not cure such failure in a reasonable period of time after becoming aware of 186 | such noncompliance. If all Recipient's rights under this Agreement terminate, 187 | Recipient agrees to cease use and distribution of the Program as soon as 188 | reasonably practicable. However, Recipient's obligations under this Agreement 189 | and any licenses granted by Recipient relating to the Program shall continue and 190 | survive. 191 | 192 | Everyone is permitted to copy and distribute copies of this Agreement, but in 193 | order to avoid inconsistency the Agreement is copyrighted and may only be 194 | modified in the following manner. The Agreement Steward reserves the right to 195 | publish new versions (including revisions) of this Agreement from time to time. 196 | No one other than the Agreement Steward has the right to modify this Agreement. 197 | IBM is the initial Agreement Steward. IBM may assign the responsibility to serve 198 | as the Agreement Steward to a suitable separate entity. Each new version of the 199 | Agreement will be given a distinguishing version number. The Program (including 200 | Contributions) may always be distributed subject to the version of the Agreement 201 | under which it was received. In addition, after a new version of the Agreement 202 | is published, Contributor may elect to distribute the Program (including its 203 | Contributions) under the new version. Except as expressly stated in Sections 204 | 2(a) and 2(b) above, Recipient receives no rights or licenses to the 205 | intellectual property of any Contributor under this Agreement, whether 206 | expressly, by implication, estoppel or otherwise. All rights in the Program not 207 | expressly granted under this Agreement are reserved. 208 | 209 | This Agreement is governed by the laws of the State of New York and the 210 | intellectual property laws of the United States of America. No party to this 211 | Agreement will bring a legal action under this Agreement more than one year 212 | after the cause of action arose. Each party waives its rights to a jury trial in 213 | any resulting litigation. 214 | 215 | -------------------------------------------------------------------------------- /Pod/Support/SharedSupport/LaunchFitnesse: -------------------------------------------------------------------------------- 1 | ############## 2 | # PROPERTIES # 3 | ############## 4 | 5 | MY_PATH=$(dirname $0) 6 | BUNDLE_DIR=$(dirname "$(readlink "${BASH_SOURCE[0]}")") 7 | ACTION=LAUNCH 8 | CURL_CONNECTION_REFUSED_CODE=7 9 | 10 | ################# 11 | # CONFIGURATION # 12 | ################# 13 | 14 | FITNESSE_PORT=8080 15 | FITNESSE_EXECUTABLE_PATH=${BUNDLE_DIR}/fitnesse-standalone.jar 16 | FITNESSE_ROOT_DIR=FitNesseRoot 17 | FITNESSE_URL=http:"//localhost:${FITNESSE_PORT}/" 18 | FITNESSE_TEST_OUTPUT=/tmp/Fitnesse-Test-Report.xml 19 | FITNESSE_TIMEOUT_SECONDS=300 20 | FITNESSE_ROOT=. 21 | FITNESSE_TEST_SUITE= 22 | VERBOSE=0 23 | 24 | #################################### 25 | # Command Line Argument Processing # 26 | #################################### 27 | 28 | while [ "$1" != "" ]; do 29 | 30 | case $1 in 31 | 32 | -p | --port ) shift 33 | FITNESSE_PORT=$1 34 | ;; 35 | 36 | -d | --RootPath ) shift 37 | FITNESSE_ROOT=$1 38 | ;; 39 | 40 | -x | --shutdown) ACTION=SHUTDOWN 41 | ;; 42 | 43 | -b | --output) shift 44 | FITNESSE_TEST_OUTPUT=$1 45 | ;; 46 | 47 | -t | --test ) shift 48 | FITNESSE_TEST_SUITE=$1 49 | ACTION=TEST 50 | ;; 51 | 52 | -o | --open ) ACTION=OPEN 53 | ;; 54 | 55 | -v | --verbose ) VERBOSE=1 56 | ;; 57 | 58 | 59 | esac 60 | shift 61 | done 62 | 63 | ############### 64 | # Subroutines # 65 | ############### 66 | 67 | function java_check { 68 | 69 | java -version 70 | 71 | if [ $? -eq 1 ]; then 72 | exit 1 73 | fi 74 | 75 | } 76 | 77 | function fitnesse_process_id { 78 | 79 | echo $(lsof -n -i4TCP:$FITNESSE_PORT | awk ' { print $2 }' | sed -n 2p) 80 | 81 | } 82 | 83 | function fitnesse_running { 84 | 85 | local FITNESSE_PID=$(fitnesse_process_id) 86 | 87 | if [ -n "$FITNESSE_PID" ]; then 88 | return 0 89 | else 90 | return 1 91 | fi 92 | 93 | } 94 | 95 | function fitnesse_shutdown { 96 | 97 | if fitnesse_running; then 98 | echo "[OSCP_CTL] FITNESSE: $FITNESSE_URL?shutdown (Process=$(fitnesse_process_id))" 99 | curl --silent "$FITNESSE_URL?shutdown" >/dev/null 100 | if [ -z "$(fitnesse_process_id)" ]; then 101 | echo "[OCSP_CTL] Shutdown (Port:$FITNESSE_PORT) Succeeded" 102 | fi 103 | else 104 | echo "[OSCP_CTL] No Instance of Fitnesse Found Running on Port $FITNESSE_PORT." 105 | fi 106 | 107 | } 108 | 109 | function fitnesse_kill { 110 | 111 | $(fitnesse_process_id) | xargs kill -9 112 | 113 | } 114 | 115 | function fitnesse_check { 116 | 117 | if [ ! -f "${FITNESSE_EXECUTABLE_PATH}" ]; then 118 | echo "Fitnesse-Standalone.jar missing!" 119 | echo "Download the latest fitnesse-standlalone.jar to the current directory from Fitnesse.org" 120 | select yn in "Goto http://fitnesse.org" "Not Now"; do 121 | case $yn in 122 | "Goto http://fitnesse.org" ) open "http://fitnesse.org"; break;; 123 | "Not Now" ) break;; 124 | esac 125 | done 126 | popd 2>&1 > /dev/null 127 | exit 0 128 | fi 129 | 130 | } 131 | 132 | function fitnesse_start { 133 | echo "[OCSP_CTL] action=${ACTION}" 134 | echo "[OCSP_CTL] Jar=${FITNESSE_EXECUTABLE_PATH}" 135 | echo "[OCSP_CTL] Port=${FITNESSE_PORT}" 136 | echo "[OCSP_CTL] Timeout=${FITNESSE_TIMEOUT_SECONDS}" 137 | echo "[OCSP_CTL] RootPath=${FITNESSE_ROOT}" 138 | echo "[OCSP_CTL] FITNESSE: Launch" 139 | java -jar -Dslim.timeout=${FITNESSE_TIMEOUT_SECONDS} ${FITNESSE_EXECUTABLE_PATH} -e 0 -p ${FITNESSE_PORT} -d ${FITNESSE_ROOT} 2>/dev/null & 140 | } 141 | 142 | function fitnesse_wait { 143 | echo "[OCSP_CTL] FITNESSE: Waiting for Fitnesse..." 144 | local RESULT=$CURL_CONNECTION_REFUSED_CODE 145 | while [ $RESULT -eq $CURL_CONNECTION_REFUSED_CODE ] 146 | do 147 | sleep 0.5 148 | curl -s "http://localhost:${FITNESSE_PORT}" > /dev/null 2>&1 149 | RESULT=$? 150 | done 151 | echo "[OCSP_CTL] Fitnesse: Ready (curl exit code=$RESULT)" 152 | } 153 | 154 | 155 | function install_fitnesse_root_dir { 156 | local fitnesse_root_dir_project_path="$FITNESSE_ROOT/$FITNESSE_ROOT_DIR" 157 | if [ ! -d "$fitnesse_root_dir_project_path" ]; then 158 | echo "[OCSP_CTL] Preparing FitNesseRoot Folder" 159 | cp -r "$BUNDLE_DIR"/$FITNESSE_ROOT_DIR $FITNESSE_ROOT 160 | fi 161 | } 162 | 163 | function fitnesse_setup { 164 | install_fitnesse_root_dir 165 | } 166 | 167 | function fitnesse_main { 168 | 169 | pushd $MY_PATH 2>&1 > /dev/null 170 | 171 | # Check Java Exists 172 | java_check 173 | 174 | # Check Fitnesse Exists 175 | fitnesse_check 176 | 177 | # Enable Job Control 178 | set -o monitor 179 | 180 | # LAUNCH Fitnesse in the background, wait for it to begin responsding 181 | fitnesse_run 182 | 183 | local RETURN_RESULT=$? 184 | 185 | popd 2>&1 > /dev/null 186 | 187 | return $RETURN_RESULT 188 | 189 | } 190 | 191 | FITNESSE_MAIN_EXECUTED=0 192 | FITNESSE_MAIN_ALREADY_RUNNING=1 193 | 194 | function fitnesse_run { 195 | 196 | local MAIN_RESULT=-1 197 | 198 | if ! fitnesse_running; then 199 | fitnesse_setup 200 | fitnesse_start 201 | fitnesse_wait 202 | MAIN_RESULT=0 203 | else 204 | MAIN_RESULT=1 205 | echo "[OCSP_CTL] Fitnesse Running - $FITNESSE_URL" 206 | fi 207 | 208 | return $MAIN_RESULT 209 | } 210 | 211 | function fitnesse_open { 212 | 213 | fitnesse_running 214 | 215 | if [ 0 -eq $? ]; then 216 | echo "[OCSP_CTL] Open Fitnesse at $FITNESSE_URL" 217 | open $FITNESSE_URL 218 | else 219 | echo "[OCSP_CTL] Fitnesse is not Running. Aborted." 220 | echo "[OCSP_CTL] Usage: ./LaunchFitnesse [--port PORT]" 221 | fi 222 | 223 | 224 | } 225 | 226 | function fitnesse_launch_in_browser { 227 | fitnesse_main 228 | fitnesse_open 229 | } 230 | 231 | function fitnesse_generate_test_suite_report { 232 | 233 | fitnesse_main 234 | 235 | local MAIN_RESULT_CODE=$? 236 | 237 | fitnesse_write_suite_results 238 | 239 | if [ $MAIN_RESULT_CODE -eq $FITNESSE_MAIN_EXECUTED ]; then 240 | fitnesse_shutdown 241 | fi 242 | } 243 | 244 | function fitnesse_write_suite_results { 245 | 246 | mkdir -p $(dirname "$FITNESSE_TEST_OUTPUT") 247 | REPORT_URL=$FITNESSE_URL$FITNESSE_TEST_SUITE\?suite\&format\=junit 248 | 249 | echo "[OCSP_CTL] Run Test Suite: $FITNESSE_TEST_SUITE" 250 | echo "[OCSP_CTL] $REPORT_URL (Timeout=$(expr ${FITNESSE_TIMEOUT_SECONDS} / 60)m, Timestamp=$(date +%H:%M:%S))" 251 | 252 | curl -s -S -o "$FITNESSE_TEST_OUTPUT" "$REPORT_URL" 253 | DOWNLOAD_RESULT=$? 254 | echo "[OCSP_CTL] Test Output: " $(stat "$FITNESSE_TEST_OUTPUT" 2>&1 ) 255 | 256 | if [ $DOWNLOAD_RESULT -eq 0 ]; then 257 | echo "[OCSP_CTL] Test Report Generated (curl exit code=$DOWNLOAD_RESULT)" 258 | else 259 | echo "[OCSP_CTL] ERROR: Download Test Report Failed (error=$DOWNLOAD_RESULT)" 260 | fi 261 | 262 | if [ $VERBOSE -eq 1 ]; then 263 | echo $(cat "$FITNESSE_TEST_OUTPUT") 264 | fi 265 | 266 | } 267 | 268 | ######## 269 | # Main # 270 | ######## 271 | 272 | function main { 273 | 274 | case "$ACTION" in 275 | 276 | LAUNCH) 277 | fitnesse_launch_in_browser 278 | echo "[OCSP_CTL] Use --shutdown to stop Fitnesse" 279 | ;; 280 | 281 | SHUTDOWN) 282 | fitnesse_shutdown 283 | ;; 284 | 285 | TEST) 286 | fitnesse_generate_test_suite_report 287 | ;; 288 | 289 | OPEN) 290 | fitnesse_open 291 | ;; 292 | 293 | esac 294 | 295 | } 296 | 297 | main 298 | exit 0 299 | 300 | -------------------------------------------------------------------------------- /Pod/Support/SharedSupport/fitnesse-standalone.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulstringer/OCSlimProject/85b250f1b8f88ac32bb63bd89b6111d7c3a468ab/Pod/Support/SharedSupport/fitnesse-standalone.jar -------------------------------------------------------------------------------- /Pod/Support/SharedSupport/ocsp-generate-fitnesse-test-report.sh: -------------------------------------------------------------------------------- 1 | FITNESSE_SUITE_NAME=$1 2 | TEST_REPORT_FILE_PATH=$2 3 | TEST_RUNNER_ERROR_LOGFILE=${PROJECT_DIR}/OCSlimProjectTestRunner-Error.log 4 | RETURN_CODE=0 5 | 6 | function main { 7 | echo "[OCSP_TEST] Fitnesse Test Suite=$FITNESSE_SUITE_NAME" 8 | echo "[OCSP_TEST] Destination Report File Path=$TEST_REPORT_FILE_PATH" 9 | ${PROJECT_DIR}/LaunchFitnesse --shutdown 2>&1 >/dev/null 10 | ${PROJECT_DIR}/LaunchFitnesse -d "${PROJECT_DIR}" -b "$TEST_REPORT_FILE_PATH" --test "$FITNESSE_SUITE_NAME" --verbose >&1 11 | } 12 | 13 | function report_errors { 14 | 15 | if [ -f "$TEST_RUNNER_ERROR_LOGFILE" ]; then 16 | echo "[OCSP_TEST] ERROR: Slim Test System Generated Errors During Test" >&2 17 | echo "[OCSP_TEST] ==== Begin Log $TEST_RUNNER_ERROR_LOGFILE) =====" >&2 18 | echo "$(<$TEST_RUNNER_ERROR_LOGFILE)" >&2 19 | echo "[OCSP_TEST] ==== End Log ===== " >&2 20 | echo "[OCSP_TEST] FATAL: Build Has Failed. Abort..." >&2 21 | echo "[OCSP_TEST] Bye" 22 | RETURN_CODE=1 23 | fi 24 | } 25 | 26 | main 27 | report_errors 28 | exit $RETURN_CODE -------------------------------------------------------------------------------- /Pod/Support/SharedSupport/ocsp-generate-fitnesse-test-system-scripts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | TEST_SYSTEM_DIR="$1" 3 | SHARED_SUPPORT_FILE_PATH=$(dirname "$0") 4 | SUPPORT_FILE_PLATFORM_PATH=$SHARED_SUPPORT_FILE_PATH/.. 5 | 6 | # Validate Project Build Settings 7 | 8 | function validateEnvironment { 9 | if [ -z "${TEST_SYSTEM_DIR}" ]; then 10 | mkdir -p "${TEST_SYSTEM_DIR}" 11 | fi 12 | } 13 | 14 | # Export Build Environment to Bundles own Location 15 | 16 | function exportTestSystemBuildSettings { 17 | ENV_TARGET=${TEST_SYSTEM_DIR}/env.sh 18 | echo "[OCSP] Exporting Test System Executable Environment -> $ENV_TARGET" 19 | mkdir -p "$(dirname "$ENV_TARGET")" && touch "$ENV_TARGET" 20 | export | egrep '(INSTALL_DIR)|(PRODUCT_NAME)|(TARGET_BUILD_DIR)|(EXECUTABLE_FOLDER_PATH)|(DEPLOYMENT_TARGET_SUGGESTED_VALUES)|(EXECUTABLE_PATH)' > $ENV_TARGET 21 | } 22 | 23 | # Write Test System Script To The Project's Root Directory 24 | 25 | function writeTestSystemRunScript { 26 | 27 | local OCSP_PLATFORM="${PLATFORM_NAME}" 28 | 29 | if [ "${PLATFORM_NAME}" == "macosx" ]; then 30 | OCSP_PLATFORM="OSX" 31 | elif [[ "${PLATFORM_NAME}" =~ .*iphone* ]]; then 32 | OCSP_PLATFORM="iOS" 33 | fi 34 | 35 | TESTRUNNER_SCRIPT_NAME=OCSlimProjectTestRunner 36 | TESTRUNNER_SOURCE=$SUPPORT_FILE_PLATFORM_PATH/${OCSP_PLATFORM}/RunTestsTargetWithSlimPort 37 | TESTRUNNER_TARGET=${PROJECT_DIR}/$TESTRUNNER_SCRIPT_NAME.sh 38 | TESTRUNNER_ERRORLOG=$TESTRUNNER_SCRIPT_NAME-Error.log 39 | echo "[OCSP] Selected Test System Platform -> $OCSP_PLATFORM" 40 | echo "[OCSP] Selected Test System Run Script -> $TESTRUNNER_SOURCE" 41 | echo "[OCSP] Writing Test System Script -> $TESTRUNNER_TARGET (This must match the defined TEST_RUNNER value set in 'FitnesseRoot/content.txt')" 42 | 43 | if [ -f "$TESTRUNNER_TARGET" ]; then 44 | rm "$TESTRUNNER_TARGET" 45 | fi 46 | 47 | SCRIPT_SRC=$(cat "$SHARED_SUPPORT_FILE_PATH/ocsp-generate-fitnesse-test-system-template.sh") 48 | printf "$SCRIPT_SRC" "$TESTRUNNER_SOURCE" "$ENV_TARGET" "$TESTRUNNER_ERRORLOG" > $TESTRUNNER_TARGET 49 | chmod +x "$TESTRUNNER_TARGET" 50 | 51 | } 52 | 53 | # Symbolic Link Control Script for Launching Fitnesse convieniently to Project Root 54 | 55 | function linkCtlScriptToProjectRoot { 56 | 57 | local CTL_SCRIPTNAME="LaunchFitnesse" 58 | local CTL_SOURCE=$SHARED_SUPPORT_FILE_PATH/$CTL_SCRIPTNAME 59 | local CTL_TARGET=${PROJECT_DIR}/$CTL_SCRIPTNAME 60 | local CTL_TARGET_DIR=$(dirname "$CTL_TARGET") 61 | 62 | echo "[OCSP] Control Script Resource Path -> $CTL_SOURCE" 63 | echo "[OCSP] Linking Control Script $ ./$CTL_SCRIPTNAME -> $CTL_TARGET_DIR" 64 | 65 | # Unlink previous if existing 66 | if [ -L "$CTL_TARGET" ]; then 67 | unlink "$CTL_TARGET" 68 | fi 69 | 70 | # Create symbolic link 71 | ln -s "$CTL_SOURCE" "$CTL_TARGET_DIR" 72 | } 73 | 74 | function main { 75 | validateEnvironment 76 | exportTestSystemBuildSettings 77 | writeTestSystemRunScript 78 | linkCtlScriptToProjectRoot 79 | } 80 | 81 | main 82 | -------------------------------------------------------------------------------- /Pod/Support/SharedSupport/ocsp-generate-fitnesse-test-system-template.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | SLIM_PORT=$1 3 | TEST_RUNNER_SCRIPT='%s' 4 | ENV_FILE_PATH=%s 5 | ERROR_LOG_FILE=%s 6 | 7 | "$TEST_RUNNER_SCRIPT" $ENV_FILE_PATH $SLIM_PORT 2> >(tee $ERROR_LOG_FILE >&2) 8 | 9 | ERROR_LOG_NO_WHITESPACE=$(more "$ERROR_LOG_FILE" | sed 's/ *$//') 10 | 11 | if [ -z "$ERROR_LOG_NO_WHITESPACE" ]; then 12 | rm $ERROR_LOG_FILE 13 | echo "[OCSP_RUN] Slim Test System Exited Normally" 14 | else 15 | echo "[OCSP_RUN] Slim Test System Exited Abnormally With Reported Errors" 16 | fi 17 | -------------------------------------------------------------------------------- /Pod/Support/iOS/RunTestsTargetWithSlimPort: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | MYPATH=$(dirname "$0") 3 | source $1 4 | SLIM_PORT=$2 5 | APPLICATION_PATH=${TARGET_BUILD_DIR}/${EXECUTABLE_FOLDER_PATH} 6 | DEPLOYMENT_TARGET_VALUE=$( echo "$DEPLOYMENT_TARGET_SUGGESTED_VALUES" | rev | cut -d " " -f1 | rev ) 7 | 8 | get_app_devicetypeid() { 9 | 10 | local DEVICETYPE_ID= 11 | local BOOTED_DEVICE_NAME=$(xcrun simctl list devices | grep "Booted" | cut -d "(" -f1 | awk '{gsub(/^ +| +$/,"")} {print $0}') 12 | 13 | if [ ! -z "$BOOTED_DEVICE_NAME" ]; then 14 | DEVICETYPE_ID=$(xcrun simctl list devicetypes | grep "^$BOOTED_DEVICE_NAME (com.apple" | cut -d "(" -f2 | cut -d ")" -f1) 15 | else 16 | DEVICETYPE_ID=$(xcrun simctl list devicetypes | grep "$DEVICE_TYPE" | tail -n1 | cut -d "(" -f2 | cut -d ")" -f1) 17 | fi 18 | 19 | if [ -z "$DEVICETYPE_ID" ]; then 20 | log "Device Type Identifier For $DEVICE_TYPE Missing" 21 | exit 1 22 | fi 23 | 24 | echo "$DEVICETYPE_ID, $DEPLOYMENT_TARGET_VALUE" 25 | } 26 | 27 | slim_system_wait() { 28 | 29 | local EXECUTABLE_PID=$(<.simctl.pid) 30 | 31 | log "Waiting for Slim System... ($EXECUTABLE_PID) $(date)" 32 | 33 | while ps -p $EXECUTABLE_PID 34 | do 35 | sleep 1 36 | done 37 | 38 | log "Slim System Exited $(date)" 39 | } 40 | 41 | run_test_system() { 42 | log "Start Slim Test Sytem" 43 | "$MYPATH/simctl" $APPLICATION_PATH $SLIM_PORT 44 | if [ $? == 0 ]; then 45 | slim_system_wait; 46 | else 47 | log "**ABORTING** For details click the red/green 'Execution Log' button in Fitnesse to view stdout and stderr logs" 48 | error "**ABORTING** Exit Code error detected when executing Slim Test Sytem with ($MYPATH/simctl)" 49 | fi 50 | } 51 | 52 | main() { 53 | log "== RunSlimTestTargetWithSlimPort~iOS:$SLIM_PORT $(date)==" 54 | log "Info: Test System Suggested SDK: $DEPLOYMENT_TARGET_VALUE" 55 | log "Info: Test System Path: $APPLICATION_PATH" 56 | run_test_system 57 | exit $? 58 | } 59 | 60 | log() { 61 | echo "[OCSP_RUN] $1" 62 | } 63 | 64 | error() { 65 | >&2 echo "[OCSP_RUN] $1" 66 | exit 1 67 | } 68 | 69 | main 70 | -------------------------------------------------------------------------------- /Pod/Support/iOS/simctl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | APPLICATION_PATH=$1 4 | SLIMSERVER_PORT=$2 5 | 6 | ## HELP ROUTINE 7 | 8 | while [ "$1" != "" ]; do 9 | 10 | case $1 in 11 | 12 | -h | --help ) echo "Utility to 'xcrun simctl' for installing and launching iOS based acceptance test apps\n\nUsage: simctl " 13 | exit 0 14 | ;; 15 | esac 16 | shift 17 | done 18 | 19 | 20 | ## MAIN ROUTINE 21 | APP_IDENTIFIER=$(defaults read $APPLICATION_PATH/Info CFBundleIdentifier) 22 | 23 | check_device_booted() { 24 | xcrun simctl list devices | grep -i booted 25 | } 26 | 27 | boot_device() { 28 | DEVICE_ID=$(get_device_id) 29 | log "Found Device $(xcrun simctl list devices | grep $DEVICE_ID)" 30 | log "Booting $DEVICE_ID" 31 | xcrun simctl boot $DEVICE_ID 32 | } 33 | 34 | get_device_id() { 35 | xcrun simctl list devices | grep -i iphone | grep -i -v unavailable | tail -n1 | cut -d "(" -f2 | cut -d ")" -f1 36 | } 37 | 38 | log() { 39 | echo "[OCSP_SIMCTL] $1" 40 | } 41 | 42 | error() { 43 | >&2 echo "[OCSP_SIMCTL] $1" 44 | } 45 | 46 | preflight() { 47 | if ! check_device_booted; then 48 | log "No Device Booted" 49 | boot_device 50 | fi 51 | } 52 | 53 | install() { 54 | log "Installing App Identifier:$APP_IDENTIFIER" 55 | xcrun simctl install booted $APPLICATION_PATH 56 | } 57 | 58 | launch() { 59 | log "Launching... (App Identifer:$APP_IDENTIFIER, Slim Port: $SLIMSERVER_PORT)" 60 | local PID_FILE=.simctl.pid 61 | rm $PID_FILE 2> /dev/null 62 | echo $(xcrun simctl launch booted $APP_IDENTIFIER $SLIMSERVER_PORT) | cut -d " " -f2 > $PID_FILE 63 | } 64 | 65 | main() { 66 | log "== Launching Slim Host App $(xcrun simctl --version) ==" 67 | preflight 68 | if install; then 69 | launch 70 | else 71 | error "** ABORTING ** Error encountered launching app. (Check usage with --help)" 72 | fi 73 | exit $? 74 | } 75 | 76 | main 77 | 78 | 79 | 80 | # Command line utility to control the Simulator 81 | 82 | # For subcommands that require a argument, you may specify a device UDID 83 | # or the special "booted" string which will cause simctl to pick a booted device. 84 | # If multiple devices are booted when the "booted" device is selected, simctl 85 | # will choose one of them. 86 | 87 | # Subcommands: 88 | # create Create a new device. 89 | # delete Delete a device or all unavailable devices. 90 | # boot Boot a device. 91 | # shutdown Shutdown a device. 92 | # install Install an app on a device. 93 | # usage: simctl install 94 | # launch Launch an application by identifier on a device. 95 | # usage: simctl launch [-w | --wait-for-debugger] [--console|--console-pty] [--stdout=] [--stderr=] [ ... ] 96 | # list List available devices, device types, runtimes, or device pairs. 97 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPAssertRecorder.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @protocol OCSPAssertRecorder 5 | 6 | - (void)recordFailWithTestCase:(XCTestCase * _Nonnull)test message:(NSString * _Nonnull)message; 7 | - (void)recordPassWithTestCase:(XCTestCase* _Nonnull)test; 8 | 9 | @end 10 | 11 | @interface OCSPXCAssertRecorder : NSObject 12 | 13 | 14 | @end 15 | 16 | @interface OCSPAssertRecorderSpy : NSObject 17 | 18 | @property (nonatomic, strong, nullable) NSString *didRecordFailMessage; 19 | @property (nonatomic, assign) BOOL didRecordFail; 20 | @property (nonatomic, assign) BOOL didRecordPass; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPAssertRecorder.m: -------------------------------------------------------------------------------- 1 | #import "OCSPAssertRecorder.h" 2 | 3 | @implementation OCSPXCAssertRecorder 4 | 5 | - (void)recordFailWithTestCase:(XCTestCase *)test message:(NSString *)message{ 6 | 7 | _XCTPrimitiveFail(test, @"%@", message); 8 | 9 | } 10 | 11 | - (void)recordPassWithTestCase:(XCTestCase *)test { 12 | 13 | _XCTPrimitiveAssertTrue(test, YES, @""); 14 | 15 | } 16 | 17 | @end 18 | 19 | @implementation OCSPAssertRecorderSpy 20 | 21 | - (void)recordFailWithTestCase:(XCTestCase *)test message:(NSString *)message{ 22 | 23 | self.didRecordFailMessage = message; 24 | self.didRecordFail = true; 25 | 26 | } 27 | 28 | - (void)recordPassWithTestCase:(XCTestCase*)testCase { 29 | 30 | self.didRecordPass = true; 31 | 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPJUnitXMLParser.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface OCSPJUnitXMLParser : NSObject 4 | 5 | @property (nonatomic, readonly) NSUInteger testCaseCount; 6 | 7 | @property (nonatomic, readonly) NSUInteger testSuiteErrorCount; 8 | 9 | @property (nonatomic, readonly, nonnull) NSString *testSuiteName; 10 | 11 | @property (nonatomic, readonly) BOOL parseErrorOccured; 12 | 13 | @property (nonatomic, readonly) BOOL parsingSucceeded; 14 | 15 | - (nonnull id)initWithXMLData:(nonnull NSData *) data; 16 | 17 | - (void) parse; 18 | 19 | - (BOOL) result; 20 | 21 | - (BOOL) testResultForTestCaseAtIndex:(NSUInteger)index; 22 | 23 | - (nullable NSString *) testNameForTestCaseAtIndex:(NSUInteger)index; 24 | 25 | - (nullable NSString *) testErrorMessageForTestCaseAtIndex:(NSUInteger)index; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPJUnitXMLParser.m: -------------------------------------------------------------------------------- 1 | #import "OCSPJUnitXMLParser.h" 2 | 3 | @interface OCSPJUnitXMLParser () 4 | 5 | @property (nonatomic, strong) NSData *data; 6 | @property (nonatomic, strong) NSString *testSuiteName; 7 | @property (nonatomic, assign) NSUInteger testSuiteErrorCount; 8 | @property (nonatomic, assign) NSUInteger testCaseCount; 9 | @property (nonatomic, assign) NSUInteger failedTestSuiteCount; 10 | @property (nonatomic, assign) BOOL parseErrorOccured; 11 | @property (nonatomic, assign) BOOL parsingSucceeded; 12 | @property (nonatomic, strong) NSMutableArray *testCaseNames; 13 | @property (nonatomic, strong) NSMutableArray *testCaseResults; 14 | @property (nonatomic, strong) NSMutableArray *testErrorMessages; 15 | 16 | @end 17 | 18 | @implementation OCSPJUnitXMLParser 19 | 20 | NSError *__autoreleasing * outErrorRef; 21 | 22 | - (id)init { 23 | 24 | return [self initWithXMLData:[NSData data]]; 25 | 26 | } 27 | 28 | - (id)initWithXMLData:(nonnull NSData *) data { 29 | 30 | if (self == [super init]) { 31 | 32 | _data = data; 33 | 34 | _testSuiteName = [[NSNull null] description]; 35 | 36 | } 37 | 38 | return self; 39 | 40 | } 41 | 42 | - (void)parse { 43 | 44 | NSXMLParser *parser = [[NSXMLParser alloc] initWithData:self.data]; 45 | 46 | parser.delegate = self; 47 | 48 | self.parsingSucceeded = [parser parse]; 49 | 50 | } 51 | 52 | - (BOOL) result { 53 | 54 | return self.failedTestSuiteCount == 0; 55 | 56 | } 57 | 58 | 59 | - (NSString *) testNameForTestCaseAtIndex:(NSUInteger)index { 60 | 61 | return (index < self.testCaseNames.count) ? self.testCaseNames[index] : nil; 62 | 63 | } 64 | 65 | - (BOOL)testResultForTestCaseAtIndex:(NSUInteger)index { 66 | 67 | return [self.testCaseResults[index] boolValue]; 68 | 69 | } 70 | 71 | - (nullable NSString *)testErrorMessageForTestCaseAtIndex:(NSUInteger)index { 72 | 73 | NSObject *object = self.testErrorMessages[index]; 74 | 75 | return ([[NSNull null] isEqual:object]) ? nil : (NSString *)object; 76 | 77 | } 78 | 79 | //MARK: NSXMLParserDelegate 80 | 81 | - (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError { 82 | 83 | self.parseErrorOccured = YES; 84 | 85 | 86 | } 87 | 88 | - (void)parser:(NSXMLParser *)parser didStartElement:(nonnull NSString *)elementName namespaceURI:(nullable NSString *)namespaceURI qualifiedName:(nullable NSString *)qName attributes:(nonnull NSDictionary *)attributeDict { 89 | 90 | if ([elementName isEqualToString:@"testsuite"]) { 91 | 92 | [self takeTestSuiteResultsFromTestSuiteElementAttributes:attributeDict]; 93 | 94 | } 95 | 96 | if ([elementName isEqualToString:@"testcase"]) { 97 | 98 | [self takeTestCaseNameFromTestCaseElementAttributes:attributeDict]; 99 | 100 | [self appendPassTestResult]; 101 | 102 | [self appendNullTestErrorMessage]; 103 | } 104 | 105 | 106 | if ( [@[@"failure", @"error"] indexOfObject:elementName] != NSNotFound ) { 107 | 108 | [self updateTestResultFailFromElementAttributes:attributeDict]; 109 | } 110 | 111 | 112 | 113 | } 114 | 115 | - (void)takeTestSuiteResultsFromTestSuiteElementAttributes:(nonnull NSDictionary *) attributeDict { 116 | 117 | self.testSuiteName = attributeDict[@"name"]; 118 | 119 | [self takeTestCaseCountFromElementAttributes:attributeDict]; 120 | 121 | [self takeTestSuiteFailuresFromElementAttributes:attributeDict]; 122 | 123 | [self takeTestSuiteErrorsFromElementAttributes:attributeDict]; 124 | 125 | } 126 | 127 | - (void) takeTestCaseCountFromElementAttributes:(NSDictionary*)attributeDict { 128 | 129 | NSUInteger count = [[attributeDict objectForKey:@"tests"] integerValue]; 130 | 131 | self.testCaseCount = count; 132 | 133 | } 134 | 135 | - (void) takeTestSuiteFailuresFromElementAttributes:(NSDictionary*)attributeDict { 136 | 137 | NSUInteger failuresCount = [[attributeDict objectForKey:@"failures"] integerValue]; 138 | 139 | self.failedTestSuiteCount += failuresCount; 140 | 141 | } 142 | 143 | - (void) takeTestSuiteErrorsFromElementAttributes:(NSDictionary*)attributeDict { 144 | 145 | NSUInteger errorsCount = [[attributeDict objectForKey:@"errors"] integerValue]; 146 | 147 | self.testSuiteErrorCount += errorsCount; 148 | } 149 | 150 | - (void) takeTestCaseNameFromTestCaseElementAttributes:(NSDictionary*)attributesDict { 151 | 152 | NSString* name = (NSString *) attributesDict[@"name"]; 153 | 154 | if (!self.testCaseNames) { 155 | 156 | self.testCaseNames = [NSMutableArray arrayWithObject:name]; 157 | 158 | } else { 159 | 160 | [self.testCaseNames addObject:name]; 161 | } 162 | } 163 | 164 | 165 | - (void)appendPassTestResult { 166 | 167 | if (!self.testCaseResults) { 168 | 169 | self.testCaseResults = [NSMutableArray arrayWithObject:@YES]; 170 | 171 | } else { 172 | 173 | [self.testCaseResults addObject:@YES]; 174 | } 175 | 176 | } 177 | 178 | - (void)appendNullTestErrorMessage { 179 | 180 | if (!self.testErrorMessages) { 181 | 182 | self.testErrorMessages = [NSMutableArray arrayWithObject:[NSNull null]]; 183 | 184 | } else { 185 | 186 | [self.testErrorMessages addObject:[NSNull null]]; 187 | } 188 | 189 | } 190 | 191 | - (void)updateTestResultFailFromElementAttributes:(NSDictionary *)attributeDict { 192 | 193 | NSUInteger lastTestResultIndex = [self.testCaseResults indexOfObject:self.testCaseResults.lastObject]; 194 | 195 | [self.testCaseResults replaceObjectAtIndex:lastTestResultIndex withObject:@NO]; 196 | 197 | 198 | NSString *message = attributeDict[@"message"]; 199 | 200 | [self.testErrorMessages replaceObjectAtIndex:lastTestResultIndex withObject:message]; 201 | 202 | } 203 | @end 204 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPJUnitXMLParserTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "OCSPJUnitXMLParser.h" 3 | #import "OCSPTestDataManager.h" 4 | 5 | @interface OCSPJUnitXMLParserTests : XCTestCase 6 | 7 | @property (nonatomic, strong) OCSPJUnitXMLParser *parser; 8 | @property (nonatomic, strong) NSError *parsingError; 9 | @end 10 | 11 | @implementation OCSPJUnitXMLParserTests 12 | 13 | - (void)setUp { 14 | 15 | [super setUp]; 16 | 17 | self.parser = [[OCSPJUnitXMLParser alloc] init]; 18 | 19 | } 20 | 21 | - (void)tearDown { 22 | self.parser = nil; 23 | 24 | [super tearDown]; 25 | } 26 | 27 | - (void) testSuiteNameNotEmpty { 28 | 29 | XCTAssertNotNil(self.parser.testSuiteName); 30 | 31 | XCTAssertNotEqualObjects(@"", self.parser.testSuiteName); 32 | 33 | } 34 | 35 | - (void) testSuiteJUnitXMLFailureWillFail { 36 | 37 | NSData *data = [OCSPTestDataManager failedResultData]; 38 | 39 | [self setupParserWithData:data]; 40 | 41 | XCTAssertFalse([self.parser result]); 42 | } 43 | 44 | - (void) testSuiteJUnitXMLSuccessWillPass { 45 | 46 | NSData *data = [OCSPTestDataManager successResultData]; 47 | 48 | [self setupParserWithData:data]; 49 | 50 | XCTAssertTrue([self.parser result]); 51 | 52 | } 53 | 54 | - (void) testSuiteJUnitXMLSuccessParsingSucceeded { 55 | 56 | NSData *data = [OCSPTestDataManager successResultData]; 57 | 58 | [self setupParserWithData:data]; 59 | 60 | XCTAssertTrue([self.parser parsingSucceeded]); 61 | 62 | } 63 | 64 | #pragma mark - Number Of Test Cases Tests 65 | 66 | - (void) testNumberOfTestCases { 67 | 68 | NSData *data = [OCSPTestDataManager successResultData]; 69 | 70 | [self setupParserWithData:data]; 71 | 72 | XCTAssertEqual([self.parser testCaseCount], 1); 73 | 74 | } 75 | 76 | 77 | - (void) testNumberOfTestCasesWithMultipleTestCases { 78 | 79 | NSData *data = [OCSPTestDataManager successResultDataByAppendingHyphenatedFilenameModifier:@"3"]; 80 | 81 | [self setupParserWithData:data]; 82 | 83 | XCTAssertEqual([self.parser testCaseCount], 3); 84 | 85 | } 86 | 87 | #pragma mark - Test Suite and Case name tests 88 | 89 | - (void)testSuiteName { 90 | 91 | NSData *data = [OCSPTestDataManager successResultData]; 92 | 93 | [self setupParserWithData:data]; 94 | 95 | XCTAssertEqualObjects([self.parser testSuiteName], @"OCSlimProjectExampleSuite"); 96 | } 97 | 98 | - (void)testTestCaseNameAtIndex { 99 | 100 | NSData *data = [OCSPTestDataManager successResultDataByAppendingHyphenatedFilenameModifier:@"3"]; 101 | 102 | [self setupParserWithData:data]; 103 | 104 | XCTAssertEqualObjects([self.parser testNameForTestCaseAtIndex:0], @"OCSlimProjectExampleSuite.TestPage0"); 105 | XCTAssertEqualObjects([self.parser testNameForTestCaseAtIndex:1], @"OCSlimProjectExampleSuite.TestPage1"); 106 | XCTAssertEqualObjects([self.parser testNameForTestCaseAtIndex:2], @"OCSlimProjectExampleSuite.TestPage2"); 107 | 108 | 109 | } 110 | 111 | - (void)testTestCaseNameAtIndexOutOfRange { 112 | 113 | NSData *data = [OCSPTestDataManager successResultData]; 114 | 115 | [self setupParserWithData:data]; 116 | 117 | XCTAssertNil([self.parser testNameForTestCaseAtIndex:1]); 118 | 119 | } 120 | 121 | #pragma mark - Test Failure Messages 122 | 123 | - (void)testErrorMessageAtIndexForPass { 124 | 125 | NSData *data = [OCSPTestDataManager successResultData]; 126 | 127 | [self setupParserWithData:data]; 128 | 129 | XCTAssertNil([self.parser testErrorMessageForTestCaseAtIndex:0]); 130 | 131 | } 132 | 133 | - (void)testErrorMessageAtIndexForFail { 134 | 135 | NSData *data = [OCSPTestDataManager failedResultData]; 136 | 137 | [self setupParserWithData:data]; 138 | 139 | XCTAssertEqualObjects([self.parser testErrorMessageForTestCaseAtIndex:0], @"1 errors"); 140 | 141 | } 142 | 143 | - (void)testErrorMessageAtIndexesForFail { 144 | 145 | NSData *data = [OCSPTestDataManager failedResultDataByAppendingHyphenatedFilenameModifier:@"3"]; 146 | 147 | [self setupParserWithData:data]; 148 | 149 | XCTAssertEqualObjects([self.parser testErrorMessageForTestCaseAtIndex:0], @"1 errors"); 150 | 151 | XCTAssertEqualObjects([self.parser testErrorMessageForTestCaseAtIndex:1], @"2 errors"); 152 | 153 | XCTAssertEqualObjects([self.parser testErrorMessageForTestCaseAtIndex:2], @"3 errors"); 154 | 155 | } 156 | 157 | 158 | #pragma mark - Test Exception Messages 159 | 160 | - (void) testExceptionsReportedGivenExceptions { 161 | 162 | NSData *data = [OCSPTestDataManager failedResultDataByAppendingHyphenatedFilenameModifier:@"Exceptions"]; 163 | 164 | [self setupParserWithData:data]; 165 | 166 | XCTAssertEqualObjects([self.parser testErrorMessageForTestCaseAtIndex:0], @"1 exceptions"); 167 | 168 | } 169 | 170 | 171 | #pragma mark - Test Result Tests 172 | 173 | - (void)testResultAtIndexWithSuccessfulResults { 174 | 175 | NSData *data = [OCSPTestDataManager successResultData]; 176 | 177 | [self setupParserWithData:data]; 178 | 179 | XCTAssertTrue([self.parser testResultForTestCaseAtIndex:0]); 180 | 181 | } 182 | 183 | - (void)testResultAtIndexWithFailedResults { 184 | 185 | NSData *data = [OCSPTestDataManager failedResultData]; 186 | 187 | [self setupParserWithData:data]; 188 | 189 | XCTAssertFalse([self.parser testResultForTestCaseAtIndex:0]); 190 | 191 | } 192 | 193 | #pragma mark - Test XML Errors 194 | 195 | - (void)testErrorsReportedGivenNotFoundData { 196 | 197 | NSData *data = [OCSPTestDataManager failedResultDataByAppendingHyphenatedFilenameModifier:@"NotFound"]; 198 | 199 | [self setupParserWithData:data]; 200 | 201 | XCTAssertTrue(self.parser.parseErrorOccured); 202 | } 203 | 204 | - (void)testSuiteNameGivenNotFoundData { 205 | 206 | NSData *data = [OCSPTestDataManager failedResultDataByAppendingHyphenatedFilenameModifier:@"NotFound"]; 207 | 208 | [self setupParserWithData:data]; 209 | 210 | XCTAssertNotNil(self.parser.testSuiteName); 211 | } 212 | 213 | - (void)testSuiteNameGivenNilData { 214 | 215 | [self setupParserWithData:nil]; 216 | 217 | XCTAssertNotNil(self.parser.testSuiteName); 218 | } 219 | 220 | - (void)testSuiteParsingSucceededGivenNilData { 221 | 222 | [self setupParserWithData:nil]; 223 | 224 | XCTAssertFalse(self.parser.parsingSucceeded); 225 | 226 | } 227 | 228 | #pragma mark - Test Reports with Errors 229 | 230 | - (void)testSuiteErrorCountParsing { 231 | 232 | NSData *data = [OCSPTestDataManager errorResultData]; 233 | 234 | [self setupParserWithData:data]; 235 | 236 | XCTAssertEqual(1, self.parser.testSuiteErrorCount); 237 | } 238 | 239 | #pragma mark - Test Automators 240 | 241 | - (void)setupParserWithData:(NSData*)data { 242 | 243 | self.parser = [[OCSPJUnitXMLParser alloc] initWithXMLData:data]; 244 | 245 | [self.parser parse]; 246 | 247 | } 248 | 249 | @end 250 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPLocalizedMessageTable.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface OCSPLocalizedMessageTable : NSObject 4 | 5 | + (nonnull NSString *) localizedEmptyTestSuiteMessageWithSuiteName:(nonnull NSString *) suiteName; 6 | 7 | + (nonnull NSString *) localizedTestPageMessageWithUnderlyingMessage:(nonnull NSString *) underlyingMessage; 8 | 9 | + (nonnull NSString *) localizedTestSuiteParsingErrorMessage; 10 | 11 | + (nonnull NSString *) localizedTestSuiteReportDataNotFound; 12 | 13 | + (nonnull NSString *) localizedTestSuiteErrorsOccurredMessageWithCount:(NSUInteger)errorCount; 14 | 15 | + (nullable NSString *)localizedMessageWithKey:(nonnull NSString*)key argument:(nullable NSString*)arg; 16 | 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPLocalizedMessageTable.m: -------------------------------------------------------------------------------- 1 | #import "OCSPLocalizedMessageTable.h" 2 | 3 | @implementation OCSPLocalizedMessageTable 4 | 5 | + (NSString*) localizedEmptyTestSuiteMessageWithSuiteName:(NSString *) suiteName { 6 | 7 | return [self localizedMessageWithKey:@"EmptyTestSuiteErrorMessage" 8 | argument:suiteName]; 9 | 10 | } 11 | 12 | + (NSString *)localizedTestPageMessageWithUnderlyingMessage:(NSString *) underlyingMessage { 13 | 14 | return [self localizedMessageWithKey:@"TestPageErrorMessage" 15 | argument:underlyingMessage]; 16 | 17 | } 18 | 19 | + (NSString *)localizedTestSuiteParsingErrorMessage { 20 | 21 | return [self localizedMessageWithKey:@"TestSuiteParsingErrorMessage" argument:nil]; 22 | } 23 | 24 | + (nonnull NSString *) localizedTestSuiteReportDataNotFound { 25 | 26 | return [self localizedMessageWithKey:@"TestSuiteDataNotFound" argument:nil]; 27 | 28 | } 29 | 30 | + (nonnull NSString *) localizedTestSuiteErrorsOccurredMessageWithCount:(NSUInteger)errorCount { 31 | 32 | return [self localizedMessageWithKey:@"TestSuiteErrorsOccurred" argument:[@(errorCount) stringValue]]; 33 | } 34 | 35 | + (NSString *)localizedMessageWithKey:(NSString*)key argument:(NSString*)arg { 36 | 37 | NSString *localizedString = NSLocalizedStringFromTableInBundle(key, nil, [NSBundle bundleForClass:[self class]], nil); 38 | 39 | NSString *message = [NSString stringWithFormat:localizedString, arg, nil]; 40 | 41 | return message; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPLocalizedMessageTableTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "OCSPLocalizedMessageTable.h" 3 | 4 | @interface OCSPLocalizedMessageTableTests : XCTestCase 5 | 6 | @end 7 | 8 | @implementation OCSPLocalizedMessageTableTests 9 | 10 | 11 | - (void)testErrorMessageEmptyTestSuiteKeyDefined { 12 | 13 | NSString *localizedString = NSLocalizedStringFromTableInBundle(@"EmptyTestSuiteErrorMessage", nil, [NSBundle bundleForClass:[self class]], nil); 14 | 15 | XCTAssertNotEqualObjects(@"EmptyTestSuiteErrorMessage", localizedString); 16 | 17 | } 18 | 19 | - (void)testLocalizedEmptyTestSuiteMessage { 20 | 21 | NSString *message = [OCSPLocalizedMessageTable localizedEmptyTestSuiteMessageWithSuiteName:@"TestSuite"]; 22 | 23 | NSString *expectedMessage = [OCSPLocalizedMessageTable localizedMessageWithKey:@"EmptyTestSuiteErrorMessage" argument:@"TestSuite"]; 24 | 25 | XCTAssertEqualObjects(expectedMessage, message); 26 | 27 | } 28 | 29 | - (void)testErrorMessageTestPageKeyDefined { 30 | 31 | NSString *localizedString = NSLocalizedStringFromTableInBundle(@"TestPageErrorMessage", nil, [NSBundle bundleForClass:[self class]], nil); 32 | 33 | XCTAssertNotEqualObjects(@"TestPageErrorMessage", localizedString); 34 | 35 | } 36 | 37 | - (void)testLocalizedTestPageErrorMessage { 38 | 39 | NSString *message = [OCSPLocalizedMessageTable localizedTestPageMessageWithUnderlyingMessage:@"1 Errors"]; 40 | 41 | NSString *expectedMessage = [OCSPLocalizedMessageTable localizedMessageWithKey:@"TestPageErrorMessage" argument:@"1 Errors"]; 42 | 43 | XCTAssertEqualObjects(expectedMessage, message); 44 | 45 | } 46 | 47 | 48 | - (void)testErrorMessageTestSuiteParsingErrorKeyDefined { 49 | 50 | NSString *localizedString = NSLocalizedStringFromTableInBundle(@"TestSuiteParsingErrorMessage", nil, [NSBundle bundleForClass:[self class]], nil); 51 | 52 | XCTAssertNotEqualObjects(@"TestSuiteParsingErrorMessage", localizedString); 53 | 54 | } 55 | 56 | - (void)testLocalizedTestSuiteParsingErrorMessage { 57 | 58 | NSString *message = [OCSPLocalizedMessageTable localizedTestSuiteParsingErrorMessage]; 59 | 60 | NSString *expectedMessage = [OCSPLocalizedMessageTable localizedMessageWithKey:@"TestSuiteParsingErrorMessage" argument:nil]; 61 | 62 | XCTAssertEqualObjects(expectedMessage, message); 63 | 64 | } 65 | 66 | - (void)testErrorMessageTestSuiteDataMissingErrorKeyDefined { 67 | 68 | NSString *localizedString = NSLocalizedStringFromTableInBundle(@"TestSuiteDataNotFound", nil, [NSBundle bundleForClass:[self class]], nil); 69 | 70 | XCTAssertNotEqualObjects(@"TestSuiteDataMissing", localizedString); 71 | 72 | } 73 | 74 | - (void)testLocalizedTestSuiteDataMissingErrorMessage { 75 | 76 | NSString *message = [OCSPLocalizedMessageTable localizedTestSuiteReportDataNotFound]; 77 | 78 | NSString *expectedMessage = [OCSPLocalizedMessageTable localizedMessageWithKey:@"TestSuiteDataNotFound" argument:nil]; 79 | 80 | XCTAssertEqualObjects(expectedMessage, message); 81 | 82 | } 83 | 84 | - (void)testErrorMessageTestSuiteErrorsOccurredKeyDefined { 85 | 86 | NSString *localizedString = NSLocalizedStringFromTableInBundle(@"TestSuiteErrorsOccurred", nil, [NSBundle bundleForClass:[self class]], nil); 87 | 88 | XCTAssertNotEqualObjects(@"TestSuiteErrorsOccurred", localizedString); 89 | 90 | } 91 | 92 | 93 | - (void)testLocalizedTestSuiteErrorsOccurredMessage { 94 | 95 | NSString *message = [OCSPLocalizedMessageTable localizedTestSuiteErrorsOccurredMessageWithCount:3]; 96 | 97 | NSString *expectedMessage = [OCSPLocalizedMessageTable localizedMessageWithKey:@"TestSuiteErrorsOccurred" argument:@"3"]; 98 | 99 | XCTAssertEqualObjects(expectedMessage, message); 100 | 101 | } 102 | 103 | 104 | @end 105 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPPrincipalTestObserver.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @class OCSPTestReportCenter; 5 | 6 | @interface OCSPPrincipalTestObserver : NSObject 7 | 8 | @property (nonatomic, strong, readonly) OCSPTestReportCenter *reportCenter; 9 | 10 | - (XCTestSuite *)testSuite __attribute__((deprecated)); 11 | 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPPrincipalTestObserver.m: -------------------------------------------------------------------------------- 1 | #import "OCSPPrincipalTestObserver.h" 2 | 3 | #import "OCSPTestSuite.h" 4 | #import "OCSPTestReportCenter.h" 5 | #import "OCSPTestCaseReport.h" 6 | 7 | @interface OCSPPrincipalTestObserver () 8 | 9 | @property (nonatomic, strong) NSString *bundleTestSuiteName; 10 | @property (nonatomic, strong) OCSPTestReportCenter *reportCenter; 11 | @property (nonatomic, strong) NSArray *testCaseReports; 12 | 13 | @end 14 | 15 | @implementation OCSPPrincipalTestObserver 16 | 17 | - (id)init { 18 | 19 | if (self == [super init]) { 20 | 21 | _reportCenter = [[OCSPTestReportCenter alloc] init]; 22 | 23 | [[XCTestObservationCenter sharedTestObservationCenter] addTestObserver:self]; 24 | 25 | } 26 | 27 | return self; 28 | } 29 | 30 | #pragma mark - XCTestObservation 31 | 32 | - (void)testBundleWillStart:(NSBundle *)testBundle { 33 | 34 | [self registerHostTestBundle:testBundle]; 35 | 36 | } 37 | 38 | - (void)testSuiteWillStart:(XCTestSuite *)testSuite { 39 | 40 | if ( [self isHostTestSuite:testSuite] ) { 41 | 42 | XCTestSuite *acceptanceTestSuite = self.testSuite; 43 | 44 | [testSuite addTest:acceptanceTestSuite]; 45 | 46 | } 47 | 48 | } 49 | 50 | - (void)testBundleDidFinish:(NSBundle *)testBundle { 51 | 52 | [[XCTestObservationCenter sharedTestObservationCenter] removeTestObserver:self]; 53 | 54 | } 55 | 56 | #pragma mark - Private 57 | 58 | #pragma mark - Identifing Target Test Bundle 59 | 60 | - (void)registerHostTestBundle:(NSBundle *)bundle { 61 | 62 | self.bundleTestSuiteName = [[bundle bundleURL] lastPathComponent]; 63 | 64 | } 65 | 66 | - (BOOL)isHostTestSuite:(XCTestSuite *)suite { 67 | 68 | return [[suite name] isEqualToString:self.bundleTestSuiteName]; 69 | } 70 | 71 | #pragma mark - Test Suite Building 72 | 73 | - (XCTestSuite *)testSuite { 74 | 75 | NSString *testSuiteName = [self.reportCenter testSuiteName]; 76 | 77 | XCTestSuite *acceptanceTestSuite = [XCTestSuite testSuiteWithName:testSuiteName]; 78 | 79 | 80 | for (int i = 0; i < self.testCaseReports.count; i++ ) { 81 | 82 | XCTestCase *testCase = [self testCaseForIndex:i]; 83 | 84 | [acceptanceTestSuite addTest:testCase]; 85 | 86 | } 87 | 88 | return acceptanceTestSuite; 89 | 90 | } 91 | 92 | #pragma mark Test Suite Building Helpers 93 | 94 | - (XCTestCase *)testCaseForIndex:(NSUInteger)i { 95 | 96 | OCSPTestCaseReport *report = self.testCaseReports[i]; 97 | 98 | OCSPTestSuite *testCase = [[OCSPTestSuite alloc] initWithTestCaseName:report.name result:report.passed]; 99 | 100 | testCase.errorMessage = report.errorMessage; 101 | 102 | return testCase; 103 | 104 | } 105 | 106 | - (NSArray *) testCaseReports { 107 | 108 | if ( nil == _testCaseReports ) { 109 | 110 | // self.reportCenter.xcodeFixDisappearingTestCaseByAppendingDummyTest = self.xcodeFixDisappearingTestCaseByAppendingDummyTest; 111 | 112 | _testCaseReports = [self.reportCenter testCaseReports]; 113 | 114 | } 115 | 116 | return _testCaseReports; 117 | 118 | } 119 | 120 | 121 | @end 122 | 123 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPPrincipalTestObserverTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "OCSPPrincipalTestObserver.h" 3 | 4 | #import "OCSPTestDataManager.h" 5 | #import "OCSPTestSuite.h" 6 | #import "OCSPJUnitXMLParser.h" 7 | #import "OCSPLocalizedMessageTable.h" 8 | #import "OCSPTestReportCenter.h" 9 | 10 | @interface OCSPPrincipalTestObserverTests : XCTestCase 11 | 12 | @property (nonatomic, strong) OCSPPrincipalTestObserver* main; 13 | @end 14 | 15 | @implementation OCSPPrincipalTestObserverTests 16 | 17 | - (void)setUp { 18 | 19 | [super setUp]; 20 | 21 | self.main = [[OCSPPrincipalTestObserver alloc] init]; 22 | 23 | self.main.reportCenter.xcodeFixDisappearingTestCaseByAppendingDummyTest = YES; 24 | 25 | self.main.reportCenter.xctoolCompatibilityDisabled = YES; 26 | } 27 | 28 | - (void)testAcceptanceTestCasesAreJUnitAsserts{ 29 | 30 | XCTestCase *test = [self acceptanceTestCase]; 31 | 32 | XCTAssertEqual([test class], [OCSPTestSuite class]); 33 | } 34 | 35 | 36 | - (void)testSuiteWillStartWithBundlesTestSuiteContainsAcceptanceTestSuite { 37 | 38 | NSBundle *bundle = [NSBundle bundleForClass:[self class]]; 39 | 40 | [self.main testBundleWillStart:bundle]; 41 | 42 | XCTestSuite *suite = [XCTestSuite testSuiteWithName:[[bundle bundleURL] lastPathComponent]]; 43 | 44 | [self.main testSuiteWillStart:suite]; 45 | 46 | XCTAssertEqual(1, suite.tests.count); 47 | 48 | XCTAssertEqualObjects(self.main.testSuite.name, [suite.tests.firstObject name]); 49 | 50 | } 51 | 52 | - (void)testSuiteWillStartWithNonBundleTestSuiteDoesNotReceiveFitnesseTests { 53 | 54 | NSBundle *bundle = [NSBundle bundleForClass:[self class]]; 55 | 56 | [self.main testBundleWillStart:bundle]; 57 | 58 | XCTestSuite *suite = [XCTestSuite testSuiteWithName:@""]; 59 | 60 | [self.main testSuiteWillStart:suite]; 61 | 62 | XCTAssertEqual(0, suite.testCaseCount); 63 | 64 | } 65 | 66 | #pragma mark - Individual Test Suite Result Reporting Tests 67 | 68 | - (void)testAcceptanceTestSuiteNumberOfTests { 69 | 70 | (void) [[self class] stubSuccessfulTestReport]; 71 | 72 | XCTestSuite *suite = [self acceptanceTestSuite]; 73 | 74 | XCTAssertEqual(suite.testCaseCount, 1); 75 | 76 | } 77 | 78 | - (void)testAcceptanceTestSuiteNumberOfTestsWithOtherTestReportData { 79 | 80 | (void) [[self class] stubSuccessfulTestReportWithFilenameModifier:@"3"]; 81 | 82 | XCTestSuite *suite = [self acceptanceTestSuite]; 83 | 84 | XCTAssertEqual(suite.testCaseCount, 3); 85 | } 86 | 87 | 88 | - (void)testAcceptanceTestSuiteNameEqualsSuiteName { 89 | 90 | NSData *data = [[self class] stubSuccessfulTestReport]; 91 | 92 | XCTestSuite *suite = [self acceptanceTestSuite]; 93 | 94 | OCSPJUnitXMLParser* parser = [[OCSPJUnitXMLParser alloc] initWithXMLData:data]; 95 | 96 | [parser parse]; 97 | 98 | XCTAssertEqualObjects(suite.name, [parser testSuiteName]); 99 | 100 | } 101 | 102 | - (void)testAcceptanceTestSuiteTestCaseName { 103 | 104 | (void) [[self class] stubSuccessfulTestReport]; 105 | 106 | OCSPTestSuite *testCase = [[[self acceptanceTestSuite] tests] firstObject]; 107 | 108 | XCTAssertEqualObjects([testCase testCaseName], @"OCSlimProjectExampleSuite.TestPage0"); 109 | } 110 | 111 | - (void)testAcceptanceTestSuiteTestCaseNames { 112 | 113 | (void) [[self class] stubSuccessfulTestReportWithFilenameModifier:@"3"]; 114 | 115 | OCSPTestSuite *testCase = [[[self acceptanceTestSuite] tests] lastObject]; 116 | 117 | XCTAssertEqualObjects([testCase testCaseName], @"OCSlimProjectExampleSuite.TestPage2"); 118 | } 119 | 120 | 121 | - (void)testAcceptanceTestSuiteResultsPass { 122 | 123 | (void) [[self class] stubSuccessfulTestReport]; 124 | 125 | OCSPTestSuite *testCase = [[[self acceptanceTestSuite] tests] lastObject]; 126 | 127 | XCTAssertTrue([testCase isPass]); 128 | 129 | } 130 | 131 | - (void)testAcceptanceTestSuiteResultsFail { 132 | 133 | (void) [[self class] stubFailedTestReport]; 134 | 135 | OCSPTestSuite *testCase = [[[self acceptanceTestSuite] tests] lastObject]; 136 | 137 | XCTAssertFalse([testCase isPass]); 138 | 139 | } 140 | 141 | 142 | - (void)testFailingAcceptanceTestCasesNonNilErrorMessage { 143 | 144 | (void) [[self class] stubFailedTestReport]; 145 | 146 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 147 | 148 | XCTAssertNotNil(testCase.errorMessage); 149 | } 150 | 151 | - (void)testFailingAcceptanceTestCaseErrorMessage { 152 | 153 | (void) [[self class] stubFailedTestReport]; 154 | 155 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 156 | 157 | XCTAssertEqualObjects([OCSPLocalizedMessageTable localizedTestPageMessageWithUnderlyingMessage:@"1 errors"], testCase.errorMessage); 158 | } 159 | 160 | #pragma mark - Report Empty Test Suites as Failing Test 161 | 162 | - (void)testReportDataWithZeroTestsReturnsSingleTest { 163 | 164 | (void) [[self class] stubSuccessfulTestReportWithFilenameModifier:@"Empty"]; 165 | 166 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 167 | 168 | XCTAssertNotNil(testCase); 169 | } 170 | 171 | 172 | - (void)testReportDataWithZeroTestsReturnsFail { 173 | 174 | (void) [[self class] stubSuccessfulTestReportWithFilenameModifier:@"Empty"]; 175 | 176 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 177 | 178 | XCTAssertFalse([testCase isPass]); 179 | } 180 | 181 | - (void)testReportDataWithZeroTestsReturnsInformativeTestName { 182 | 183 | (void) [[self class] stubSuccessfulTestReportWithFilenameModifier:@"Empty"]; 184 | 185 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 186 | 187 | XCTAssertEqualObjects(@"EmptyPageTestCaseCountGreaterThanZero", [testCase testCaseName]); 188 | } 189 | 190 | - (void)testReportDataWithZeroTestsReturnsInformativeError { 191 | 192 | (void) [[self class] stubSuccessfulTestReportWithFilenameModifier:@"Empty"]; 193 | 194 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 195 | 196 | NSString *errorMsg = [OCSPLocalizedMessageTable localizedEmptyTestSuiteMessageWithSuiteName:@"EmptyPage"]; 197 | 198 | NSString *message = [NSString stringWithFormat:errorMsg, @"EmptyPage", nil]; 199 | 200 | XCTAssertEqualObjects(message, [testCase errorMessage]); 201 | } 202 | 203 | - (void)testReportDataNotFoundReturnsFail { 204 | 205 | (void) [[self class] stubFailedTestReportWithFilenameModifier:@"NotFound"]; 206 | 207 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 208 | 209 | XCTAssertFalse([testCase isPass]); 210 | } 211 | 212 | - (void)testReportDataNotFoundReturnsInformativeTestName { 213 | 214 | (void) [[self class] stubFailedTestReportWithFilenameModifier:@"NotFound"]; 215 | 216 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 217 | 218 | XCTAssertEqualObjects([testCase testCaseName], @"TestSuiteReportXMLParsingSucceeded"); 219 | } 220 | 221 | - (void)testReportDataNotFoundTestsReturnsInformativeError { 222 | 223 | (void) [[self class] stubFailedTestReportWithFilenameModifier:@"NotFound"]; 224 | 225 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 226 | 227 | NSString *message = [OCSPLocalizedMessageTable localizedTestSuiteParsingErrorMessage]; 228 | 229 | XCTAssertEqualObjects(message, [testCase errorMessage]); 230 | } 231 | 232 | - (void)testReportDataNotFoundNumberOfTestsEqualsOne { 233 | 234 | (void) [[self class] stubFailedTestReportWithFilenameModifier:@"NotFound"]; 235 | 236 | XCTAssertEqual([[self acceptanceTestSuite] testCaseCount], 1); 237 | 238 | } 239 | 240 | - (void)testReportDataNilNumberOfTestsEqualsOne { 241 | 242 | createDefaultTestReportReaderWithData(nil); 243 | 244 | XCTAssertEqual([[self acceptanceTestSuite] testCaseCount], 1); 245 | 246 | } 247 | 248 | - (void)testReportDataNilReturnsInformativeTestName { 249 | 250 | createDefaultTestReportReaderWithData(nil); 251 | 252 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 253 | 254 | XCTAssertEqualObjects([testCase testCaseName], @"TestSuiteReportDataExists"); 255 | } 256 | 257 | - (void)testReportDataNilReturnsInformativeErrorMessage { 258 | 259 | createDefaultTestReportReaderWithData(nil); 260 | 261 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 262 | 263 | NSString *errorMessage = [OCSPLocalizedMessageTable localizedTestSuiteReportDataNotFound]; 264 | 265 | XCTAssertEqualObjects([testCase errorMessage], errorMessage); 266 | } 267 | 268 | 269 | - (void)testReportSuiteWithErrorsReturnsFailingTestCase { 270 | 271 | (void) [[self class] stubErrorTestReport]; 272 | 273 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 274 | 275 | XCTAssertFalse([testCase isPass]); 276 | 277 | } 278 | 279 | - (void)testReportSuiteWithErrorsReturnsInformativeName { 280 | 281 | (void) [[self class] stubErrorTestReport]; 282 | 283 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 284 | 285 | XCTAssertEqualObjects([testCase testCaseName], @"OCSlimProjectExampleSuiteErrorCountEqualsZero"); 286 | 287 | } 288 | 289 | - (void)testReportSuiteWithErrorsReturnsInformativeErrorMessage { 290 | 291 | (void) [[self class] stubErrorTestReport]; 292 | 293 | OCSPTestSuite *testCase = [self acceptanceTestCase]; 294 | 295 | NSString *errorMessage = [OCSPLocalizedMessageTable localizedTestSuiteErrorsOccurredMessageWithCount:1]; 296 | 297 | XCTAssertEqualObjects([testCase errorMessage], errorMessage); 298 | 299 | } 300 | 301 | - (void)testReportSuiteWithErrorsCausedByExceptionsDoesNotAddFailingReportTest { 302 | 303 | (void) [[self class] stubFailedTestReportWithFilenameModifier:@"Exceptions"]; 304 | 305 | XCTestSuite *suite = [self acceptanceTestSuite]; 306 | 307 | XCTAssertEqual(suite.testCaseCount, 1); 308 | 309 | } 310 | 311 | 312 | #pragma mark - Fix disappearing last test case issue. Xcode hides the last test result. To prevent this a last test is added after adding tests from the test report file. That fake test is then the one to disappear. 313 | 314 | - (void)testAcceptanceTestSuiteAddsExtraTest { 315 | 316 | (void) [[self class] stubFailedTestReport]; 317 | 318 | self.main.reportCenter.xcodeFixDisappearingTestCaseByAppendingDummyTest = NO; 319 | 320 | XCTestSuite *suite = [self acceptanceTestSuite]; 321 | 322 | XCTAssertEqual(suite.testCaseCount, 2); 323 | 324 | OCSPTestSuite *testCase = (OCSPTestSuite*) suite.tests.lastObject; 325 | 326 | XCTAssertTrue([testCase isPass]); 327 | 328 | XCTAssertEqualObjects([testCase testCaseName], @"tearDown"); 329 | 330 | } 331 | 332 | 333 | 334 | 335 | 336 | #pragma mark - Test Helpers 337 | 338 | + (NSData* )stubSuccessfulTestReport { 339 | 340 | return [self stubSuccessfulTestReportWithFilenameModifier:nil]; 341 | } 342 | 343 | + (NSData* )stubFailedTestReport { 344 | 345 | return [self stubFailedTestReportWithFilenameModifier:nil]; 346 | 347 | } 348 | 349 | + (NSData* )stubErrorTestReport { 350 | 351 | NSData *data = [OCSPTestDataManager errorResultData]; 352 | 353 | return [self stubTestReportWithData:data]; 354 | 355 | } 356 | 357 | + (NSData* )stubSuccessfulTestReportWithFilenameModifier:(NSString*)modifier { 358 | 359 | NSData *data = [OCSPTestDataManager successResultDataByAppendingHyphenatedFilenameModifier:modifier]; 360 | 361 | return [self stubTestReportWithData:data]; 362 | 363 | } 364 | 365 | + (NSData* )stubFailedTestReportWithFilenameModifier:(NSString*)modifier { 366 | 367 | NSData *data = [OCSPTestDataManager failedResultDataByAppendingHyphenatedFilenameModifier:modifier]; 368 | 369 | return [self stubTestReportWithData:data]; 370 | 371 | } 372 | 373 | + (NSData *)stubTestReportWithData:(NSData*)data { 374 | 375 | NSParameterAssert(data); 376 | 377 | createDefaultTestReportReaderWithData(data); 378 | 379 | return data; 380 | 381 | } 382 | 383 | #pragma mark - Test Suite Extraction 384 | 385 | - (XCTestSuite *)hostTestSuite { 386 | 387 | NSBundle *bundle = [NSBundle bundleForClass:[self class]]; 388 | 389 | [self.main testBundleWillStart:bundle]; 390 | 391 | XCTestSuite *hostTestSuite = [XCTestSuite testSuiteWithName:[[bundle bundleURL] lastPathComponent]]; 392 | 393 | [self.main testSuiteWillStart:hostTestSuite]; 394 | 395 | return hostTestSuite; 396 | 397 | } 398 | 399 | - (XCTestSuite *)acceptanceTestSuite { 400 | 401 | XCTestSuite *hostTestSuite = [self hostTestSuite]; 402 | 403 | return (XCTestSuite*) [[hostTestSuite tests] firstObject]; 404 | 405 | } 406 | 407 | 408 | - (OCSPTestSuite *)acceptanceTestCase { 409 | 410 | XCTestSuite *suite = [self acceptanceTestSuite]; 411 | 412 | XCTestCase *test = [[suite tests] firstObject]; 413 | 414 | return (OCSPTestSuite*) test; 415 | 416 | } 417 | 418 | @end 419 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestCaseReport.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface OCSPTestCaseReport : NSObject 4 | 5 | @property (nonatomic, strong, nonnull) NSString *name; 6 | 7 | @property (nonatomic, assign) BOOL passed; 8 | 9 | @property (nonatomic, strong, nonnull) NSString *errorMessage; 10 | 11 | - (nonnull id)initWithTestCaseName:(nonnull NSString *)name result:(BOOL)result; 12 | 13 | @end 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestCaseReport.m: -------------------------------------------------------------------------------- 1 | #import "OCSPTestCaseReport.h" 2 | 3 | @implementation OCSPTestCaseReport 4 | 5 | - (id)initWithTestCaseName:(NSString *)name result:(BOOL)result { 6 | 7 | if (self == [super init] ) { 8 | 9 | _name = name; 10 | 11 | _passed = result; 12 | 13 | } 14 | 15 | return self; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestDataManager.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface OCSPTestDataManager : NSObject 4 | 5 | + (NSData *)failedResultData; 6 | 7 | + (NSData *)failedResultDataByAppendingHyphenatedFilenameModifier:(NSString *)modifier; 8 | 9 | + (NSData *)successResultData; 10 | 11 | + (NSData *)successResultDataByAppendingHyphenatedFilenameModifier:(NSString *)modifier; 12 | 13 | + (NSData *)errorResultData; 14 | 15 | + (NSData *)fitnesseTestReportData; 16 | 17 | void createDefaultTestReportReaderWithData(NSData *data); 18 | 19 | @end 20 | 21 | 22 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestDataManager.m: -------------------------------------------------------------------------------- 1 | #import "OCSPTestDataManager.h" 2 | #import "OCSPTestReportReader.h" 3 | 4 | @implementation OCSPTestDataManager 5 | 6 | static NSBundle *_bundle; 7 | 8 | + (void)initialize { 9 | 10 | _bundle = [NSBundle bundleForClass:self]; 11 | 12 | } 13 | 14 | + (NSString *)failedResultPath { 15 | 16 | // NSString *path = [_bundle pathForResource:@"SuiteTestResultFailures" ofType:@"xml"]; 17 | // 18 | // NSParameterAssert(path); 19 | 20 | return [self pathForXMLFileResourceNamed:@"SuiteTestResultFailures"]; 21 | 22 | } 23 | 24 | + (NSData *)failedResultData { 25 | 26 | return [NSData dataWithContentsOfFile:[self failedResultPath]]; 27 | 28 | } 29 | 30 | + (NSString *)successResultPath { 31 | 32 | return [self pathForXMLFileResourceNamed:@"SuiteTestResultSuccess"]; 33 | 34 | // NSString *path = [_bundle pathForResource:@"SuiteTestResultSuccess" ofType:@"xml"]; 35 | // 36 | // NSParameterAssert(path); 37 | // 38 | // return path; 39 | 40 | } 41 | 42 | + (NSData *)successResultData { 43 | 44 | return [NSData dataWithContentsOfFile:[self successResultPath]]; 45 | 46 | } 47 | 48 | 49 | + (NSString *)errorResultPath { 50 | 51 | return [self pathForXMLFileResourceNamed:@"SuiteTestResultErrors"]; 52 | 53 | // NSString *path = [_bundle pathForResource:@"SuiteTestResultErrors" ofType:@"xml"]; 54 | // 55 | // NSParameterAssert(path); 56 | // 57 | // return path; 58 | 59 | } 60 | 61 | + (NSData *)errorResultData { 62 | 63 | return [NSData dataWithContentsOfFile:[self errorResultPath]]; 64 | 65 | } 66 | 67 | + (NSData *)failedResultDataByAppendingHyphenatedFilenameModifier:(NSString *)modifier { 68 | 69 | return [self resultDataAtPath:[self failedResultPath] byAppendingHyphenatedFilenameModifier:modifier]; 70 | } 71 | 72 | + (NSData *)successResultDataByAppendingHyphenatedFilenameModifier:(NSString *)modifier { 73 | 74 | return [self resultDataAtPath:[self successResultPath] byAppendingHyphenatedFilenameModifier:modifier]; 75 | 76 | } 77 | 78 | + (NSData *)resultDataAtPath:(NSString *)path byAppendingHyphenatedFilenameModifier:(NSString *)modifier { 79 | 80 | if (modifier) { 81 | 82 | path = [self path:path byAppendingHypenatedFilenameSuffix:modifier]; 83 | 84 | } 85 | 86 | return [NSData dataWithContentsOfFile:path]; 87 | 88 | } 89 | 90 | + (NSString *)path:(NSString*)path byAppendingHypenatedFilenameSuffix:(NSString *)suffix { 91 | 92 | NSString *pathExtension = [path pathExtension]; 93 | 94 | NSString *filenameSuffix = [NSString stringWithFormat:@"-%@",suffix]; 95 | 96 | return [[[path stringByDeletingPathExtension] stringByAppendingString:filenameSuffix] stringByAppendingPathExtension:pathExtension]; 97 | 98 | } 99 | 100 | + (NSData *)fitnesseTestReportData { 101 | 102 | NSString *fitnesseReportPath = [_bundle pathForResource:@"Fitnesse-Test-Report" ofType:@"xml"]; 103 | 104 | return [NSData dataWithContentsOfFile: fitnesseReportPath]; 105 | 106 | } 107 | 108 | + (NSString *)pathForXMLFileResourceNamed:(NSString *)resource { 109 | 110 | NSString *path = [_bundle pathForResource:resource ofType:@"xml"]; 111 | 112 | NSParameterAssert(path); 113 | 114 | return path; 115 | 116 | } 117 | 118 | @end 119 | 120 | 121 | /// OCSlimFitnesseTestReportReaderStub /// 122 | 123 | @interface OCSlimFitnesseTestReportReaderStub : NSObject 124 | 125 | @property (nonatomic, strong) NSData *data; 126 | 127 | - (id)initWithData:(NSData*)data; 128 | 129 | @end 130 | 131 | @implementation OCSlimFitnesseTestReportReaderStub 132 | 133 | - (id)initWithData:(NSData*)data { 134 | 135 | if (self = [super init] ) { 136 | 137 | _data = data; 138 | } 139 | 140 | return self; 141 | } 142 | 143 | - (NSData *)read { 144 | 145 | return self.data; 146 | } 147 | 148 | @end 149 | 150 | 151 | void createDefaultTestReportReaderWithData(NSData *data) { 152 | 153 | id reader = [[OCSlimFitnesseTestReportReaderStub alloc] initWithData:data]; 154 | 155 | [OCSPTestReportReader setDefaultReader: reader]; 156 | 157 | } -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestReportCenter.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class OCSPJUnitXMLParser; 4 | @class OCSPTestCaseReport; 5 | 6 | @interface OCSPTestReportCenter : NSObject 7 | 8 | @property (nonatomic, assign) BOOL xctoolCompatibilityDisabled; 9 | @property (nonatomic, assign) BOOL xcodeFixDisappearingTestCaseByAppendingDummyTest; 10 | 11 | @property (nonatomic, readonly, nonnull) NSString *testSuiteName; 12 | 13 | - (nonnull NSArray * )testCaseReports; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestReportCenter.m: -------------------------------------------------------------------------------- 1 | #import "OCSPTestReportCenter.h" 2 | #import "OCSPJUnitXMLParser.h" 3 | #import "OCSPLocalizedMessageTable.h" 4 | #import "OCSPTestCaseReport.h" 5 | #import "OCSPTestReportReader.h" 6 | 7 | @interface OCSPTestReportCenter () 8 | 9 | @property (nonatomic, strong) OCSPJUnitXMLParser *parser; 10 | 11 | @end 12 | 13 | @implementation OCSPTestReportCenter 14 | 15 | - (NSString *)testSuiteName { 16 | 17 | return [self.parser testSuiteName]; 18 | 19 | } 20 | 21 | - (NSArray *)testCaseReports { 22 | 23 | NSMutableArray *results = [[NSMutableArray alloc] initWithCapacity:self.parser.testCaseCount]; 24 | 25 | for (int i = 0; i < [self.parser testCaseCount]; i++ ) { 26 | 27 | OCSPTestCaseReport *report = [self testCaseReportForIndex:i]; 28 | 29 | [results addObject:report]; 30 | 31 | } 32 | 33 | [self appendExceptionReportTestCases:results]; 34 | 35 | [self appendDisappearingTestCaseUIFixWithReports:results]; 36 | 37 | return results; 38 | 39 | } 40 | 41 | #pragma mark - Private 42 | 43 | - (OCSPJUnitXMLParser *)parser { 44 | 45 | if (nil == _parser) { 46 | 47 | NSData *data = [[OCSPTestReportReader defaultReader] read]; 48 | 49 | _parser = [[OCSPJUnitXMLParser alloc] initWithXMLData:data]; 50 | 51 | [_parser parse]; 52 | 53 | } 54 | 55 | return _parser; 56 | 57 | } 58 | 59 | #pragma mark - Custom Reports 60 | 61 | - (OCSPTestCaseReport*)tearDownTestCaseReport { 62 | 63 | OCSPTestCaseReport *report = [[OCSPTestCaseReport alloc] init]; 64 | 65 | report.name = @"tearDown"; 66 | 67 | report.passed = YES; 68 | 69 | return report; 70 | } 71 | 72 | - (OCSPTestCaseReport *)testCaseReportForIndex:(NSUInteger)i { 73 | 74 | OCSPTestCaseReport *report = [self reportWithParserResultAtIndex:i]; 75 | 76 | [self updateReportWithXCToolCompatibleName:report]; 77 | 78 | return report; 79 | 80 | } 81 | 82 | - (OCSPTestCaseReport *)reportWithParserResultAtIndex:(NSUInteger )i { 83 | 84 | OCSPTestCaseReport *report = [[OCSPTestCaseReport alloc] init]; 85 | 86 | report.name = [self.parser testNameForTestCaseAtIndex:i]; 87 | 88 | report.passed = [self.parser testResultForTestCaseAtIndex:i]; 89 | 90 | NSString *message = [self errorMessageForTestCaseReportAtIndex:i]; 91 | 92 | report.errorMessage = message; 93 | 94 | return report; 95 | } 96 | 97 | - (NSString *)errorMessageForTestCaseReportAtIndex:(NSUInteger )index { 98 | 99 | NSString *testPageErrorMessage = [self.parser testErrorMessageForTestCaseAtIndex:index]; 100 | 101 | NSString *message = [OCSPLocalizedMessageTable localizedTestPageMessageWithUnderlyingMessage:testPageErrorMessage]; 102 | 103 | return message; 104 | 105 | } 106 | 107 | #pragma mark - Exception As Failing Test Reports 108 | 109 | - (void)appendExceptionReportTestCases:(NSMutableArray *) reports { 110 | 111 | OCSPTestCaseReport *reportingTestCase = nil; 112 | 113 | NSString *message = nil; 114 | 115 | if ( self.parser.parseErrorOccured == YES ) { 116 | 117 | reportingTestCase = [[OCSPTestCaseReport alloc] initWithTestCaseName:@"TestSuiteReportXMLParsingSucceeded" result:NO]; 118 | 119 | message = [OCSPLocalizedMessageTable localizedTestSuiteParsingErrorMessage]; 120 | 121 | } else if ( self.parser.parsingSucceeded == NO) { 122 | 123 | reportingTestCase = [[OCSPTestCaseReport alloc] initWithTestCaseName:@"TestSuiteReportDataExists" result:NO]; 124 | 125 | message = [OCSPLocalizedMessageTable localizedTestSuiteReportDataNotFound]; 126 | 127 | } else if ( [self testSuiteIsEmpty] ) { 128 | 129 | NSString *testCaseName = [NSString stringWithFormat:@"%@TestCaseCountGreaterThanZero", [self.parser testSuiteName]]; 130 | 131 | reportingTestCase = [[OCSPTestCaseReport alloc] initWithTestCaseName:testCaseName result:NO]; 132 | 133 | message = [OCSPLocalizedMessageTable localizedEmptyTestSuiteMessageWithSuiteName:[self.parser testSuiteName]]; 134 | 135 | } else if ( [self testSuiteFailedToRun] ) { 136 | 137 | NSString *testCaseName = [NSString stringWithFormat:@"%@ErrorCountEqualsZero", [self.parser testSuiteName]]; 138 | 139 | reportingTestCase = [[OCSPTestCaseReport alloc] initWithTestCaseName:testCaseName result:NO]; 140 | 141 | message = [OCSPLocalizedMessageTable localizedTestSuiteErrorsOccurredMessageWithCount:self.parser.testSuiteErrorCount]; 142 | 143 | } 144 | 145 | 146 | 147 | 148 | if ( reportingTestCase ) { 149 | 150 | [reportingTestCase setErrorMessage:message]; 151 | 152 | [reports addObject:reportingTestCase]; 153 | 154 | } 155 | 156 | } 157 | 158 | - (BOOL)testSuiteIsEmpty { 159 | 160 | return self.parser.parsingSucceeded == YES && self.parser.testCaseCount == 0 && self.parser.testSuiteErrorCount == 0; 161 | 162 | } 163 | 164 | - (BOOL)testSuiteFailedToRun { 165 | 166 | BOOL errorsOccuredOutsideOfTests = self.parser.testSuiteErrorCount > self.parser.testCaseCount; 167 | 168 | return self.parser.parsingSucceeded == YES && errorsOccuredOutsideOfTests; 169 | 170 | } 171 | 172 | 173 | #pragma mark - Xcode/XCTool Fixes 174 | 175 | 176 | - (void)appendDisappearingTestCaseUIFixWithReports:(NSMutableArray*)testCaseReports { 177 | 178 | if (!self.xcodeFixDisappearingTestCaseByAppendingDummyTest) { 179 | 180 | [testCaseReports addObject:[self tearDownTestCaseReport]]; 181 | 182 | } 183 | 184 | } 185 | 186 | - (void)updateReportWithXCToolCompatibleName:(OCSPTestCaseReport *)report { 187 | 188 | if (!self.xctoolCompatibilityDisabled) { 189 | 190 | report.name = [report.name stringByReplacingOccurrencesOfString:@"." withString:@"_"]; 191 | } 192 | 193 | } 194 | 195 | @end 196 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestReportCenterTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "OCSPTestReportCenter.h" 3 | 4 | #import "OCSPTestReportReader.h" 5 | #import "OCSPJUnitXMLParser.h" 6 | 7 | #import "OCSPTestDataManager.h" 8 | #import "OCSPTestCaseReport.h" 9 | #import "OCSPLocalizedMessageTable.h" 10 | 11 | 12 | @interface OCSPTestReportCenterTests : XCTestCase 13 | 14 | @property (nonatomic, strong) OCSPTestReportCenter *center; 15 | 16 | @end 17 | 18 | @implementation OCSPTestReportCenterTests 19 | 20 | 21 | - (void)setUp { 22 | 23 | self.center = [[OCSPTestReportCenter alloc] init]; 24 | 25 | self.center.xcodeFixDisappearingTestCaseByAppendingDummyTest = YES; 26 | 27 | self.center.xctoolCompatibilityDisabled = YES; 28 | 29 | } 30 | 31 | 32 | - (void)testTestCasesReportsAreUsingDefaultTestReportData { 33 | 34 | NSUInteger count = self.center.testCaseReports.count; 35 | 36 | NSData *data = [[OCSPTestReportReader defaultReader] read]; 37 | 38 | OCSPJUnitXMLParser *parser = [[OCSPJUnitXMLParser alloc] initWithXMLData:data]; 39 | 40 | [parser parse]; 41 | 42 | XCTAssertEqual(count, [parser testCaseCount]); 43 | 44 | } 45 | 46 | - (void)testSuiteName { 47 | 48 | (void) [[self class] stubSuccessfulTestReport]; 49 | 50 | XCTAssertEqualObjects([self.center testSuiteName], @"OCSlimProjectExampleSuite"); 51 | 52 | } 53 | 54 | - (void)testTestCaseReportName { 55 | 56 | (void) [[self class] stubSuccessfulTestReport]; 57 | 58 | OCSPTestCaseReport *report = [self acceptanceTestCaseReport]; 59 | 60 | XCTAssertEqualObjects(report.name, @"OCSlimProjectExampleSuite.TestPage0"); 61 | } 62 | 63 | 64 | - (void)testTestCaseReportNameReplacesDotsXCToolCompatibility { 65 | 66 | (void) [[self class] stubSuccessfulTestReport]; 67 | 68 | self.center.xctoolCompatibilityDisabled = NO; 69 | 70 | OCSPTestCaseReport *report = [self acceptanceTestCaseReport]; 71 | 72 | XCTAssertEqualObjects(report.name, @"OCSlimProjectExampleSuite_TestPage0"); 73 | } 74 | 75 | 76 | - (void)testTestReportResultsSuccess { 77 | 78 | (void) [[self class] stubSuccessfulTestReport]; 79 | 80 | OCSPTestCaseReport *report = [self acceptanceTestCaseReport]; 81 | 82 | XCTAssertTrue(report.passed); 83 | 84 | } 85 | 86 | - (void)testTestReportResultsFail { 87 | 88 | (void) [[self class] stubFailedTestReport]; 89 | 90 | OCSPTestCaseReport *report = [self acceptanceTestCaseReport]; 91 | 92 | XCTAssertFalse(report.passed); 93 | 94 | } 95 | 96 | - (void)testFailingTestCaseReportNonNilErrorMessage { 97 | 98 | (void) [[self class] stubFailedTestReport]; 99 | 100 | OCSPTestCaseReport *report = [self acceptanceTestCaseReport]; 101 | 102 | XCTAssertNotNil(report.errorMessage); 103 | } 104 | 105 | - (void)testFailingTestCaseReportErrorMessage { 106 | 107 | (void) [[self class] stubFailedTestReport]; 108 | 109 | OCSPTestCaseReport *report = [self acceptanceTestCaseReport]; 110 | 111 | XCTAssertEqualObjects([OCSPLocalizedMessageTable localizedTestPageMessageWithUnderlyingMessage:@"1 errors"], report.errorMessage); 112 | } 113 | 114 | - (void)testTestReportsAddsExtraTest { 115 | 116 | (void) [[self class] stubFailedTestReport]; 117 | 118 | self.center.xcodeFixDisappearingTestCaseByAppendingDummyTest = NO; 119 | 120 | NSArray *reports = [self.center testCaseReports]; 121 | 122 | OCSPTestCaseReport *lastTestReport = reports.lastObject; 123 | 124 | XCTAssertEqual(reports.count, 2); 125 | 126 | XCTAssertTrue(lastTestReport.passed); 127 | 128 | XCTAssertEqualObjects(lastTestReport.name, @"tearDown"); 129 | 130 | } 131 | 132 | #pragma mark - Test Report Tests 133 | 134 | - (void)testNumberOfTestCaseReports { 135 | 136 | (void) [[self class] stubSuccessfulTestReport]; 137 | 138 | NSArray *results = [self.center testCaseReports]; 139 | 140 | XCTAssertEqual(results.count, 1); 141 | 142 | } 143 | 144 | - (void)testNumberOfTestCaseReportsWithOtherTestReportData { 145 | 146 | (void) [[self class] stubSuccessfulTestReportWithFilenameModifier:@"3"]; 147 | 148 | NSArray *results = [self.center testCaseReports]; 149 | 150 | XCTAssertEqual(results.count, 3); 151 | } 152 | 153 | #pragma mark - Test Helpers 154 | 155 | - (OCSPTestCaseReport *)acceptanceTestCaseReport { 156 | 157 | return [[self.center testCaseReports] firstObject]; 158 | } 159 | 160 | //- (void)testStubCreatesTestReportsWithData { 161 | // 162 | // NSData *data = [[self class] stubSuccessfulTestReport]; 163 | // 164 | // XCTAssertTrue( [[[OCSPTestReportReader defaultReader] read] isEqualToData:data]); 165 | // 166 | //} 167 | 168 | + (NSData* )stubSuccessfulTestReport { 169 | 170 | return [self stubSuccessfulTestReportWithFilenameModifier:nil]; 171 | } 172 | 173 | + (NSData* )stubFailedTestReport { 174 | 175 | return [self stubFailedTestReportWithFilenameModifier:nil]; 176 | 177 | } 178 | // 179 | //+ (NSData* )stubErrorTestReport { 180 | // 181 | // NSData *data = [OCSPTestDataManager errorResultData]; 182 | // 183 | // return [self stubTestReportWithData:data]; 184 | // 185 | //} 186 | // 187 | + (NSData* )stubSuccessfulTestReportWithFilenameModifier:(NSString*)modifier { 188 | 189 | NSData *data = [OCSPTestDataManager successResultDataByAppendingHyphenatedFilenameModifier:modifier]; 190 | 191 | return [self stubTestReportWithData:data]; 192 | 193 | } 194 | // 195 | + (NSData* )stubFailedTestReportWithFilenameModifier:(NSString*)modifier { 196 | 197 | NSData *data = [OCSPTestDataManager failedResultDataByAppendingHyphenatedFilenameModifier:modifier]; 198 | 199 | return [self stubTestReportWithData:data]; 200 | 201 | } 202 | 203 | + (NSData *)stubTestReportWithData:(NSData*)data { 204 | 205 | NSParameterAssert(data); 206 | 207 | createDefaultTestReportReaderWithData(data); 208 | 209 | return data; 210 | 211 | } 212 | 213 | 214 | @end 215 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestReportReader.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @protocol OCSPTestReportReader 4 | 5 | - (NSData * _Nonnull) read; 6 | 7 | @end 8 | 9 | 10 | @interface OCSPTestReportReader : NSObject 11 | 12 | + (id _Nonnull) defaultReader; 13 | 14 | + (void)setDefaultReader:(id _Nonnull)reader; 15 | 16 | @end 17 | 18 | 19 | /// OCSlimFitnesseTestReportFileReaderTests /// 20 | 21 | @interface OCSPTestReportFileReader : NSObject 22 | 23 | @end -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestReportReader.m: -------------------------------------------------------------------------------- 1 | #import "OCSPTestReportReader.h" 2 | 3 | @implementation OCSPTestReportFileReader 4 | 5 | - (NSData *) read { 6 | 7 | NSString *fitnesseTestReportResourceName = @"Fitnesse-Test-Report"; 8 | 9 | NSBundle *bundle = [NSBundle bundleForClass:[self class]]; 10 | 11 | NSString *path = [bundle pathForResource:fitnesseTestReportResourceName ofType:@"xml"]; 12 | 13 | if (path == nil ) { 14 | 15 | NSLog(@"[OCSP] ERROR: Could not read data : The file \"%@.xml\" couldn’t be opened because there is no such file: Check your 'OCSlimProject' Acceptance Test target is being built. 1) Try running 'pod update' to resolve this issue. 2) Manually run Acceptance Tests using '$ ./LaunchFitnesse' located at your projects root directory and investigate any issues.", fitnesseTestReportResourceName, nil); 16 | 17 | } 18 | 19 | return [NSData dataWithContentsOfFile:path]; 20 | 21 | } 22 | 23 | @end 24 | 25 | 26 | /// OCSPTestReportReader /// 27 | 28 | @implementation OCSPTestReportReader 29 | 30 | static id _defaultReader; 31 | 32 | + (id)defaultReader { 33 | 34 | return _defaultReader; 35 | 36 | } 37 | 38 | + (void)initialize { 39 | 40 | _defaultReader = [[OCSPTestReportFileReader alloc] init]; 41 | 42 | } 43 | 44 | + (void)setDefaultReader:(id)reader { 45 | 46 | _defaultReader = reader; 47 | 48 | } 49 | 50 | 51 | @end 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestReportReaderTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "OCSPTestReportReader.h" 3 | #import "OCSPTestDataManager.h" 4 | #import "OCSPTestReportReader.h" 5 | 6 | @interface OCSPTestReportReaderTests : XCTestCase 7 | 8 | @property (nonatomic, strong) OCSPTestReportFileReader* reader; 9 | @end 10 | 11 | @implementation OCSPTestReportReaderTests 12 | 13 | - (void)setUp { 14 | [super setUp]; 15 | 16 | self.reader = [[OCSPTestReportFileReader alloc] init]; 17 | 18 | } 19 | 20 | - (void)tearDown { 21 | 22 | self.reader = nil; 23 | 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testFitnesseReportFileDataExists { 28 | 29 | XCTAssertNotNil([OCSPTestDataManager fitnesseTestReportData]); 30 | 31 | } 32 | - (void) testReaderDataEqualsFitnesseReportFileData { 33 | 34 | NSData *data = [OCSPTestDataManager fitnesseTestReportData]; 35 | 36 | NSData *readData = [self.reader read]; 37 | 38 | XCTAssertTrue([data isEqualToData:readData]); 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestSuite.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @protocol OCSPAssertRecorder; 4 | 5 | @interface OCSPTestSuite : XCTestCase 6 | 7 | @property (nonatomic, readonly, getter=isPass) BOOL testResult; 8 | 9 | @property (nonatomic, strong, nullable) NSString * errorMessage; 10 | 11 | - (nonnull id)initWithTestCaseName:(nonnull NSString *)name result:(BOOL)result; 12 | 13 | - (nonnull id)initWithTestCaseName:(nonnull NSString *)name result:(BOOL)result assertRecorder:(nonnull id)recorder; 14 | 15 | - (nonnull NSString *)testCaseName; 16 | 17 | - (void)run; 18 | 19 | @end 20 | 21 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestSuite.m: -------------------------------------------------------------------------------- 1 | #import "OCSPTestSuite.h" 2 | #import "OCSPAssertRecorder.h" 3 | #import "OCSPJUnitXMLParser.h" 4 | #import "OCSPPrincipalTestObserver.h" 5 | #import "OCSPTestCaseReport.h" 6 | #import "OCSPTestReportCenter.h" 7 | 8 | @interface OCSPTestSuite () 9 | @property (nonatomic, strong) NSString *testName; 10 | @property (nonatomic, assign) BOOL testResult; 11 | @end 12 | 13 | @implementation OCSPTestSuite 14 | 15 | - (id)initWithTestCaseName:(NSString *)name result:(BOOL)result { 16 | 17 | id recorder = [[OCSPXCAssertRecorder alloc] init]; 18 | 19 | return [self initWithTestCaseName:name result:result assertRecorder:recorder]; 20 | } 21 | 22 | 23 | - (nonnull id)initWithTestCaseName:(nonnull NSString *)name result:(BOOL)result assertRecorder:(nonnull id)recorder { 24 | 25 | if (self == [super initWithSelector:NSSelectorFromString(name)] ) { 26 | 27 | _testName = name; 28 | 29 | _testResult = result; 30 | 31 | } 32 | 33 | return self; 34 | } 35 | 36 | - (void)run { 37 | 38 | 39 | if ( ![self isPass] ) { 40 | 41 | NSString *message = (self.errorMessage) ? self.errorMessage : @"Unspecified Acceptance Test Failure"; 42 | 43 | [[[self class] assertRecorder] recordFailWithTestCase:self message:message]; 44 | 45 | } else { 46 | 47 | [[[self class] assertRecorder] recordPassWithTestCase:self]; 48 | 49 | } 50 | } 51 | 52 | - (NSString *)testCaseName { 53 | 54 | NSString *name = [[self name] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"[]"]]; 55 | 56 | return [[name componentsSeparatedByString:@" "] lastObject]; 57 | 58 | } 59 | 60 | #pragma mark - Arbitrary Test Name Forwarding Mechanism 61 | 62 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector { 63 | 64 | if ([self respondsToSelector:aSelector]) { 65 | return [[self class] instanceMethodSignatureForSelector:aSelector]; 66 | } else { 67 | return [super methodSignatureForSelector:@selector(run)]; 68 | } 69 | 70 | } 71 | 72 | - (void)forwardInvocation:(NSInvocation *)anInvocation { 73 | 74 | // if (self.testName == nil) { 75 | // 76 | // self.testName = NSStringFromSelector(anInvocation.selector); 77 | // 78 | // NSArray *values = results[self.testName]; 79 | // 80 | // self.testResult = [values[0] boolValue]; 81 | // 82 | // self.errorMessage = (NSString*) values[1]; 83 | // 84 | // self.assertRecorder = (OCSPAssertRecorder*) values[2]; 85 | // 86 | // } 87 | // 88 | 89 | self.testName = NSStringFromSelector(anInvocation.selector); 90 | 91 | OCSPTestCaseReport *associatedReport = reports[self.testName]; 92 | 93 | self.testResult = associatedReport.passed; 94 | 95 | self.errorMessage = associatedReport.errorMessage; 96 | 97 | // if ( anInvocation.selector == NSSelectorFromString(self.testName) ) { 98 | 99 | anInvocation.selector = @selector(run); 100 | 101 | // } 102 | 103 | [anInvocation invokeWithTarget:self]; 104 | 105 | } 106 | 107 | #pragma mark -- Experimental Dev 108 | 109 | static NSMutableDictionary *reports; 110 | 111 | + (void)initialize { 112 | 113 | [super initialize]; 114 | 115 | } 116 | 117 | + (NSArray *)testInvocations { 118 | 119 | reports = [[NSMutableDictionary alloc] init]; 120 | 121 | NSMutableArray *invocations = [[NSMutableArray alloc] init]; 122 | 123 | [[[self reportCenter] testCaseReports] enumerateObjectsUsingBlock:^(OCSPTestCaseReport * _Nonnull report, NSUInteger idx, BOOL * _Nonnull stop) { 124 | 125 | NSInvocation *invocation = [self invocationForTestCaseReport:report]; 126 | 127 | [invocations addObject:invocation]; 128 | 129 | reports[NSStringFromSelector(invocation.selector)] = report; 130 | 131 | }]; 132 | 133 | return [NSArray arrayWithArray:invocations]; 134 | } 135 | 136 | + (NSInvocation *)invocationForTestCaseReport:(OCSPTestCaseReport *)report { 137 | 138 | SEL selector = NSSelectorFromString(report.name); 139 | 140 | // NSMethodSignature *dummySig = [self instanceMethodSignatureForSelector:@selector(dummyTest)]; 141 | 142 | NSMethodSignature *signature = [NSMethodSignature signatureWithObjCTypes:"v@:"]; 143 | 144 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; 145 | 146 | invocation.selector = selector; 147 | 148 | return invocation; 149 | 150 | } 151 | 152 | + (OCSPTestReportCenter *) reportCenter { 153 | 154 | static OCSPTestReportCenter *reportCenter = nil; 155 | 156 | if (nil == reportCenter) { 157 | 158 | reportCenter = [[OCSPTestReportCenter alloc] init]; 159 | 160 | } 161 | 162 | return reportCenter; 163 | } 164 | 165 | + (id)assertRecorder { 166 | 167 | static id assertRecorder = nil; 168 | 169 | if (nil == assertRecorder) { 170 | 171 | assertRecorder = [[OCSPXCAssertRecorder alloc] init]; 172 | 173 | } 174 | 175 | return assertRecorder; 176 | } 177 | 178 | @end 179 | 180 | 181 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestSuiteTestable.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "OCSPTestSuite.h" 3 | 4 | @class OCSPAssertRecorderSpy; 5 | 6 | @interface OCSPTestSuiteTestable : OCSPTestSuite 7 | 8 | + (OCSPAssertRecorderSpy *)assertRecorder; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestSuiteTestable.m: -------------------------------------------------------------------------------- 1 | #import "OCSPTestSuiteTestable.h" 2 | #import "OCSPPrincipalTestObserver.h" 3 | #import "OCSPAssertRecorder.h" 4 | #import "OCSPTestReportCenter.h" 5 | 6 | @implementation OCSPTestSuiteTestable 7 | 8 | + (OCSPAssertRecorderSpy *)assertRecorder { 9 | 10 | static OCSPAssertRecorderSpy *assertRecorderSpy = nil; 11 | 12 | if (assertRecorderSpy == nil) { 13 | 14 | assertRecorderSpy = [[OCSPAssertRecorderSpy alloc] init]; 15 | 16 | } else { 17 | 18 | assertRecorderSpy.didRecordPass = NO; 19 | assertRecorderSpy.didRecordFail = NO; 20 | 21 | } 22 | 23 | return assertRecorderSpy; 24 | 25 | } 26 | 27 | + (OCSPTestReportCenter *) reportCenter { 28 | 29 | OCSPTestReportCenter *center = [[OCSPTestReportCenter alloc] init]; 30 | 31 | center.xcodeFixDisappearingTestCaseByAppendingDummyTest = YES; 32 | 33 | return center; 34 | 35 | } 36 | 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Pod/TestClasses/OCSPTestSuiteTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "OCSPTestSuiteTestable.h" 3 | #import "OCSPAssertRecorder.h" 4 | #import "OCSPTestDataManager.h" 5 | #import "OCSPLocalizedMessageTable.h" 6 | 7 | @interface OCSPTestSuiteTests : XCTestCase 8 | @property (nonatomic, strong) OCSPAssertRecorderSpy *recorderSpy; 9 | @end 10 | 11 | @implementation OCSPTestSuiteTests 12 | 13 | - (void)setUp { 14 | 15 | self.recorderSpy = [OCSPTestSuiteTestable assertRecorder]; 16 | 17 | } 18 | 19 | - (void)tearDown { 20 | 21 | self.recorderSpy = nil; 22 | 23 | } 24 | 25 | - (void)testResultForXMLDataWithZeroFailures { 26 | 27 | [self runAsserterWithResult:YES]; 28 | 29 | XCTAssertFalse(self.recorderSpy.didRecordFail); 30 | XCTAssertTrue(self.recorderSpy.didRecordPass); 31 | 32 | } 33 | 34 | - (void)testResultForXMLDataWithFailures { 35 | 36 | [self runAsserterWithResult:NO]; 37 | 38 | XCTAssertFalse(self.recorderSpy.didRecordPass); 39 | XCTAssertTrue(self.recorderSpy.didRecordFail); 40 | 41 | } 42 | 43 | - (void)testNilErrorMessageForFailureResult { 44 | 45 | OCSPTestSuite *asserter = [[OCSPTestSuiteTestable alloc] initWithTestCaseName:@"" result:NO assertRecorder:self.recorderSpy]; 46 | 47 | [asserter run]; 48 | 49 | XCTAssertEqualObjects(self.recorderSpy.didRecordFailMessage, @"Unspecified Acceptance Test Failure"); 50 | } 51 | 52 | 53 | - (void)testGivenErrorMessageForFailureResult { 54 | 55 | OCSPTestSuite *asserter = [[OCSPTestSuiteTestable alloc] initWithTestCaseName:@"" result:NO assertRecorder:self.recorderSpy]; 56 | 57 | asserter.errorMessage = @"ERROR"; 58 | 59 | [asserter run]; 60 | 61 | XCTAssertEqualObjects(self.recorderSpy.didRecordFailMessage, @"ERROR"); 62 | } 63 | 64 | - (void)testInvocationWillRunAssertions { 65 | 66 | OCSPTestSuite *asserter = [[OCSPTestSuiteTestable alloc] initWithTestCaseName:@"" result:NO assertRecorder:self.recorderSpy]; 67 | 68 | [asserter forwardInvocation:asserter.invocation]; 69 | 70 | XCTAssertEqual(asserter.invocation.selector, @selector(run)); 71 | 72 | } 73 | 74 | - (void)testInvocationRunsAssertion { 75 | 76 | OCSPTestSuite *asserter = [[OCSPTestSuiteTestable alloc] initWithTestCaseName:@"AnyTestName" result:NO assertRecorder:self.recorderSpy]; 77 | 78 | [asserter.invocation invokeWithTarget:asserter]; 79 | 80 | XCTAssertTrue(self.recorderSpy.didRecordFail); 81 | 82 | } 83 | 84 | - (void)testSelectorMethodNameEqualsTestCaseName { 85 | 86 | OCSPTestSuite *asserter = [[OCSPTestSuite alloc] initWithTestCaseName:@"Salami" result:NO]; 87 | 88 | XCTAssertEqualObjects(NSStringFromSelector(asserter.invocation.selector), @"Salami"); 89 | 90 | 91 | } 92 | 93 | - (void)testInitWithFailedResult { 94 | 95 | OCSPTestSuite *testCase = [[OCSPTestSuiteTestable alloc] initWithTestCaseName:@"" result:NO assertRecorder:self.recorderSpy]; 96 | 97 | [testCase run]; 98 | 99 | XCTAssertTrue(self.recorderSpy.didRecordFail); 100 | } 101 | 102 | - (void)testInitWithSuccessResult { 103 | 104 | OCSPTestSuite *testCase = [[OCSPTestSuiteTestable alloc] initWithTestCaseName:@"" result:YES assertRecorder:self.recorderSpy]; 105 | 106 | [testCase run]; 107 | 108 | XCTAssertTrue(self.recorderSpy.didRecordPass); 109 | } 110 | 111 | - (void)testInitWithTestCaseName { 112 | 113 | OCSPTestSuite *testCase = [[OCSPTestSuite alloc] initWithTestCaseName:@"TestPage0" result:NO]; 114 | 115 | XCTAssertTrue([[testCase name] containsString:@"TestPage0"]); 116 | 117 | XCTAssertEqualObjects([testCase testCaseName], @"TestPage0"); 118 | } 119 | 120 | #pragma mark - Test Invocations Tests 121 | 122 | - (void)testInvocationsCountEqualsNumberOfResults { 123 | 124 | NSData *data = [OCSPTestDataManager successResultData]; 125 | 126 | createDefaultTestReportReaderWithData(data); 127 | 128 | NSArray *invocations = [OCSPTestSuiteTestable testInvocations]; 129 | 130 | XCTAssertEqual(invocations.count, 1); 131 | 132 | } 133 | 134 | - (void)testInvocationsCountEqualsNumberOfResultsWithOtherReportData { 135 | 136 | NSData *data = [OCSPTestDataManager successResultDataByAppendingHyphenatedFilenameModifier:@"3"]; 137 | 138 | createDefaultTestReportReaderWithData(data); 139 | 140 | NSArray *invocations = [OCSPTestSuiteTestable testInvocations]; 141 | 142 | XCTAssertEqual(invocations.count, 3); 143 | } 144 | 145 | - (void)testInvocationSelectorNameEqualsPageName { 146 | 147 | NSData *data = [OCSPTestDataManager successResultData]; 148 | 149 | createDefaultTestReportReaderWithData(data); 150 | 151 | NSInvocation *inv = [[OCSPTestSuiteTestable testInvocations] firstObject]; 152 | 153 | XCTAssertEqualObjects(NSStringFromSelector(inv.selector), @"OCSlimProjectExampleSuite_TestPage0"); 154 | } 155 | 156 | - (void)testForwardInvocationForSuccessReport { 157 | 158 | NSData *data = [OCSPTestDataManager successResultData]; 159 | 160 | createDefaultTestReportReaderWithData(data); 161 | 162 | [self runInvocation]; 163 | 164 | XCTAssertTrue(self.recorderSpy.didRecordPass); 165 | 166 | } 167 | 168 | - (void)testForwardInvocationForFailReport { 169 | 170 | NSData *data = [OCSPTestDataManager failedResultData]; 171 | 172 | createDefaultTestReportReaderWithData(data); 173 | 174 | [self runInvocation]; 175 | 176 | XCTAssertTrue(self.recorderSpy.didRecordFail); 177 | 178 | } 179 | 180 | - (void)testGivenErrorMessageForFailureReport{ 181 | 182 | NSData *data = [OCSPTestDataManager failedResultData]; 183 | 184 | createDefaultTestReportReaderWithData(data); 185 | 186 | [self runInvocation]; 187 | 188 | XCTAssertEqualObjects(self.recorderSpy.didRecordFailMessage, [OCSPLocalizedMessageTable localizedTestPageMessageWithUnderlyingMessage:@"1 errors"]); 189 | } 190 | 191 | #pragma mark - Test Automators 192 | 193 | - (void)runAsserterWithResult:(BOOL)result { 194 | 195 | OCSPTestSuite *testSuite = [[OCSPTestSuiteTestable alloc] initWithTestCaseName:@"" result:result assertRecorder:self.recorderSpy]; 196 | 197 | [testSuite run]; 198 | 199 | } 200 | 201 | - (void)runInvocation { 202 | 203 | NSInvocation *inv = [[OCSPTestSuiteTestable testInvocations] firstObject]; 204 | 205 | OCSPTestSuiteTestable *testCase = [OCSPTestSuiteTestable testCaseWithInvocation:inv]; 206 | 207 | [testCase forwardInvocation:inv]; 208 | } 209 | 210 | @end 211 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | `


OCSlimProject

2 | 3 | ### OCSlimProject is a CocoaPod for iOS and macOS that lets you create *fast*, *rock-solid*, *automated* *Acceptance Tests* with Xcode and Fitnesse. 4 | 5 | ### [Fitnesse](http://fitnesse.org) is a powerful and fully integrated standalone wiki and acceptance testing framework. It is designed for ATDD and BDD style software development. 6 | 7 | #### Why use Fitnesse? 8 | 9 | > "FitNesse is a tool for specifying and verifying application acceptance criteria (requirements). It acts as a bridge between the different stakeholders (disciplines) in a software delivery process. It's wiki server makes it easy to document the software.It's test execution capabilities allow you to verify the documentation against the software, ensuring the documentation remains up to date and the software is not facing regression." - [Fitnesse User Guide](http://fitnesse.org/FitNesse.UserGuide) 10 | 11 | --- 12 | 13 | [![CI Status](http://img.shields.io/travis/paulstringer/OCSlimProject.svg?style=flat)](https://travis-ci.org/paulstringer/OCSlimProject) 14 | [![Version](https://img.shields.io/cocoapods/v/OCSlimProject.svg?style=flat)](http://cocoapods.org/pods/OCSlimProject) 15 | [![License](https://img.shields.io/cocoapods/l/OCSlimProject.svg?style=flat)](http://cocoapods.org/pods/OCSlimProject) 16 | [![Platform](https://img.shields.io/cocoapods/p/OCSlimProject.svg?style=flat)](http://cocoapods.org/pods/OCSlimProject) 17 | 18 | ### Usage 19 | To run the example: 20 | 21 | * Clone the repo, and run `pod install` in the Example directory. 22 | * Open OCSlimProject.xcworkspace to see examples of both Mac and iOS Acceptance Tests integrated with a vanilla Xcode project. 23 | 24 | ### Requirements 25 | - Xcode 7 26 | - CocoaPods 27 | - [Java 1.8](http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html) (required for Fitnesse) 28 | 29 | ## How it Works 30 | OCSlimProject works by creating a seperate target of your app. This *'Acceptance Tests'* target is one that contains your apps business logic code (the 'System Under Test') + simple *fixtures* . 31 | 32 | Fixtures are glue code you write in Swift or Obj-C that provide a thin wrapper around your App's business logic. This is the integration point between your App's code and Fitnesse. Think of Fitnesse as an alternative UI for using your App. As such fixtures (just like View Controllers) should be nothing more than very simple classes that delegate calls to and from your business logic code. 33 | 34 | **Architecture of an Acceptance Testing App compared with a regular App** 35 | 36 | ![Fitnesse App Architecture Diagram](Images/Fitnesse-App-Architecture-Diagram.jpeg) 37 | 38 | Fitnesse communicates with your App using a communications protocol called [Slim](http://fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.SlimProtocol) (Simple List Invocation Method). The work of implementing this protocol is provided via the [cslim project](https://github.com/dougbradbury/cslim) which contains an [Objective-C](https://github.com/ericmeyer/ObjectiveCSlim) implementation written by Erik Myer. When choosing to write fixture with Swift it's required that your fixtures are subclasses of NSObject. 39 | 40 | ---- 41 | 42 | # Get Started 43 | 44 | ### OCSlimProject is available to your projects through [CocoaPods](https://cocoapods.org/?q=OCSlim). It is designed to be integrated through Xcode Templates. These templates encapsulate the work of integrating your App with Fitnesse. 45 | 46 | ## 1. Install the Templates 47 | 48 | * Download [OCSlimProjectXcodeTemplates](https://github.com/paulstringer/OCSlimProjectXcodeTemplates) from GitHub and run *make* 49 | 50 | ``` 51 | $ git clone https://github.com/paulstringer/OCSlimProjectXcodeTemplates.git 52 | $ cd OCSlimProjectXcodeTemplates 53 | $ make 54 | ``` 55 | 56 | This adds the Xcode project templates for creating Acceptance Test targets for iOS & macOS. These are installed at *~/Library/Developer/Xcode/Templates/Test*. 57 | 58 | * Navigate to the *'Test'* section of Xcode's *'New Target'* setup. In both iOS and macOS you will see two new types of testing target: 59 | * Acceptance Tests 60 | 61 | > This target builds an iOS/macOS Application for Acceptance Testing your App using the Fitnesse framework. Requires a project that uses CocoaPods. 62 | 63 | * Acceptance Unit Tests Bundle 64 | 65 | > This target builds an iOS/macOS unit test bundle that generates results from your Acceptance Tests target using Fitnesse and then reports them within Xcode as XCTest results. 66 | 67 | ## 2. Add an 'Acceptance Tests' Targets to your Project 68 | 69 | ### Creating an 'Acceptance Tests' target is the next step. After following this step your ready to begin writing acceptance tests. 70 | 71 | ![iOS Acceptance Tests Template](Images/iOS-Acceptance-Test-Template.png) 72 | 73 | * Add an 'AcceptanceTests' target to your Project using the 'Acceptance Tests' template. Templates are available for both iOS and macOS. macOS targets run faster, iOS targets allow you to use classes with dependancies on UIKit. 74 | 75 | * Using CocoaPods link OCSlimProject to your 'AcceptanceTests' target with the following Podfile entry 76 | 77 | If it's a new project first run 78 | 79 | ```pod init``` 80 | 81 | then add to your podfile 82 | 83 | ``` 84 | target 'AcceptanceTests' do 85 | platform :ios, 9.0 86 | pod 'OCSlimProject' 87 | end 88 | ``` 89 | 90 | * Run either ```pod install``` or ```pod update``` as necessary 91 | 92 | * Open the Project's Workspace generated by CocoaPods 93 | 94 | * Build the 'AcceptanceTests' target to generate the App (repeat this after code changes) 95 | 96 | * Launch Fitnesse by running the script ```./LaunchFitnesse``` in your project's root directory 97 | 98 | * Follow the prompt to download [Java 1.8](http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html) if needed. 99 | 100 | * Now with Fitnesse running, check out the [example](http://localhost:8080/OCSlimProjectExamplePage) and run the tests 101 | 102 | ## 3. Develop rock-solid, blazing fast Acceptance Tests! 103 | 104 | ### You're now ready and setup to begin developing rock-solid, blazing fast, automated Acceptance tests for iOS and macOS apps. 105 | 106 | * For a very basic introduction follow this [step by step tutorial](https://stringers-theory.ghost.io/acceptance-testing-with-ios/) introducing writing an example App with Acceptance Tests. 107 | 108 | * Check out the example projects 109 | - [TicTacToe](https://github.com/paulstringer/TicTacToe) 110 | - [CosyHome](https://github.com/paulstringer/CosyHome) 111 | - [RemixStarBrowser](https://github.com/dcutting/RemixStarBrowser) via @dcutting 112 | 113 | * For an example of 114 | 115 | * For more in depth tutorials on developing software using BDD and Fitnesse checkout the following [Clean Coder video tutorials](https://cleancoders.com/videos/clean-code/bdd). 116 | 117 | --- 118 | 119 | # Integration with XCTest 120 | 121 | ### OCSlimProject integrates seamlessly into your development and CI worfklows by supporting XCTest. Run and see reports of your Fitnesse Acceptance Test results right within Xcode or with xcodebuild. 122 | 123 | ![iOS Acceptance Unit Tests Template](Images/iOS-Acceptance-Unit-Test-Template.png) 124 | 125 | * Complete the steps in the previous example to create an Acceptance Test target 126 | 127 | * Add an 'AcceptanceUnitTests' target to your Project using the 'Acceptance Unit Test Bundle' template*. 128 | 129 | *The template you initially chose should match the platform of the Acceptance Test target. E.g. if you have an iOS Acceptance Tests app, use the iOS Acceptance Unit Test Bundle* 130 | 131 | * Enter 'OCSlimProjectExamplePage' as the 'Fitnesse Suite Page Name' in the project settings. 132 | 133 | * Edit your Podfile and add the following Podfile entry 134 | 135 | ``` 136 | target 'AcceptanceUnitTests' do 137 | platform :ios, 9.0 138 | pod 'OCSlimProjectTestBundleSupport' 139 | end 140 | ``` 141 | * Run ```pod update``` 142 | 143 | * **IMPORTANT** Add your 'AcceptanceTests' target as a 'Target Dependancy' of this new target in Build Phases. This ensures that the latest code has been built prior to the tests being run. 144 | 145 | * Hit CMD-U and verify your Acceptance Tests run and display the same results seen when running in Fitnesse. 146 | 147 | ### Finally 148 | 149 | * Add the 'AcceptanceUnitTest' target to the test phase of any schemes where you want the Acceptance Tests to be run as part of your develop and test workflow. E.g. Add 'AcceptanceUnitTest' to the test phase of your main apps target. This will then run acceptance tests at the same time as running your regular unit tests. 150 | 151 | ### How Does It Work? 152 | 153 | An included sequence diagram (created with [Sequence Diagram for Mac](https://itunes.apple.com/us/app/sequence-diagram/id1195426709>)) provides a detailed description of what's happening under the hood. 154 | 155 | #### Some Known Issues 156 | 157 | ##### Cloud CI e.g. Travis 158 | Due to an abnormally long delay in starting a simulator from a fresh image of Xcode there is a known issue when integrating with CI systems such as Travis. (It can be assumed this likely affects other CI systems that use fresh VM images for each integration.) 159 | 160 | ##### Issues with --no-integrate 161 | Projects that use the option ```pod install --no-integrate``` are not currently supported. Check [this issue](https://github.com/paulstringer/OCSlimProject/issues/19) for details on how to resolve workaround. 162 | 163 | ``` 164 | ** CI System Script ** 165 | xcodebuild -workspace -scheme -destination 'platform=iOS Simulator,name=iPhone 6s' test 166 | 167 | ** TEST FAILED ** 168 | The command "set -o pipefail && xcodebuild -workspace -scheme -destination 'platform=iOS Simulator,name=iPhone 6s' test" exited with 65. 169 | ``` 170 | 171 | The error reveals itself as a failure when attempting to run only an iOS based 'Acceptance Unit Test Bundles' as seen in this example. Inconclusive investigations seem to point to it being the result of XCTest timing out waiting for the Build Phase responsible for generating the Fitnesse Test Results. This itself is dependant on starting the Simulator. This never completes for some unknown reason. 172 | 173 | **Workaround** 174 | 175 | A workaround is simply to run some other Unit Tests first before running your scheme. Typically this will involve just ensuring your actual Unit Tests have been run first. This seems to prepare the Simulator so that when Fitnesse comes to need it, it's ready. 176 | 177 | Check out the [Travis Configuration](.travis.ynl) of this project for an example. 178 | 179 | 180 | 181 | --- 182 | 183 | # Acknowledgements 184 | The owner of this repository takes no credit for the following included resources (except for the ones credited to the owner). This is a convienient lightweight wrapper either inspired by or using these resources together with some project glue. The aim has been to automate the process of setting up Xcode projects so as to more easily be able to use 'ocslim' and integrate with Fitnesse. 185 | 186 | ### Fitnesse 187 | Created by: Robert Martin, Micah Martin & Fitnesse.org contributors. 188 | 189 | 190 | 191 | ### OCSlim, RunTestsTargetWithSlimPort 192 | Created by: Erik Meyer, Doug Bradbury, 8th Light. 193 | 194 | 195 | 196 | 197 | 198 | ### exportenv.sh 199 | Created by: Jon Reid 200 | 201 | 202 | 203 | ### Xcode Project Templates, OCSlimProjectTestBundleSupport, LaunchFitnesse 204 | Created by: Paul Stringer 205 | 206 | 207 | 208 | ### License 209 | OCSlimProject is available under the MIT license. See the LICENSE file for more info. 210 | -------------------------------------------------------------------------------- /update_pod_testrunner_sripts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ################################################################ 4 | # DEV TOOL FOR UPDATING POD SUPPORT SCRIPTS DURING DEVELOPMENT # 5 | ################################################################ 6 | 7 | POD_SUPPORT_PATH=Pod/Support 8 | POD_LOCAL_INSTALL_SUPPORT_PATH=Example/Pods/OCSlimProject/Pod/Support 9 | 10 | 11 | # Subroutines 12 | 13 | copyFromPodSourceToLocalInstall() { 14 | copy $POD_SUPPORT_PATH $POD_LOCAL_INSTALL_SUPPORT_PATH 15 | exit 0 16 | } 17 | 18 | copyFromLocalInstallToPodSource() { 19 | copy $POD_LOCAL_INSTALL_SUPPORT_PATH $POD_SUPPORT_PATH 20 | exit 0 21 | } 22 | 23 | copy() { 24 | echo "Copying OCSlimProject Pod support files from location $1 -> $2" 25 | cp $1/iOS/* $2/iOS 26 | cp $1/OSX/* $2/OSX 27 | } 28 | 29 | # Main 30 | 31 | while [ "$1" != "" ]; do 32 | 33 | case $1 in 34 | 35 | -i | --install ) copyFromPodSourceToLocalInstall 36 | ;; 37 | 38 | -r | --update-reverse ) copyFromLocalInstallToPodSource 39 | ;; 40 | 41 | esac 42 | shift 43 | done 44 | 45 | # Default behaviour if no arg provided 46 | 47 | copyFromPodSourceToLocalInstall 48 | --------------------------------------------------------------------------------