mirror of
https://github.com/Finb/Bark.git
synced 2025-12-08 21:36:01 +00:00
添加单元测试
This commit is contained in:
parent
959aaf8db2
commit
f7c34f6277
37
.github/workflows/tests.yaml
vendored
Normal file
37
.github/workflows/tests.yaml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Select Xcode Version
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: latest-stable
|
||||
|
||||
- name: Setup ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.7.2
|
||||
bundler-cache: true
|
||||
|
||||
- name: Install Pods
|
||||
run: pod install
|
||||
|
||||
- name: Run Tests
|
||||
run: |
|
||||
export LC_ALL=en_US.UTF-8
|
||||
export LANG=en_US.UTF-8
|
||||
bundle exec fastlane tests
|
||||
@ -103,6 +103,7 @@
|
||||
06C595362481160F006B98F3 /* BKLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06C595352481160F006B98F3 /* BKLabel.swift */; };
|
||||
06CF784721C7A50300A052D7 /* NotificationServiceExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 06CF784021C7A50300A052D7 /* NotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
06CF784C21C7A51200A052D7 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06CF784B21C7A51200A052D7 /* NotificationService.swift */; };
|
||||
06EE1FD326843E9300586708 /* BarkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06EE1FD226843E9300586708 /* BarkTests.swift */; };
|
||||
6AF9CC9B5F6CD2BF86509897 /* libPods-Bark.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E4EA0C04469BF7B418FF3CB7 /* libPods-Bark.a */; };
|
||||
ACC117FABC6F8E44060B8D80 /* libPods-NotificationServiceExtension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A24A28EB12CA35B953807C99 /* libPods-NotificationServiceExtension.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
@ -122,6 +123,13 @@
|
||||
remoteGlobalIDString = 06CF783F21C7A50300A052D7;
|
||||
remoteInfo = NotificationServiceExtension;
|
||||
};
|
||||
06EE1FD526843E9300586708 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0661A537204FDA4100965E4E /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 0661A53E204FDA4100965E4E;
|
||||
remoteInfo = Bark;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@ -239,6 +247,9 @@
|
||||
06CF784021C7A50300A052D7 /* NotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = NotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
06CF784421C7A50300A052D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
06CF784B21C7A51200A052D7 /* NotificationService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
|
||||
06EE1FD026843E9300586708 /* BarkTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BarkTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
06EE1FD226843E9300586708 /* BarkTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarkTests.swift; sourceTree = "<group>"; };
|
||||
06EE1FD426843E9300586708 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
08AEA046D1FD0D7950208796 /* Pods-NotificationServiceExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationServiceExtension.debug.xcconfig"; path = "Pods/Target Support Files/Pods-NotificationServiceExtension/Pods-NotificationServiceExtension.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
14F0F73EC45A35FC2482F967 /* Pods_NotificationContentExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NotificationContentExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1CC985CE300A858FF65E166A /* Pods-Bark.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Bark.release.xcconfig"; path = "Pods/Target Support Files/Pods-Bark/Pods-Bark.release.xcconfig"; sourceTree = "<group>"; };
|
||||
@ -275,6 +286,13 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
06EE1FCD26843E9300586708 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
@ -422,6 +440,7 @@
|
||||
0661A541204FDA4100965E4E /* Bark */,
|
||||
0632CE2120EC9098003FDF46 /* NotificationContentExtension */,
|
||||
06CF784121C7A50300A052D7 /* NotificationServiceExtension */,
|
||||
06EE1FD126843E9300586708 /* BarkTests */,
|
||||
0661A540204FDA4100965E4E /* Products */,
|
||||
9563D0DB71FE280909AB1C63 /* Pods */,
|
||||
99BD309BDB7F62B5DC0CECE1 /* Frameworks */,
|
||||
@ -434,6 +453,7 @@
|
||||
0661A53F204FDA4100965E4E /* Bark.app */,
|
||||
0632CE1E20EC9098003FDF46 /* NotificationContentExtension.appex */,
|
||||
06CF784021C7A50300A052D7 /* NotificationServiceExtension.appex */,
|
||||
06EE1FD026843E9300586708 /* BarkTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@ -461,6 +481,15 @@
|
||||
path = NotificationServiceExtension;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
06EE1FD126843E9300586708 /* BarkTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
06EE1FD226843E9300586708 /* BarkTests.swift */,
|
||||
06EE1FD426843E9300586708 /* Info.plist */,
|
||||
);
|
||||
path = BarkTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9563D0DB71FE280909AB1C63 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -545,13 +574,31 @@
|
||||
productReference = 06CF784021C7A50300A052D7 /* NotificationServiceExtension.appex */;
|
||||
productType = "com.apple.product-type.app-extension";
|
||||
};
|
||||
06EE1FCF26843E9300586708 /* BarkTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 06EE1FD726843E9300586708 /* Build configuration list for PBXNativeTarget "BarkTests" */;
|
||||
buildPhases = (
|
||||
06EE1FCC26843E9300586708 /* Sources */,
|
||||
06EE1FCD26843E9300586708 /* Frameworks */,
|
||||
06EE1FCE26843E9300586708 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
06EE1FD626843E9300586708 /* PBXTargetDependency */,
|
||||
);
|
||||
name = BarkTests;
|
||||
productName = BarkTests;
|
||||
productReference = 06EE1FD026843E9300586708 /* BarkTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
0661A537204FDA4100965E4E /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1010;
|
||||
LastSwiftUpdateCheck = 1250;
|
||||
LastUpgradeCheck = 0930;
|
||||
ORGANIZATIONNAME = Fin;
|
||||
TargetAttributes = {
|
||||
@ -572,6 +619,11 @@
|
||||
CreatedOnToolsVersion = 10.1;
|
||||
ProvisioningStyle = Manual;
|
||||
};
|
||||
06EE1FCF26843E9300586708 = {
|
||||
CreatedOnToolsVersion = 12.5;
|
||||
ProvisioningStyle = Automatic;
|
||||
TestTargetID = 0661A53E204FDA4100965E4E;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 0661A53A204FDA4100965E4E /* Build configuration list for PBXProject "Bark" */;
|
||||
@ -591,6 +643,7 @@
|
||||
0661A53E204FDA4100965E4E /* Bark */,
|
||||
0632CE1D20EC9098003FDF46 /* NotificationContentExtension */,
|
||||
06CF783F21C7A50300A052D7 /* NotificationServiceExtension */,
|
||||
06EE1FCF26843E9300586708 /* BarkTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@ -655,6 +708,13 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
06EE1FCE26843E9300586708 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
@ -799,6 +859,14 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
06EE1FCC26843E9300586708 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
06EE1FD326843E9300586708 /* BarkTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
@ -812,6 +880,11 @@
|
||||
target = 06CF783F21C7A50300A052D7 /* NotificationServiceExtension */;
|
||||
targetProxy = 06CF784521C7A50300A052D7 /* PBXContainerItemProxy */;
|
||||
};
|
||||
06EE1FD626843E9300586708 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 0661A53E204FDA4100965E4E /* Bark */;
|
||||
targetProxy = 06EE1FD526843E9300586708 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
@ -1093,6 +1166,55 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
06EE1FD826843E9300586708 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = 5U8LBRXG3A;
|
||||
INFOPLIST_FILE = BarkTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.5;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = me.fin.BarkTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Bark.app/Bark";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
06EE1FD926843E9300586708 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = 5U8LBRXG3A;
|
||||
INFOPLIST_FILE = BarkTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.5;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = me.fin.BarkTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Bark.app/Bark";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
@ -1132,6 +1254,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
06EE1FD726843E9300586708 /* Build configuration list for PBXNativeTarget "BarkTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
06EE1FD826843E9300586708 /* Debug */,
|
||||
06EE1FD926843E9300586708 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 0661A537204FDA4100965E4E /* Project object */;
|
||||
|
||||
@ -28,6 +28,16 @@
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "06EE1FCF26843E9300586708"
|
||||
BuildableName = "BarkTests.xctest"
|
||||
BlueprintName = "BarkTests"
|
||||
ReferencedContainer = "container:Bark.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
|
||||
@ -43,6 +43,16 @@
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "06EE1FCF26843E9300586708"
|
||||
BuildableName = "BarkTests.xctest"
|
||||
BlueprintName = "BarkTests"
|
||||
ReferencedContainer = "container:Bark.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
|
||||
@ -43,6 +43,16 @@
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "06EE1FCF26843E9300586708"
|
||||
BuildableName = "BarkTests.xctest"
|
||||
BlueprintName = "BarkTests"
|
||||
ReferencedContainer = "container:Bark.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
|
||||
33
BarkTests/BarkTests.swift
Normal file
33
BarkTests/BarkTests.swift
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// BarkTests.swift
|
||||
// BarkTests
|
||||
//
|
||||
// Created by huangfeng on 2021/6/24.
|
||||
// Copyright © 2021 Fin. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
class BarkTests: XCTestCase {
|
||||
|
||||
override func setUpWithError() throws {
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
func testExample() throws {
|
||||
// This is an example of a functional test case.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
func testPerformanceExample() throws {
|
||||
// This is an example of a performance test case.
|
||||
measure {
|
||||
// Put the code you want to measure the time of here.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
22
BarkTests/Info.plist
Normal file
22
BarkTests/Info.plist
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -40,7 +40,11 @@ platform :ios do
|
||||
upload_to_testflight
|
||||
|
||||
bark_key = ENV["BARK_KEY"]
|
||||
%x( curl https://api.day.app/#{bark_key}/Bark%20has%20completed%20processing )
|
||||
%x( curl https://api.day.app/#{bark_key}/Bark%20has%20completed%20processing?isArchive=0 )
|
||||
|
||||
end
|
||||
|
||||
lane :tests do
|
||||
run_tests(scheme: "Bark.xcworkspace", scheme: "Bark")
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user