Skip to content

Commit 1bdaaf5

Browse files
committed
Add unit tests to macOS app example
1 parent 67dc9f8 commit 1bdaaf5

File tree

3 files changed

+156
-1
lines changed

3 files changed

+156
-1
lines changed

example_projects/macOS/MCPTest.xcodeproj/project.pbxproj

Lines changed: 127 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,19 @@
66
objectVersion = 77;
77
objects = {
88

9+
/* Begin PBXContainerItemProxy section */
10+
8BCB4E2B2EF00E2600D60AD2 /* PBXContainerItemProxy */ = {
11+
isa = PBXContainerItemProxy;
12+
containerPortal = 8BA9F8182D62A17D00C22D5D /* Project object */;
13+
proxyType = 1;
14+
remoteGlobalIDString = 8BA9F81F2D62A17D00C22D5D;
15+
remoteInfo = MCPTest;
16+
};
17+
/* End PBXContainerItemProxy section */
18+
919
/* Begin PBXFileReference section */
1020
8BA9F8202D62A17D00C22D5D /* MCPTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MCPTest.app; sourceTree = BUILT_PRODUCTS_DIR; };
21+
8BCB4E272EF00E2600D60AD2 /* MCPTestTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MCPTestTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
1122
/* End PBXFileReference section */
1223

1324
/* Begin PBXFileSystemSynchronizedRootGroup section */
@@ -16,6 +27,11 @@
1627
path = MCPTest;
1728
sourceTree = "<group>";
1829
};
30+
8BCB4E282EF00E2600D60AD2 /* MCPTestTests */ = {
31+
isa = PBXFileSystemSynchronizedRootGroup;
32+
path = MCPTestTests;
33+
sourceTree = "<group>";
34+
};
1935
/* End PBXFileSystemSynchronizedRootGroup section */
2036

2137
/* Begin PBXFrameworksBuildPhase section */
@@ -26,13 +42,21 @@
2642
);
2743
runOnlyForDeploymentPostprocessing = 0;
2844
};
45+
8BCB4E242EF00E2600D60AD2 /* Frameworks */ = {
46+
isa = PBXFrameworksBuildPhase;
47+
buildActionMask = 2147483647;
48+
files = (
49+
);
50+
runOnlyForDeploymentPostprocessing = 0;
51+
};
2952
/* End PBXFrameworksBuildPhase section */
3053

3154
/* Begin PBXGroup section */
3255
8BA9F8172D62A17D00C22D5D = {
3356
isa = PBXGroup;
3457
children = (
3558
8BA9F8222D62A17D00C22D5D /* MCPTest */,
59+
8BCB4E282EF00E2600D60AD2 /* MCPTestTests */,
3660
8BA9F8212D62A17D00C22D5D /* Products */,
3761
);
3862
sourceTree = "<group>";
@@ -41,6 +65,7 @@
4165
isa = PBXGroup;
4266
children = (
4367
8BA9F8202D62A17D00C22D5D /* MCPTest.app */,
68+
8BCB4E272EF00E2600D60AD2 /* MCPTestTests.xctest */,
4469
);
4570
name = Products;
4671
sourceTree = "<group>";
@@ -70,19 +95,46 @@
7095
productReference = 8BA9F8202D62A17D00C22D5D /* MCPTest.app */;
7196
productType = "com.apple.product-type.application";
7297
};
98+
8BCB4E262EF00E2600D60AD2 /* MCPTestTests */ = {
99+
isa = PBXNativeTarget;
100+
buildConfigurationList = 8BCB4E2F2EF00E2600D60AD2 /* Build configuration list for PBXNativeTarget "MCPTestTests" */;
101+
buildPhases = (
102+
8BCB4E232EF00E2600D60AD2 /* Sources */,
103+
8BCB4E242EF00E2600D60AD2 /* Frameworks */,
104+
8BCB4E252EF00E2600D60AD2 /* Resources */,
105+
);
106+
buildRules = (
107+
);
108+
dependencies = (
109+
8BCB4E2C2EF00E2600D60AD2 /* PBXTargetDependency */,
110+
);
111+
fileSystemSynchronizedGroups = (
112+
8BCB4E282EF00E2600D60AD2 /* MCPTestTests */,
113+
);
114+
name = MCPTestTests;
115+
packageProductDependencies = (
116+
);
117+
productName = MCPTestTests;
118+
productReference = 8BCB4E272EF00E2600D60AD2 /* MCPTestTests.xctest */;
119+
productType = "com.apple.product-type.bundle.unit-test";
120+
};
73121
/* End PBXNativeTarget section */
74122

75123
/* Begin PBXProject section */
76124
8BA9F8182D62A17D00C22D5D /* Project object */ = {
77125
isa = PBXProject;
78126
attributes = {
79127
BuildIndependentTargetsInParallel = 1;
80-
LastSwiftUpdateCheck = 1620;
128+
LastSwiftUpdateCheck = 2600;
81129
LastUpgradeCheck = 1620;
82130
TargetAttributes = {
83131
8BA9F81F2D62A17D00C22D5D = {
84132
CreatedOnToolsVersion = 16.2;
85133
};
134+
8BCB4E262EF00E2600D60AD2 = {
135+
CreatedOnToolsVersion = 26.0;
136+
TestTargetID = 8BA9F81F2D62A17D00C22D5D;
137+
};
86138
};
87139
};
88140
buildConfigurationList = 8BA9F81B2D62A17D00C22D5D /* Build configuration list for PBXProject "MCPTest" */;
@@ -100,6 +152,7 @@
100152
projectRoot = "";
101153
targets = (
102154
8BA9F81F2D62A17D00C22D5D /* MCPTest */,
155+
8BCB4E262EF00E2600D60AD2 /* MCPTestTests */,
103156
);
104157
};
105158
/* End PBXProject section */
@@ -112,6 +165,13 @@
112165
);
113166
runOnlyForDeploymentPostprocessing = 0;
114167
};
168+
8BCB4E252EF00E2600D60AD2 /* Resources */ = {
169+
isa = PBXResourcesBuildPhase;
170+
buildActionMask = 2147483647;
171+
files = (
172+
);
173+
runOnlyForDeploymentPostprocessing = 0;
174+
};
115175
/* End PBXResourcesBuildPhase section */
116176

117177
/* Begin PBXSourcesBuildPhase section */
@@ -122,8 +182,23 @@
122182
);
123183
runOnlyForDeploymentPostprocessing = 0;
124184
};
185+
8BCB4E232EF00E2600D60AD2 /* Sources */ = {
186+
isa = PBXSourcesBuildPhase;
187+
buildActionMask = 2147483647;
188+
files = (
189+
);
190+
runOnlyForDeploymentPostprocessing = 0;
191+
};
125192
/* End PBXSourcesBuildPhase section */
126193

194+
/* Begin PBXTargetDependency section */
195+
8BCB4E2C2EF00E2600D60AD2 /* PBXTargetDependency */ = {
196+
isa = PBXTargetDependency;
197+
target = 8BA9F81F2D62A17D00C22D5D /* MCPTest */;
198+
targetProxy = 8BCB4E2B2EF00E2600D60AD2 /* PBXContainerItemProxy */;
199+
};
200+
/* End PBXTargetDependency section */
201+
127202
/* Begin XCBuildConfiguration section */
128203
8BA9F8432D62A18100C22D5D /* Debug */ = {
129204
isa = XCBuildConfiguration;
@@ -297,6 +372,48 @@
297372
};
298373
name = Release;
299374
};
375+
8BCB4E2D2EF00E2600D60AD2 /* Debug */ = {
376+
isa = XCBuildConfiguration;
377+
buildSettings = {
378+
BUNDLE_LOADER = "$(TEST_HOST)";
379+
CODE_SIGN_STYLE = Automatic;
380+
CURRENT_PROJECT_VERSION = 1;
381+
DEVELOPMENT_TEAM = BR6WD3M6ZD;
382+
GENERATE_INFOPLIST_FILE = YES;
383+
MACOSX_DEPLOYMENT_TARGET = 26.0;
384+
MARKETING_VERSION = 1.0;
385+
PRODUCT_BUNDLE_IDENTIFIER = com.cameroncooke.test.MCPTestTests;
386+
PRODUCT_NAME = "$(TARGET_NAME)";
387+
STRING_CATALOG_GENERATE_SYMBOLS = NO;
388+
SWIFT_APPROACHABLE_CONCURRENCY = YES;
389+
SWIFT_EMIT_LOC_STRINGS = NO;
390+
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
391+
SWIFT_VERSION = 5.0;
392+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MCPTest.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/MCPTest";
393+
};
394+
name = Debug;
395+
};
396+
8BCB4E2E2EF00E2600D60AD2 /* Release */ = {
397+
isa = XCBuildConfiguration;
398+
buildSettings = {
399+
BUNDLE_LOADER = "$(TEST_HOST)";
400+
CODE_SIGN_STYLE = Automatic;
401+
CURRENT_PROJECT_VERSION = 1;
402+
DEVELOPMENT_TEAM = BR6WD3M6ZD;
403+
GENERATE_INFOPLIST_FILE = YES;
404+
MACOSX_DEPLOYMENT_TARGET = 26.0;
405+
MARKETING_VERSION = 1.0;
406+
PRODUCT_BUNDLE_IDENTIFIER = com.cameroncooke.test.MCPTestTests;
407+
PRODUCT_NAME = "$(TARGET_NAME)";
408+
STRING_CATALOG_GENERATE_SYMBOLS = NO;
409+
SWIFT_APPROACHABLE_CONCURRENCY = YES;
410+
SWIFT_EMIT_LOC_STRINGS = NO;
411+
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
412+
SWIFT_VERSION = 5.0;
413+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MCPTest.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/MCPTest";
414+
};
415+
name = Release;
416+
};
300417
/* End XCBuildConfiguration section */
301418

302419
/* Begin XCConfigurationList section */
@@ -318,6 +435,15 @@
318435
defaultConfigurationIsVisible = 0;
319436
defaultConfigurationName = Release;
320437
};
438+
8BCB4E2F2EF00E2600D60AD2 /* Build configuration list for PBXNativeTarget "MCPTestTests" */ = {
439+
isa = XCConfigurationList;
440+
buildConfigurations = (
441+
8BCB4E2D2EF00E2600D60AD2 /* Debug */,
442+
8BCB4E2E2EF00E2600D60AD2 /* Release */,
443+
);
444+
defaultConfigurationIsVisible = 0;
445+
defaultConfigurationName = Release;
446+
};
321447
/* End XCConfigurationList section */
322448
};
323449
rootObject = 8BA9F8182D62A17D00C22D5D /* Project object */;

example_projects/macOS/MCPTest.xcodeproj/xcshareddata/xcschemes/MCPTest.xcscheme

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@
2929
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
3030
shouldUseLaunchSchemeArgsEnv = "YES"
3131
shouldAutocreateTestPlan = "YES">
32+
<Testables>
33+
<TestableReference
34+
skipped = "NO"
35+
parallelizable = "YES">
36+
<BuildableReference
37+
BuildableIdentifier = "primary"
38+
BlueprintIdentifier = "8BCB4E262EF00E2600D60AD2"
39+
BuildableName = "MCPTestTests.xctest"
40+
BlueprintName = "MCPTestTests"
41+
ReferencedContainer = "container:MCPTest.xcodeproj">
42+
</BuildableReference>
43+
</TestableReference>
44+
</Testables>
3245
</TestAction>
3346
<LaunchAction
3447
buildConfiguration = "Debug"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// MCPTestTests.swift
3+
// MCPTestTests
4+
//
5+
// Created by Cameron on 15/12/2025.
6+
//
7+
8+
import Testing
9+
10+
struct MCPTestTests {
11+
12+
@Test func example() async throws {
13+
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
14+
}
15+
16+
}

0 commit comments

Comments
 (0)