Skip to content

Commit

Permalink
Merge pull request #97 from blyscuit/chore/test-plan
Browse files Browse the repository at this point in the history
[Chore] Add Test Plan
  • Loading branch information
blyscuit authored Dec 19, 2022
2 parents d403c28 + 087a20b commit bd823bc
Show file tree
Hide file tree
Showing 10 changed files with 304 additions and 10 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/ios_sanity_full_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: iOS Sanity Full Tests

on:
schedule:
- cron: '0 0/3 * * *'
workflow_dispatch:

defaults:
run:
working-directory: iosApp

jobs:
test:
name: Test
runs-on: macOS-latest
timeout-minutes: 60
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.10.0
with:
access_token: ${{ github.token }}

- name: Set up JAVA 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- name: Checkout source code
uses: actions/checkout@v2.3.2
with:
ref: develop
submodules: recursive

- name: Setup Konfig Properties
env:
KMM_KONFIG_PROPERTIES: ${{ secrets.KMM_KONFIG_PROPERTIES }}
run: |
cd ../buildSrc/src/main/kotlin/appPackage
touch BuildKonfig.kt
echo $KMM_KONFIG_PROPERTIES | base64 --decode > BuildKonfig.kt
- name: Cache gems
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install Bundle and check environment versions
run: |
echo 'Install Bundle'
bundle config path vendor/bundle
bundle install
echo 'Check environment setup versions'
ruby --version
gem --version
bundler --version
- name: Cache Gradle
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Generate KMM frameworks for Cocoapods
run: |
cd ..
./gradlew generateDummyFramework
- name: Cache Pods
uses: actions/cache@v2
id: cocoapodCache
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Pods Dependencies
run: bundle exec pod install

- name: Build and Test
run: bundle exec fastlane build_and_full_test
17 changes: 9 additions & 8 deletions iosApp/.swiftlint.yml → .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
included:
- Survey
- SurveyTests
- SurveyUITests
- iosApp/Survey
- iosApp/SurveyTests
- iosApp/SurveyUITests

excluded:
- SurveyTests/Sources/Mocks/Sourcery/AutoMockable.generated.swift
- Survey/Sources/Supports/Helpers/Rswift/R.generated.swift
- Pods
- Derived
- DerivedData
- iosApp/SurveyTests/Sources/Mocks/Sourcery/AutoMockable.generated.swift
- iosApp/Survey/Sources/Supports/Helpers/Rswift/R.generated.swift
- iosApp/Pods
- iosApp/Derived
- iosApp/DerivedData
- iosApp/vendor

opt_in_rules:
- anyobject_protocol
Expand Down
43 changes: 43 additions & 0 deletions iosApp/CICDTests.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"configurations" : [
{
"id" : "907BC089-7FF9-4CC2-B76C-526FB9AF9732",
"name" : "Configuration 1",
"options" : {
"uiTestingScreenshotsLifetime" : "keepNever"
}
}
],
"defaultOptions" : {
"targetForVariableExpansion" : {
"containerPath" : "container:Survey.xcodeproj",
"identifier" : "3AC192947DB2FAD63AFCCAEB",
"name" : "Survey"
}
},
"testTargets" : [
{
"target" : {
"containerPath" : "container:Survey.xcodeproj",
"identifier" : "0DC8F1540991EF674B7401A8",
"name" : "SurveyTests"
}
},
{
"skippedTests" : [
"LoginSpec\/a_Login_screen__its_open__it_shows_its_ui_components()",
"LoginSpec\/a_Login_screen__its_open__when_fill_in_invalid_credentials__shows_an_alert_after_the_request_fails()",
"LoginSpec\/a_Login_screen__its_open__when_fill_in_valid_credentials__shows_home_screen()",
"ResetPasswordSpec\/a_Reset_Password_screen__its_open__its_reset_button__when_email_is_valid__shows_notification_and_hides_loading_indicator()",
"ResetPasswordSpec\/a_Reset_Password_screen__its_open__shows_its_ui_components()",
"SurveyLoadingSpec"
],
"target" : {
"containerPath" : "container:Survey.xcodeproj",
"identifier" : "E7449C1BBC882ADE61DB38AC",
"name" : "SurveyUITests"
}
}
],
"version" : 1
}
2 changes: 1 addition & 1 deletion iosApp/Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ swiftformat.check_format

# Swiftlint
swiftlint.binary_path = 'iosApp/Pods/SwiftLint/swiftlint'
swiftlint.config_file = 'iosApp/.swiftlint.yml'
swiftlint.max_num_violations = 20
swiftlint.lint_all_files = true
swiftlint.lint_files(
inline_mode: true,
fail_on_error: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3AC192947DB2FAD63AFCCAEB"
BuildableName = "Survey.app"
BlueprintName = "Survey"
ReferencedContainer = "container:Survey.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug Staging"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0DC8F1540991EF674B7401A8"
BuildableName = "SurveyTests.xctest"
BlueprintName = "SurveyTests"
ReferencedContainer = "container:Survey.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E7449C1BBC882ADE61DB38AC"
BuildableName = "SurveyUITests.xctest"
BlueprintName = "SurveyUITests"
ReferencedContainer = "container:Survey.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug Staging"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3AC192947DB2FAD63AFCCAEB"
BuildableName = "Survey.app"
BlueprintName = "Survey"
ReferencedContainer = "container:Survey.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Debug Staging"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3AC192947DB2FAD63AFCCAEB"
BuildableName = "Survey.app"
BlueprintName = "Survey"
ReferencedContainer = "container:Survey.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug Staging">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release Staging"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand All @@ -28,6 +28,12 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<TestPlans>
<TestPlanReference
reference = "container:CICDTests.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -48,6 +54,26 @@
BlueprintName = "SurveyUITests"
ReferencedContainer = "container:Survey.xcodeproj">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "LoginSpec/a_Login_screen__its_open__it_shows_its_ui_components()">
</Test>
<Test
Identifier = "LoginSpec/a_Login_screen__its_open__when_fill_in_invalid_credentials__shows_an_alert_after_the_request_fails()">
</Test>
<Test
Identifier = "LoginSpec/a_Login_screen__its_open__when_fill_in_valid_credentials__shows_home_screen()">
</Test>
<Test
Identifier = "ResetPasswordSpec/a_Reset_Password_screen__its_open__its_reset_button__when_email_is_valid__shows_notification_and_hides_loading_indicator()">
</Test>
<Test
Identifier = "ResetPasswordSpec/a_Reset_Password_screen__its_open__shows_its_ui_components()">
</Test>
<Test
Identifier = "SurveyLoadingSpec">
</Test>
</SkippedTests>
</TestableReference>
</Testables>
</TestAction>
Expand Down
3 changes: 3 additions & 0 deletions iosApp/Survey.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions iosApp/fastlane/Constants/Constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ def self.TESTS_SCHEME
'Survey Staging'
end

# a scheme name for testing
def self.FULL_TESTS_SCHEME
'Survey Staging Extended Tests'
end

# a target name for tests
def self.TESTS_TARGET
'SurveyTests'
Expand All @@ -63,6 +68,11 @@ def self.UI_TESTS_TARGET
'SurveyUITests'
end

# a target name for Test Plan
def self.TEST_PLAN
'CICDTests'
end

# xcov output directory path
def self.XCOV_OUTPUT_DIRECTORY_PATH
'./fastlane/xcov_output'
Expand Down
8 changes: 8 additions & 0 deletions iosApp/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ platform :ios do
lane :build_and_test do
test_manager.build_and_test(
scheme: Constants.TESTS_SCHEME,
testplan: Constants.TEST_PLAN
)
end

desc 'Build and Full Test'
lane :build_and_full_test do
test_manager.build_and_test(
scheme: Constants.FULL_TESTS_SCHEME,
targets: [Constants.TESTS_TARGET, Constants.UI_TESTS_TARGET]
)
end
Expand Down
14 changes: 14 additions & 0 deletions iosApp/fastlane/Managers/TestManager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,18 @@ def build_and_test(scheme:, targets:)
fail_build: false
)
end

def build_and_test(scheme:, testplan:)
@fastlane.scan(
scheme: scheme,
device: @device,
output_directory: @output_directory,
code_coverage: true,
result_bundle: true,
testplan: testplan,
number_of_retries: 2,
output_remove_retry_attempts: true,
fail_build: false
)
end
end

0 comments on commit bd823bc

Please sign in to comment.