ソースを参照

Added UI & Unit test

doganekici 5 年 前
コミット
3da95a8092

+ 26 - 0
.gitignore.txt

@@ -0,0 +1,26 @@
+# Xcode
+#
+# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
+
+## User settings
+xcuserdata/
+
+## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
+*.xcscmblueprint
+*.xccheckout
+
+## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
+build/
+DerivedData/
+*.moved-aside
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+
+## Gcc Patch
+/*.gcno

BIN
Appcircle.xcodeproj/project.xcworkspace/xcuserdata/doganekici.xcuserdatad/UserInterfaceState.xcuserstate


+ 98 - 0
Appcircle.xcodeproj/xcshareddata/xcschemes/Appcircle.xcscheme

@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "1130"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "C335FD432347815B00627CB4"
+               BuildableName = "Appcircle.app"
+               BlueprintName = "Appcircle"
+               ReferencedContainer = "container:Appcircle.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES">
+      <Testables>
+         <TestableReference
+            skipped = "NO">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "C335FD5E2347815C00627CB4"
+               BuildableName = "AppcircleTests.xctest"
+               BlueprintName = "AppcircleTests"
+               ReferencedContainer = "container:Appcircle.xcodeproj">
+            </BuildableReference>
+         </TestableReference>
+         <TestableReference
+            skipped = "NO">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "C335FD692347815C00627CB4"
+               BuildableName = "AppcircleUITests.xctest"
+               BlueprintName = "AppcircleUITests"
+               ReferencedContainer = "container:Appcircle.xcodeproj">
+            </BuildableReference>
+         </TestableReference>
+      </Testables>
+   </TestAction>
+   <LaunchAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      debugServiceExtension = "internal"
+      allowLocationSimulation = "YES">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "C335FD432347815B00627CB4"
+            BuildableName = "Appcircle.app"
+            BlueprintName = "Appcircle"
+            ReferencedContainer = "container:Appcircle.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </LaunchAction>
+   <ProfileAction
+      buildConfiguration = "Release"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      debugDocumentVersioning = "YES">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "C335FD432347815B00627CB4"
+            BuildableName = "Appcircle.app"
+            BlueprintName = "Appcircle"
+            ReferencedContainer = "container:Appcircle.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

+ 18 - 0
Appcircle.xcodeproj/xcuserdata/doganekici.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -10,5 +10,23 @@
 			<integer>0</integer>
 		</dict>
 	</dict>
+	<key>SuppressBuildableAutocreation</key>
+	<dict>
+		<key>C335FD432347815B00627CB4</key>
+		<dict>
+			<key>primary</key>
+			<true/>
+		</dict>
+		<key>C335FD5E2347815C00627CB4</key>
+		<dict>
+			<key>primary</key>
+			<true/>
+		</dict>
+		<key>C335FD692347815C00627CB4</key>
+		<dict>
+			<key>primary</key>
+			<true/>
+		</dict>
+	</dict>
 </dict>
 </plist>

+ 20 - 0
AppcircleTests/AppcircleTests.m

@@ -27,6 +27,26 @@
     // Use XCTAssert and related functions to verify your tests produce the correct results.
 }
 
+- (void)testArrayCount {
+    NSArray *array = [[NSArray alloc] initWithObjects:@"First",@"Second", nil];
+    XCTAssertEqual(array.count, 2);
+}
+
+- (void)testArrayFirstObject {
+    NSArray *array = [[NSArray alloc] initWithObjects:@"First",@"Second", nil];
+    XCTAssertEqual(array.firstObject, @"First");
+}
+
+- (void)testArrayLastObject {
+    NSArray *array = [[NSArray alloc] initWithObjects:@"First",@"Second", nil];
+    XCTAssertEqual(array.lastObject, @"Second");
+}
+
+- (void)testType {
+    NSArray *array = [[NSArray alloc] initWithObjects:@"First",@"Second", nil];
+    XCTAssert([array isKindOfClass:[NSArray class]]);
+}
+
 - (void)testPerformanceExample {
     // This is an example of a performance test case.
     [self measureBlock:^{

+ 11 - 3
AppcircleUITests/AppcircleUITests.m

@@ -31,9 +31,17 @@
     // UI tests must launch the application that they test.
     XCUIApplication *app = [[XCUIApplication alloc] init];
     [app launch];
-
-    // Use recording to get started writing UI tests.
-    // Use XCTAssert and related functions to verify your tests produce the correct results.
+    
+    XCTAssertTrue(app.buttons[@"Next Page"].exists);
+    [app.buttons[@"Next Page"] tap];
+    XCTAssertTrue(app.staticTexts[@"Appcircle.io"].exists);
+    
+    sleep(1);
+    
+    XCTAttachment *attachment = [XCTAttachment attachmentWithScreenshot:[app screenshot]];
+    attachment.name = @"Attachment";
+    attachment.lifetime = XCTAttachmentLifetimeKeepAlways;
+    [self addAttachment:attachment];
 }
 
 - (void)testLaunchPerformance {