generated from bitwarden/template
-
Notifications
You must be signed in to change notification settings - Fork 27
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
[PM-14425] [BEEEP] Add test plans #1106
Draft
fedemkr
wants to merge
4
commits into
main
Choose a base branch
from
PM-14425/test-plans
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+245
โ1
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
68aa059
Added Test plans into the project so we can run Unit vs Snapshot testโฆ
fedemkr 1dcbdcf
PM-14425 Added test plans, also generator script and env variable cheโฆ
fedemkr 134440b
Merge branch 'main' into PM-14425/test-plans
fedemkr c299141
PM-14425 Improved generate_test_plans script and cleaned snapshot andโฆ
fedemkr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
PROJECT_PATH="Bitwarden.xcodeproj" | ||
TEST_PLAN_UNIT_PATH="TestPlans/TestPlan-Unit.xctestplan" | ||
TEST_PLAN_SNAPSHOT_PATH="TestPlans/TestPlan-Snapshot.xctestplan" | ||
SNAPSHOT_TESTS_TARGET="BitwardenSharedTests" | ||
|
||
mint install atakankarsli/[email protected] | ||
|
||
echo "๐งฑ Getting test files and adding test to plans if needed..." | ||
echo "--------" | ||
|
||
TEST_FILES=$(find ./BitwardenShared -name '*Tests*' -type f) | ||
if [ -z "$TEST_FILES" ]; then | ||
echo "โน๏ธ No test files found." | ||
exit 1 | ||
fi | ||
|
||
for FILE in $TEST_FILES; do | ||
# Get the tests that start with "test_snapshot_" | ||
TESTS=$(grep -E '^\s*func\s+test_snapshot_' $FILE | awk '{print $2}' | awk -F'(' '{print $1}') | ||
if [ -z "$TESTS" ]; then | ||
continue | ||
fi | ||
|
||
for TEST in $TESTS; do | ||
# Get the class name, there are some classes with "final" applied so we need to check that as well | ||
# to get the correct class name. | ||
CLASS_NAME=$(grep -B 5000 "func $TEST" $FILE | grep "class " | tail -n 1 | awk '{print $2}' | awk -F':' '{print $1}') | ||
if [[ "$CLASS_NAME" == "class" ]]; then | ||
CLASS_NAME=$(grep -B 5000 "func $TEST" $FILE | grep "final class " | tail -n 1 | awk '{print $3}' | awk -F':' '{print $1}') | ||
fi | ||
|
||
ENTRY_PATTERN_TO_CHECK_IF_EXISTS="${CLASS_NAME}.*${TEST}()" | ||
ENTRY="${CLASS_NAME}/${TEST}()" | ||
|
||
# Select snapshot tests in the Snapshot test plan. | ||
if ! grep -qE $ENTRY_PATTERN_TO_CHECK_IF_EXISTS $TEST_PLAN_SNAPSHOT_PATH; then | ||
mint run atakankarsli/[email protected] select $ENTRY -f $TEST_PLAN_SNAPSHOT_PATH | ||
echo "๐งช $ENTRY added to selected tests in snapshot test plan." | ||
fi | ||
|
||
# Skip snapshot tests in the Unit test plan. | ||
if ! grep -qE $ENTRY_PATTERN_TO_CHECK_IF_EXISTS $TEST_PLAN_UNIT_PATH; then | ||
mint run atakankarsli/[email protected] skip $ENTRY -f $TEST_PLAN_UNIT_PATH | ||
echo "๐งช $ENTRY added to skipped tests in unit test plan." | ||
fi | ||
done | ||
done | ||
|
||
# WORKAROUND: Currently, there is no way to select/skip test per target so they are being added to all targets | ||
# so we need to remove them from all the targets except "BitwardenSharedTests" in the Unit test plans. | ||
TEMP_OUTPUT_FILE="TestPlans/TestPlan-UnitTemp.xctestplan" | ||
|
||
jq '(.testTargets[]) |= if .target.name != "BitwardenSharedTests" then del(.skippedTests) else . end' "$TEST_PLAN_UNIT_PATH" > "$TEMP_OUTPUT_FILE" | ||
|
||
mv "$TEMP_OUTPUT_FILE" "$TEST_PLAN_UNIT_PATH" | ||
|
||
echo "๐งฑ Tests added successfully." |
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,62 @@ | ||
{ | ||
"configurations" : [ | ||
{ | ||
"id" : "1F1B495F-A80E-4BEF-8B13-35C0D33C74E9", | ||
"name" : "DefaultConfig", | ||
"options" : { | ||
|
||
} | ||
} | ||
], | ||
"defaultOptions" : { | ||
"language" : "en", | ||
"region" : "US", | ||
"testExecutionOrdering" : "random", | ||
"testTimeoutsEnabled" : true | ||
}, | ||
"testTargets" : [ | ||
{ | ||
"target" : { | ||
"containerPath" : "container:Bitwarden.xcodeproj", | ||
"identifier" : "1ACA591B401F3A38DB33C366", | ||
"name" : "BitwardenSharedTests" | ||
} | ||
}, | ||
{ | ||
"target" : { | ||
"containerPath" : "container:Bitwarden.xcodeproj", | ||
"identifier" : "417A98C7A214F8B5F141E702", | ||
"name" : "BitwardenAutoFillExtensionTests" | ||
} | ||
}, | ||
{ | ||
"target" : { | ||
"containerPath" : "container:Bitwarden.xcodeproj", | ||
"identifier" : "8E852F2FEA58332906A444C6", | ||
"name" : "BitwardenActionExtensionTests" | ||
} | ||
}, | ||
{ | ||
"target" : { | ||
"containerPath" : "container:Bitwarden.xcodeproj", | ||
"identifier" : "2AA7964F64AD34FCAE257E17", | ||
"name" : "BitwardenTests" | ||
} | ||
}, | ||
{ | ||
"target" : { | ||
"containerPath" : "container:Bitwarden.xcodeproj", | ||
"identifier" : "A046C66D01BE50457BEC672C", | ||
"name" : "AuthenticatorBridgeKitTests" | ||
} | ||
}, | ||
{ | ||
"target" : { | ||
"containerPath" : "container:Bitwarden.xcodeproj", | ||
"identifier" : "C026D25C368010616A94990A", | ||
"name" : "BitwardenShareExtensionTests" | ||
} | ||
} | ||
], | ||
"version" : 1 | ||
} |
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,29 @@ | ||
{ | ||
"configurations" : [ | ||
{ | ||
"id" : "AE7F8439-11C3-4A5A-AB62-C322355EE6A5", | ||
"name" : "DefaultConfig", | ||
"options" : { | ||
|
||
} | ||
} | ||
], | ||
"defaultOptions" : { | ||
"language" : "en", | ||
"region" : "US", | ||
"testTimeoutsEnabled" : true | ||
}, | ||
"testTargets" : [ | ||
{ | ||
"selectedTests" : [ | ||
|
||
], | ||
"target" : { | ||
"containerPath" : "container:Bitwarden.xcodeproj", | ||
"identifier" : "1ACA591B401F3A38DB33C366", | ||
"name" : "BitwardenSharedTests" | ||
} | ||
} | ||
], | ||
"version" : 1 | ||
} |
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,67 @@ | ||
{ | ||
"configurations" : [ | ||
{ | ||
"id" : "7F1F3659-44A5-4DB0-8565-F699A65B2C7D", | ||
"name" : "DefaultConfig", | ||
"options" : { | ||
|
||
} | ||
} | ||
], | ||
"defaultOptions" : { | ||
"environmentVariableEntries" : [ | ||
{ | ||
"key" : "SKIP_SIMULATOR_CHECK_FOR_TESTS", | ||
"value" : "true" | ||
} | ||
], | ||
"language" : "en", | ||
"region" : "US", | ||
"testTimeoutsEnabled" : true | ||
}, | ||
"testTargets" : [ | ||
{ | ||
"target" : { | ||
"containerPath" : "container:Bitwarden.xcodeproj", | ||
"identifier" : "C026D25C368010616A94990A", | ||
"name" : "BitwardenShareExtensionTests" | ||
} | ||
}, | ||
{ | ||
"target" : { | ||
"containerPath" : "container:Bitwarden.xcodeproj", | ||
"identifier" : "1ACA591B401F3A38DB33C366", | ||
"name" : "BitwardenSharedTests" | ||
} | ||
}, | ||
{ | ||
"target" : { | ||
"containerPath" : "container:Bitwarden.xcodeproj", | ||
"identifier" : "417A98C7A214F8B5F141E702", | ||
"name" : "BitwardenAutoFillExtensionTests" | ||
} | ||
}, | ||
{ | ||
"target" : { | ||
"containerPath" : "container:Bitwarden.xcodeproj", | ||
"identifier" : "2AA7964F64AD34FCAE257E17", | ||
"name" : "BitwardenTests" | ||
} | ||
}, | ||
{ | ||
"target" : { | ||
"containerPath" : "container:Bitwarden.xcodeproj", | ||
"identifier" : "8E852F2FEA58332906A444C6", | ||
"name" : "BitwardenActionExtensionTests" | ||
} | ||
}, | ||
{ | ||
"target" : { | ||
"containerPath" : "container:Bitwarden.xcodeproj", | ||
"identifier" : "A046C66D01BE50457BEC672C", | ||
"name" : "AuthenticatorBridgeKitTests" | ||
} | ||
} | ||
], | ||
"version" : 1 | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ค Should this be