From f9400060134ea27ee1f717d837ed7ea203baab82 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Tue, 1 Aug 2023 17:44:35 -0700 Subject: [PATCH] Improve Test Coverage (#10) --- .swiftlint.yml | 12 +- Tests/UITests/TestApp.xctestplan | 14 ++ .../UITests/UITests.xcodeproj/project.pbxproj | 22 ++++ .../xcshareddata/xcschemes/TestApp.xcscheme | 122 ++++++++++++++++++ 4 files changed, 163 insertions(+), 7 deletions(-) create mode 100644 Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme diff --git a/.swiftlint.yml b/.swiftlint.yml index 3785d94..732f89f 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -141,8 +141,6 @@ only_rules: - implicitly_unwrapped_optional # Identifiers should use inclusive language that avoids discrimination against groups of people based on race, gender, or socioeconomic status - inclusive_language - # If defer is at the end of its parent scope, it will be executed right where it is anyway. - - inert_defer # Prefer using Set.isDisjoint(with:) over Set.intersection(_:).isEmpty. - is_disjoint # Discouraged explicit usage of the default separator. @@ -329,8 +327,6 @@ only_rules: - unowned_variable_capture # Catch statements should not declare error variables without type casting. - untyped_error_in_catch - # Unused reference in a capture list should be removed. - - unused_capture_list # Unused parameter in a closure should be replaced with _. - unused_closure_parameter # Unused control flow label should be removed. @@ -371,16 +367,18 @@ only_rules: # The variable should be placed on the left, the constant on the right of a comparison operator. - yoda_condition +attributes: + attributes_with_arguments_always_on_line_above: false + deployment_target: # Availability checks or attributes shouldn’t be using older versions that are satisfied by the deployment target. iOSApplicationExtension_deployment_target: 16.0 iOS_deployment_target: 16.0 -attributes: - attributes_with_arguments_always_on_line_above: false - excluded: # paths to ignore during linting. Takes precedence over `included`. - .build - .swiftpm + - .deriveddata + - Tests/UITests/.deriveddata closure_body_length: # Closure bodies should not span too many lines. - 35 # warning - default: 20 diff --git a/Tests/UITests/TestApp.xctestplan b/Tests/UITests/TestApp.xctestplan index 3f6fca6..a826459 100644 --- a/Tests/UITests/TestApp.xctestplan +++ b/Tests/UITests/TestApp.xctestplan @@ -9,6 +9,20 @@ } ], "defaultOptions" : { + "codeCoverage" : { + "targets" : [ + { + "containerPath" : "container:..\/..", + "identifier" : "SpeziLocalStorage", + "name" : "SpeziLocalStorage" + }, + { + "containerPath" : "container:..\/..", + "identifier" : "SpeziSecureStorage", + "name" : "SpeziSecureStorage" + } + ] + }, "targetForVariableExpansion" : { "containerPath" : "container:UITests.xcodeproj", "identifier" : "2F6D139128F5F384007C25D6", diff --git a/Tests/UITests/UITests.xcodeproj/project.pbxproj b/Tests/UITests/UITests.xcodeproj/project.pbxproj index fd6ff38..e4490df 100644 --- a/Tests/UITests/UITests.xcodeproj/project.pbxproj +++ b/Tests/UITests/UITests.xcodeproj/project.pbxproj @@ -148,6 +148,7 @@ 2F6D138E28F5F384007C25D6 /* Sources */, 2F6D138F28F5F384007C25D6 /* Frameworks */, 2F6D139028F5F384007C25D6 /* Resources */, + 2F7CC6072A79D80300F42D90 /* ShellScript */, ); buildRules = ( ); @@ -243,6 +244,27 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 2F7CC6072A79D80300F42D90 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if [ \"${CONFIGURATION}\" = \"Debug\" ]; then\n export PATH=\"$PATH:/opt/homebrew/bin\"\n if which swiftlint > /dev/null; then\n cd ../../ && swiftlint\n else\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\n fi\nfi\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 2F6D138E28F5F384007C25D6 /* Sources */ = { isa = PBXSourcesBuildPhase; diff --git a/Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme b/Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme new file mode 100644 index 0000000..a5d3573 --- /dev/null +++ b/Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +