Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 유닛테스트 작업환경 세팅 #145

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>ENABLE_TESTING_SEARCH_PATHS</key>
<string>YES</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ComposableArchitecture
import XCTest

@testable import FeatureCategoryDetail

final class FeatureCategoryDetailTests: XCTestCase {
func test() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>ENABLE_TESTING_SEARCH_PATHS</key>
<string>YES</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ComposableArchitecture
import XCTest

@testable import FeatureCategorySetting

final class FeatureCategorySettingTests: XCTestCase {
func test() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>ENABLE_TESTING_SEARCH_PATHS</key>
<string>YES</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ComposableArchitecture
import XCTest

@testable import FeatureCategorySharing

final class FeatureCategorySharingTests: XCTestCase {
func test() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>ENABLE_TESTING_SEARCH_PATHS</key>
<string>YES</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ComposableArchitecture
import XCTest

@testable import FeatureContentDetail

final class FeatureContentDetailTests: XCTestCase {
func test() {

}
}
8 changes: 8 additions & 0 deletions Projects/Feature/FeatureContentListTests/Resources/info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>ENABLE_TESTING_SEARCH_PATHS</key>
<string>YES</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ComposableArchitecture
import XCTest

@testable import FeatureContentList

final class FeatureContentListTests: XCTestCase {
func test() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>ENABLE_TESTING_SEARCH_PATHS</key>
<string>YES</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ComposableArchitecture
import XCTest

@testable import FeatureContentSetting

final class FeatureContentSettingTests: XCTestCase {
func test() {

}
}
8 changes: 8 additions & 0 deletions Projects/Feature/FeatureLoginTests/Resources/info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>ENABLE_TESTING_SEARCH_PATHS</key>
<string>YES</string>
</dict>
</plist>
10 changes: 10 additions & 0 deletions Projects/Feature/FeatureLoginTests/Sources/FeatureLoginTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ComposableArchitecture
import XCTest

@testable import FeatureLogin

final class FeatureLoginTests: XCTestCase {
func test() {

}
}
8 changes: 8 additions & 0 deletions Projects/Feature/FeatureMyFolderTests/Resources/info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>ENABLE_TESTING_SEARCH_PATHS</key>
<string>YES</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ComposableArchitecture
import XCTest

@testable import FeatureMyFolder

final class FeatureMyFolderTests: XCTestCase {
func test() {

}
}
8 changes: 8 additions & 0 deletions Projects/Feature/FeatureMyPageTests/Resources/info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>ENABLE_TESTING_SEARCH_PATHS</key>
<string>YES</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ComposableArchitecture
import XCTest

@testable import FeatureMyPage

final class FeatureMyPageTests: XCTestCase {
func test() {

}
}
8 changes: 8 additions & 0 deletions Projects/Feature/FeaturePokitTests/Resources/info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>ENABLE_TESTING_SEARCH_PATHS</key>
<string>YES</string>
</dict>
</plist>
10 changes: 10 additions & 0 deletions Projects/Feature/FeaturePokitTests/Sources/FeaturePokitTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ComposableArchitecture
import XCTest

@testable import FeaturePokit

final class FeaturePokitTests: XCTestCase {
func test() {

}
}
8 changes: 8 additions & 0 deletions Projects/Feature/FeatureRemindTests/Resources/info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>ENABLE_TESTING_SEARCH_PATHS</key>
<string>YES</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ComposableArchitecture
import XCTest

@testable import FeatureRemind

final class FeatureRemindTests: XCTestCase {
func test() {

}
}
8 changes: 8 additions & 0 deletions Projects/Feature/FeatureSettingTests/Resources/info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>ENABLE_TESTING_SEARCH_PATHS</key>
<string>YES</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ComposableArchitecture
import XCTest

@testable import FeatureSetting

final class FeatureSettingTests: XCTestCase {
func test() {

}
}
6 changes: 5 additions & 1 deletion Projects/Feature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ let demoTargets = Feature.allCases.map { feature in
return feature.demoTarget
}

let testTargets = Feature.allCases.map { feature in
return feature.testTarget
}

let project = Project(
name: "Feature",
targets: targets + demoTargets
targets: targets + demoTargets + testTargets
)
13 changes: 13 additions & 0 deletions Tuist/ProjectDescriptionHelpers/Feature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,17 @@ public enum Feature: String, CaseIterable {
]
)
}

public var testTarget: Target {
return .makeTarget(
name: "Feature\(self.rawValue)Tests",
product: .unitTests,
bundleName: "Feature.\(self.rawValue)Tests",
infoPlist: .dictionary(["ENABLE_TESTING_SEARCH_PATHS": "YES"]),
resources: ["Feature\(self.rawValue)Tests/Resources/**"],
dependencies: [
.target(self.target)
]
)
}
}
8 changes: 8 additions & 0 deletions Tuist/Templates/test/InfoPlist.stencil
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>ENABLE_TESTING_SEARCH_PATHS</key>
<string>YES</string>
</dict>
</plist>
10 changes: 10 additions & 0 deletions Tuist/Templates/test/Test.stencil
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ComposableArchitecture
import XCTest

@testable import {{ target }}

final class {{ target }}Tests: XCTestCase {
func test() {

}
}
27 changes: 27 additions & 0 deletions Tuist/Templates/test/test.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// test.swift
// ProjectDescriptionHelpers
//
// Created by 김민호 on 10/10/24.
//

import ProjectDescription

let appProjectAttribute: Template.Attribute = .required("project")
let appTargetAttribute: Template.Attribute = .required("target")

let appTemplate = Template(
description: "Target template",
attributes: [
appProjectAttribute,
appTargetAttribute
],
items: [
.file(
path: "Projects/\(appProjectAttribute)/\(appTargetAttribute)Tests/Sources/\(appTargetAttribute)Tests.swift",
templatePath: "Test.stencil"),
.file(
path: "Projects/\(appProjectAttribute)/\(appTargetAttribute)Tests/Resources/info.plist",
templatePath: "InfoPlist.stencil"),
]
)
Loading