-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from hoangatuan/Support-custom-testing-frameworks
Support custom testing frameworks
- Loading branch information
Showing
9 changed files
with
190 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Hoang Anh Tuan on 30/09/2023. | ||
// | ||
|
||
import Foundation | ||
import ShellOut | ||
import ArgumentParser | ||
|
||
protocol Executor { | ||
func simulateUI() throws | ||
func generateMemgraph(for processName: String) throws | ||
func getMemgraphPath() -> String | ||
} | ||
|
||
class DefaultExecutor: Executor { | ||
let memgraphPath: String = "~/Desktop/Leaks.memgraph" | ||
|
||
fileprivate init() { } | ||
|
||
func simulateUI() throws { | ||
fatalError("Need to override this func") | ||
} | ||
|
||
func generateMemgraph(for processName: String) throws { | ||
try shellOut(to: "leaks \(processName) --outputGraph=\(memgraphPath)") | ||
} | ||
|
||
func getMemgraphPath() -> String { | ||
return memgraphPath | ||
} | ||
} | ||
|
||
final class MaestroExecutor: DefaultExecutor { | ||
|
||
/// Maestro needs a flow.yaml to start simulating UI | ||
private let flowPath: String | ||
|
||
init(flowPath: String) { | ||
self.flowPath = flowPath | ||
super.init() | ||
} | ||
|
||
override func simulateUI() throws { | ||
try shellOut(to: "maestro test \(flowPath)") | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Hoang Anh Tuan on 30/09/2023. | ||
// | ||
|
||
import Foundation | ||
import ArgumentParser | ||
|
||
enum ExecutorType: String, CaseIterable, Codable, ExpressibleByArgument { | ||
case maestro | ||
// case xcuitest | ||
|
||
static var supportedTypesDescription: String { | ||
"Current support types are: maestro" | ||
} | ||
} | ||
|
||
enum ParameterKeys { | ||
static let maestroFilePath: String = "maestroFlowPath" | ||
} | ||
|
||
typealias ExecutorParameters = [String: Any] | ||
enum ExecutorFactory { | ||
static func createExecutor( | ||
for type: ExecutorType, | ||
parameters: ExecutorParameters = [:] | ||
) -> Executor? { | ||
switch type { | ||
case .maestro: | ||
guard let flowPath = parameters[ParameterKeys.maestroFilePath] as? String else { | ||
log(message: "❌ Used of type `maestro` will need to specify --maestro-flow-path", color: .red) | ||
return nil | ||
} | ||
return MaestroExecutor(flowPath: flowPath) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file modified
BIN
+7 Bytes
(100%)
...oj/project.xcworkspace/xcuserdata/hoanganhtuan.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
leaks Report Version: 4.0 | ||
Process 3651: 42333 nodes malloced for 6720 KB | ||
Process 3651: 4 leaks for 160 total leaked bytes. | ||
|
||
4 (160 bytes) << TOTAL >> | ||
|
||
2 (64 bytes) ROOT CYCLE: <Apartment 0x600003afd580> [32] | ||
1 (32 bytes) person --> ROOT CYCLE: <Person 0x600003afd5e0> [32] | ||
apartment --> CYCLE BACK TO <Apartment 0x600003afd580> [32] | ||
|
||
1 (48 bytes) ROOT LEAK: <HomeViewModel 0x6000034bcd20> [48] | ||
1 (48 bytes) ROOT LEAK: <HomeViewModel 0x6000034bd320> [48] | ||
|