xcfit 3.1.5 → 3.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/Pre-Defined_Steps/Cucumberish_Predefined_Steps.md +12 -0
- data/Pre-Defined_Steps/XCFit_Predefined_Steps.md +49 -0
- data/README.md +53 -31
- data/XCFit.podspec +1 -1
- data/XCFit4Demo/Cartfile +1 -0
- data/XCFit4Demo/Cartfile.resolved +2 -0
- data/XCFit4Demo/XCFit4Demo.xcodeproj/project.pbxproj +864 -0
- data/XCFit4Demo/XCFit4Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/XCFit4Demo/XCFit4Demo/AppDelegate.swift +46 -0
- data/XCFit4Demo/XCFit4Demo/Assets.xcassets/AppIcon.appiconset/Contents.json +38 -0
- data/XCFit4Demo/XCFit4Demo/Base.lproj/LaunchScreen.storyboard +27 -0
- data/XCFit4Demo/XCFit4Demo/Base.lproj/Main.storyboard +53 -0
- data/XCFit4Demo/XCFit4Demo/Info.plist +38 -0
- data/XCFit4Demo/XCFit4Demo/ViewController.swift +33 -0
- data/XCFit4Demo/XCFit4DemoCucumberTests/BaseScreen.swift +21 -0
- data/XCFit4Demo/XCFit4DemoCucumberTests/CommonStepDefinitions.swift +89 -0
- data/XCFit4Demo/XCFit4DemoCucumberTests/Extensions.swift +57 -0
- data/XCFit4Demo/XCFit4DemoCucumberTests/Features/demo.feature +8 -0
- data/XCFit4Demo/XCFit4DemoCucumberTests/HomeScreen.swift +24 -0
- data/XCFit4Demo/XCFit4DemoCucumberTests/HomeScreenSteps.swift +29 -0
- data/XCFit4Demo/XCFit4DemoCucumberTests/Hooks.swift +27 -0
- data/XCFit4Demo/XCFit4DemoCucumberTests/Info.plist +22 -0
- data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests-Bridging-Header.h +17 -0
- data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.h +22 -0
- data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.m +27 -0
- data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.swift +39 -0
- data/XCFit4Demo/XCFit4DemoTests/Info.plist +22 -0
- data/XCFit4Demo/XCFit4DemoTests/XCFit4DemoTests.swift +36 -0
- data/XCFit4Demo/XCFit4DemoXCUIPoMTests/Extensions.swift +60 -0
- data/XCFit4Demo/XCFit4DemoXCUIPoMTests/HomeScreen.swift +23 -0
- data/XCFit4Demo/XCFit4DemoXCUIPoMTests/HomeScreenTest.swift +28 -0
- data/XCFit4Demo/XCFit4DemoXCUIPoMTests/Info.plist +22 -0
- data/XCFit4Demo/XCFit4DemoXCUIPoMTests/XCFit4DemoXCUIPoMTestsTestBase.swift +36 -0
- data/homebrew/xcfit +1 -1
- data/lib/XCFit/version.rb +1 -1
- metadata +33 -6
- data/Docs/InitialVersion.md +0 -340
- data/Docs/README_XCFit2.md +0 -572
- data/Docs/Xcode7.md +0 -273
- data/Docs/xcdoe7swift2.md +0 -311
@@ -0,0 +1,29 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
|
7
|
+
/*
|
8
|
+
|
9
|
+
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
10
|
+
|
11
|
+
Here is Step implementation for the HomeScreen where we can use buttons from HomeScreen. We have to implement all the steps in the func HomeScreenSteps Or create another func if needed but we have register it in the intitialiser class.
|
12
|
+
*/
|
13
|
+
|
14
|
+
import Foundation
|
15
|
+
import XCTest
|
16
|
+
import Cucumberish
|
17
|
+
|
18
|
+
class HomeScreenSteps: BaseScreen {
|
19
|
+
|
20
|
+
func HomeScreenSteps() {
|
21
|
+
|
22
|
+
MatchAll("I should see hello message") { (args, userInfo) -> Void in
|
23
|
+
|
24
|
+
XCTAssertTrue(XCUIApplication().staticTexts["Welcome"].exists)
|
25
|
+
|
26
|
+
}
|
27
|
+
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
|
7
|
+
/*
|
8
|
+
|
9
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
10
|
+
|
11
|
+
This are preconditions or post conditions to be executed before or after each scenario
|
12
|
+
*/
|
13
|
+
|
14
|
+
import Foundation
|
15
|
+
import XCTest
|
16
|
+
import Cucumberish
|
17
|
+
|
18
|
+
class Hooks: NSObject {
|
19
|
+
class func CustomHooks()
|
20
|
+
{
|
21
|
+
//A closure that will be executed just before executing any of your features
|
22
|
+
beforeStart { () -> Void in
|
23
|
+
// Write your hooks here
|
24
|
+
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
6
|
+
<string>en</string>
|
7
|
+
<key>CFBundleExecutable</key>
|
8
|
+
<string>$(EXECUTABLE_NAME)</string>
|
9
|
+
<key>CFBundleIdentifier</key>
|
10
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
12
|
+
<string>6.0</string>
|
13
|
+
<key>CFBundleName</key>
|
14
|
+
<string>$(PRODUCT_NAME)</string>
|
15
|
+
<key>CFBundlePackageType</key>
|
16
|
+
<string>BNDL</string>
|
17
|
+
<key>CFBundleShortVersionString</key>
|
18
|
+
<string>1.0</string>
|
19
|
+
<key>CFBundleVersion</key>
|
20
|
+
<string>1</string>
|
21
|
+
</dict>
|
22
|
+
</plist>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
|
7
|
+
/*
|
8
|
+
|
9
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
10
|
+
|
11
|
+
This is bridging header to manage objective-C dependencies in the Swift code. We are using Cucumberish steps. You probably don't need to touch this file.
|
12
|
+
|
13
|
+
*/
|
14
|
+
// Uncomment below two line while usng manual installtion
|
15
|
+
|
16
|
+
// #import "Cucumberish.h"
|
17
|
+
// #import "CCIStepsManager.h"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
|
7
|
+
/*
|
8
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
9
|
+
|
10
|
+
This is header file to manage objective-C dependencies in the Swift code. We are using Cucumberish steps. You probably don't need to touch this file.
|
11
|
+
|
12
|
+
*/
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
#import <Foundation/Foundation.h>
|
17
|
+
#import "XCFit4DemoCucumberTests-Swift.h"
|
18
|
+
|
19
|
+
|
20
|
+
@interface XCFit4DemoCucumberTests : NSObject
|
21
|
+
|
22
|
+
@end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
|
7
|
+
/*
|
8
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
9
|
+
|
10
|
+
This is objective-C contructor to initialise Cucumberish in our project.
|
11
|
+
|
12
|
+
*/
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
#import <Foundation/Foundation.h>
|
18
|
+
#import "XCFit4DemoCucumberTests-Swift.h"
|
19
|
+
#import <XCTest/XCTest.h>
|
20
|
+
|
21
|
+
|
22
|
+
__attribute__((constructor))
|
23
|
+
void CucumberishInit()
|
24
|
+
{
|
25
|
+
[XCFit4DemoCucumberTests CucumberishSwiftInit];
|
26
|
+
|
27
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
|
7
|
+
|
8
|
+
/*
|
9
|
+
|
10
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
11
|
+
|
12
|
+
This is very important file as we will be using it as initialiser of all out test suite. We have to resgister all our Step Definitions in this class. e.g we have registed CommonStepDefinitions and HomeScreenSteps here
|
13
|
+
|
14
|
+
*/
|
15
|
+
|
16
|
+
|
17
|
+
import Foundation
|
18
|
+
import Cucumberish
|
19
|
+
|
20
|
+
class XCFit4DemoCucumberTests: NSObject {
|
21
|
+
class func CucumberishSwiftInit()
|
22
|
+
{
|
23
|
+
var application : XCUIApplication!
|
24
|
+
//A closure that will be executed just before executing any of your features
|
25
|
+
beforeStart { () -> Void in
|
26
|
+
application = XCUIApplication()
|
27
|
+
CommonStepDefinitions.setup(application);
|
28
|
+
HomeScreenSteps().HomeScreenSteps()
|
29
|
+
}
|
30
|
+
//A Given step definition
|
31
|
+
Given("the app is running") { (args, userInfo) -> Void in
|
32
|
+
application.launch()
|
33
|
+
|
34
|
+
}
|
35
|
+
let bundle = Bundle(for: XCFit4DemoCucumberTests.self)
|
36
|
+
|
37
|
+
Cucumberish.executeFeatures(inDirectory: "Features", from: bundle, includeTags: nil, excludeTags: nil)
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
6
|
+
<string>en</string>
|
7
|
+
<key>CFBundleExecutable</key>
|
8
|
+
<string>$(EXECUTABLE_NAME)</string>
|
9
|
+
<key>CFBundleIdentifier</key>
|
10
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
12
|
+
<string>6.0</string>
|
13
|
+
<key>CFBundleName</key>
|
14
|
+
<string>$(PRODUCT_NAME)</string>
|
15
|
+
<key>CFBundlePackageType</key>
|
16
|
+
<string>BNDL</string>
|
17
|
+
<key>CFBundleShortVersionString</key>
|
18
|
+
<string>1.0</string>
|
19
|
+
<key>CFBundleVersion</key>
|
20
|
+
<string>1</string>
|
21
|
+
</dict>
|
22
|
+
</plist>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
//
|
2
|
+
// XCFit4DemoTests.swift
|
3
|
+
// XCFit4DemoTests
|
4
|
+
//
|
5
|
+
// Created by Shashikant Jagtap on 11/02/2017.
|
6
|
+
// Copyright © 2017 Shashikant Jagtap. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
import XCTest
|
10
|
+
@testable import XCFit4Demo
|
11
|
+
|
12
|
+
class XCFit4DemoTests: XCTestCase {
|
13
|
+
|
14
|
+
override func setUp() {
|
15
|
+
super.setUp()
|
16
|
+
// Put setup code here. This method is called before the invocation of each test method in the class.
|
17
|
+
}
|
18
|
+
|
19
|
+
override func tearDown() {
|
20
|
+
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
21
|
+
super.tearDown()
|
22
|
+
}
|
23
|
+
|
24
|
+
func testExample() {
|
25
|
+
// This is an example of a functional test case.
|
26
|
+
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
27
|
+
}
|
28
|
+
|
29
|
+
func testPerformanceExample() {
|
30
|
+
// This is an example of a performance test case.
|
31
|
+
self.measure {
|
32
|
+
// Put the code you want to measure the time of here.
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
//
|
7
|
+
|
8
|
+
/*
|
9
|
+
|
10
|
+
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
11
|
+
|
12
|
+
This file can take all the Swift extensions build around XCUI Test Frameworks which can be directly used in the tests, page objects. Here are sample extensions on XCUIElement and XCTestCase.
|
13
|
+
|
14
|
+
*/
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
import Foundation
|
19
|
+
import XCTest
|
20
|
+
|
21
|
+
extension XCUIElement {
|
22
|
+
|
23
|
+
public func tapOnceVisible(testCase: XCTestCase,
|
24
|
+
file: String = #file, line: UInt = #line) {
|
25
|
+
let existsPredicate = NSPredicate(format: "exists == true")
|
26
|
+
|
27
|
+
|
28
|
+
testCase.expectation(for: existsPredicate,
|
29
|
+
evaluatedWith: self, handler: nil)
|
30
|
+
|
31
|
+
testCase.waitForExpectations(timeout: 20) { (error) -> Void in
|
32
|
+
if (error != nil) {
|
33
|
+
let message = "Failed to find \(self) after 20 seconds."
|
34
|
+
testCase.recordFailure(withDescription: message,
|
35
|
+
inFile: file, atLine: line, expected: true)
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
self.tap()
|
40
|
+
}
|
41
|
+
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
extension XCTestCase {
|
46
|
+
func waitForElementToAppear(element: XCUIElement,
|
47
|
+
file: String = #file, line: UInt = #line) {
|
48
|
+
let existsPredicate = NSPredicate(format: "exists == true")
|
49
|
+
expectation(for: existsPredicate,
|
50
|
+
evaluatedWith: element, handler: nil)
|
51
|
+
|
52
|
+
waitForExpectations(timeout: 20) { (error) -> Void in
|
53
|
+
if (error != nil) {
|
54
|
+
let message = "Failed to find \(element) after 5 seconds."
|
55
|
+
self.recordFailure(withDescription: message,
|
56
|
+
inFile: file, atLine: line, expected: true)
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
|
7
|
+
/*
|
8
|
+
|
9
|
+
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
10
|
+
|
11
|
+
This assumes that your apps is made up of multiple screens. You can write individual screen class which extend BaseScreen. All the functionality related to screen can be included in this class.
|
12
|
+
*/
|
13
|
+
|
14
|
+
import Foundation
|
15
|
+
import XCTest
|
16
|
+
|
17
|
+
|
18
|
+
class HomeScreen: XCFit4DemoXCUIPoMTestsTestBase {
|
19
|
+
|
20
|
+
let clickButtuon = XCUIApplication().buttons["Click"]
|
21
|
+
let helloMessage = XCUIApplication().staticTexts["Welcome"]
|
22
|
+
|
23
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
//
|
7
|
+
|
8
|
+
/*
|
9
|
+
|
10
|
+
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
11
|
+
|
12
|
+
This is sample test which demonstrate use of Page Objects and common extensions. We can access any page or section from test method
|
13
|
+
|
14
|
+
*/
|
15
|
+
|
16
|
+
import Foundation
|
17
|
+
import XCTest
|
18
|
+
|
19
|
+
class HomeScreenTest: HomeScreen {
|
20
|
+
|
21
|
+
func testHomeScreen() {
|
22
|
+
// Below step will be available as part of XCFit Swift Framework.
|
23
|
+
|
24
|
+
givenILaunchedApplication()
|
25
|
+
whenITap(on: HomeScreen().clickButtuon)
|
26
|
+
}
|
27
|
+
|
28
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
6
|
+
<string>en</string>
|
7
|
+
<key>CFBundleExecutable</key>
|
8
|
+
<string>$(EXECUTABLE_NAME)</string>
|
9
|
+
<key>CFBundleIdentifier</key>
|
10
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
12
|
+
<string>6.0</string>
|
13
|
+
<key>CFBundleName</key>
|
14
|
+
<string>$(PRODUCT_NAME)</string>
|
15
|
+
<key>CFBundlePackageType</key>
|
16
|
+
<string>BNDL</string>
|
17
|
+
<key>CFBundleShortVersionString</key>
|
18
|
+
<string>1.0</string>
|
19
|
+
<key>CFBundleVersion</key>
|
20
|
+
<string>1</string>
|
21
|
+
</dict>
|
22
|
+
</plist>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
|
7
|
+
/*
|
8
|
+
|
9
|
+
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
10
|
+
|
11
|
+
This class can be used to put all your test base setup e.g launch Argument, cutom Environment varibales, Mock Server, teardown etc etc
|
12
|
+
|
13
|
+
*/
|
14
|
+
|
15
|
+
import Foundation
|
16
|
+
import XCTest
|
17
|
+
|
18
|
+
// Uncomment the import line below while using XCFit Swift framework for pre-defined BDD style steps. Extend this class to XCFit
|
19
|
+
|
20
|
+
|
21
|
+
import XCFit
|
22
|
+
|
23
|
+
class XCFit4DemoXCUIPoMTestsTestBase: XCFit {
|
24
|
+
|
25
|
+
override func setUp() {
|
26
|
+
super.setUp()
|
27
|
+
continueAfterFailure = false
|
28
|
+
XCUIApplication().launch()
|
29
|
+
}
|
30
|
+
|
31
|
+
override func tearDown() {
|
32
|
+
super.tearDown()
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
}
|