@@ -132,6 +132,8 @@ jobs:
132132 - name : Create Android test plan
133133 working-directory : Melmac
134134 run : |
135+ # If you have multiple test plans, increment this index or use a unique name
136+ PLAN_INDEX=1
135137 curl -s -X POST http://localhost:8080/test-plans \
136138 -H "Content-Type: application/json" \
137139 -d "{
@@ -159,7 +161,7 @@ jobs:
159161 ],
160162 \"executionTypeParameters\": [],
161163 \"testSuiteVersionId\": ${TEST_SUITE_ID}
162- }"
164+ }" | tee results/test_plan_${PLAN_INDEX}.json
163165
164166 - name : Run Android test suite
165167 working-directory : Melmac
@@ -209,22 +211,39 @@ jobs:
209211 echo "### Test Execution Results" >> results/summary.md
210212 log_summary
211213
214+ # Build a map of testPlanVersionId to plan config (for multiple test plans)
215+ declare -A PLAN_CONFIGS
216+ for plan_file in results/test_plan_*.json; do
217+ if [ -f "$plan_file" ]; then
218+ planVersionId=$(jq '.testPlanVersionId // .testPlanVersionID // .testPlanVersionTestPlanVersionId // empty' "$plan_file")
219+ if [ -n "$planVersionId" ]; then
220+ PLAN_CONFIGS[$planVersionId]="$plan_file"
221+ fi
222+ fi
223+ done
224+
212225 jq -c '.executionResults[]' results/suite_execution.json | while read -r exec; do
213226 testPlanVersionId=$(echo "$exec" | jq '.testPlanVersionTestPlanVersionId')
214227 passed=$(echo "$exec" | jq -r '.passed')
215228 initialTimestamp=$(echo "$exec" | jq -r '.initialTimestamp')
216229 endTimestamp=$(echo "$exec" | jq -r '.endTimestamp')
217230
218- # Fetch test plan version details (full config)
219- planVersion=$(curl -s "http://localhost:8080/test-plan-versions/$testPlanVersionId")
231+ # Use stored plan config if available, else fallback to API
232+ plan_file="${PLAN_CONFIGS[$testPlanVersionId]}"
233+ if [ -n "$plan_file" ] && [ -f "$plan_file" ]; then
234+ planVersion=$(cat "$plan_file")
235+ else
236+ planVersion=$(curl -s "http://localhost:8080/test-plan-versions/$testPlanVersionId")
237+ fi
238+
220239 if ! echo "$planVersion" | jq empty > /dev/null 2>&1; then
221240 echo "❌ Invalid JSON for planVersion: $planVersion" >> results/summary.md
222241 log_summary
223242 continue
224243 fi
225244
226245 # Get test plan name
227- testPlanId=$(echo "$planVersion" | jq '.testPlanTestPlanId')
246+ testPlanId=$(echo "$planVersion" | jq '.testPlanTestPlanId // .testPlanId // empty ')
228247 testName=$(curl -s "http://localhost:8080/test-plans/$testPlanId")
229248 if ! echo "$testName" | jq empty > /dev/null 2>&1; then
230249 echo "❌ Invalid JSON for testName: $testName" >> results/summary.md
@@ -396,7 +415,7 @@ jobs:
396415 fi
397416 log_summary
398417 fi
399-
418+
400419 - name : Upload test results artifact
401420 if : always()
402421 uses : actions/upload-artifact@v4
@@ -437,4 +456,4 @@ jobs:
437456 uses : actions/upload-artifact@v4
438457 with :
439458 name : android-backend-log
440- path : backend.log
459+ path : backend.log
0 commit comments