@@ -191,113 +191,45 @@ if [ "$VERIFY_INSTALL" = true ]; then
191191 echo " "
192192
193193 # Install from TestPyPI with PyPI as fallback for dependencies
194- if pip install --index-url https://test.pypi.org/simple/ \
195- --extra-index-url https://pypi.org/simple/ \
196- robotframework-jsonlib; then
197- echo " "
198- print_success " Installation successful"
199-
194+ pip install robotframework jsonpath-ng jsonschema > /dev/null 2>&1
195+ while ! pip install --index-url https://test.pypi.org/simple/ robotframework-jsonlib==$VERSION ; do
196+ print_info " Version not found yet in https://test.pypi.org/simple, retrying..."
197+ sleep 10
198+ done
199+ echo " "
200+ print_success " Installation successful"
201+
200202 print_info " Testing Python import..."
201203 python -c " from JSONLib import JSONLib; print('✓ Package imports correctly')"
202204 python -c " from JSONLib.__version__ import __version__; print(f'✓ Version: {__version__}')"
203205 print_success " Python import test passed"
204206
205207 echo " "
206- print_info " Creating Robot Framework test in /tmp..."
208+ print_info " Preparing acceptance tests in /tmp..."
207209
208210 # Create test directory
209211 TEST_DIR=" /tmp/robotframework_jsonlib_testpypi_verify_$$ "
210- mkdir -p " $TEST_DIR "
211-
212- # Create test JSON file
213- cat > " $TEST_DIR /test.json" << 'EOF '
214- {
215- "name": "TestPyPI Verification",
216- "version": "1.0.0",
217- "features": ["json", "jsonpath", "jsonschema"],
218- "metadata": {
219- "author": "Test User",
220- "verified": false
221- }
222- }
223- EOF
224-
225- # Create JSON schema file
226- cat > " $TEST_DIR /test_schema.json" << 'EOF '
227- {
228- "type": "object",
229- "properties": {
230- "name": {"type": "string"},
231- "version": {"type": "string"},
232- "features": {"type": "array"},
233- "metadata": {"type": "object"}
234- },
235- "required": ["name", "version"]
236- }
237- EOF
212+ mkdir -p " $TEST_DIR /tests/json"
213+ mkdir -p " $TEST_DIR /acceptance"
238214
239- # Create Robot Framework test
240- cat > " $TEST_DIR /verify_jsonlib.robot" << 'EOF '
241- *** Settings ***
242- Library JSONLib
243-
244- *** Test Cases ***
245- Verify JSON Loading
246- [Documentation] Test loading JSON from file
247- ${json}= Load Json From File ${CURDIR}/test.json
248- Should Not Be Equal ${json} ${None}
249- Log ✓ JSON loaded successfully
250-
251- Verify Get Value From JSON
252- [Documentation] Test getting values using JSONPath
253- ${json}= Load Json From File ${CURDIR}/test.json
254- ${name}= Get Value From Json ${json} $.name
255- Should Be Equal As Strings ${name[0]} TestPyPI Verification
256- ${features}= Get Value From Json ${json} $.features
257- Length Should Be ${features[0]} 3
258- Log ✓ Get value works correctly
259-
260- Verify Update Value
261- [Documentation] Test updating JSON values
262- ${json}= Load Json From File ${CURDIR}/test.json
263- ${json}= Update Value To Json ${json} $.metadata.verified ${True}
264- ${verified}= Get Value From Json ${json} $.metadata.verified
265- Should Be True ${verified[0]}
266- Log ✓ Update value works correctly
267-
268- Verify Add Object
269- [Documentation] Test adding objects to JSON
270- ${json}= Load Json From File ${CURDIR}/test.json
271- ${new_data}= Create Dictionary test=success timestamp=2024-01-01
272- ${json}= Add Object To Json ${json} $.metadata ${new_data}
273- ${test_value}= Get Value From Json ${json} $.metadata.test
274- Should Be Equal As Strings ${test_value[0]} success
275- Log ✓ Add object works correctly
276-
277- Verify JSON Schema Validation
278- [Documentation] Test JSON schema validation
279- ${json}= Load Json From File ${CURDIR}/test.json
280- Validate Json By Schema File ${json} ${CURDIR}/test_schema.json
281- Log ✓ Schema validation works correctly
282-
283- Verify Convert JSON To String
284- [Documentation] Test converting JSON to string
285- ${json}= Load Json From File ${CURDIR}/test.json
286- ${json_string}= Convert Json To String ${json}
287- Should Contain ${json_string} TestPyPI Verification
288- Log ✓ JSON to string conversion works correctly
289- EOF
215+ # Copy acceptance tests
216+ cp " $SCRIPT_DIR /acceptance/JSONLib.robot" " $TEST_DIR /acceptance/"
217+ print_success " Copied acceptance tests"
290218
291- print_success " Test files created in $TEST_DIR "
219+ # Copy test JSON files (required by acceptance tests)
220+ cp " $SCRIPT_DIR /tests/json/example.json" " $TEST_DIR /tests/json/"
221+ cp " $SCRIPT_DIR /tests/json/example_schema.json" " $TEST_DIR /tests/json/"
222+ cp " $SCRIPT_DIR /tests/json/broken_schema.json" " $TEST_DIR /tests/json/"
223+ print_success " Copied test JSON files"
292224
293225 echo " "
294- print_info " Running Robot Framework test ..."
226+ print_info " Running acceptance tests with Robot Framework..."
295227 echo " "
296228
297- # Run Robot Framework test
298- if robot -d " $TEST_DIR /results" " $TEST_DIR /verify_jsonlib .robot" ; then
229+ # Run acceptance tests
230+ if robot -d " $TEST_DIR /results" " $TEST_DIR /acceptance/JSONLib .robot" ; then
299231 echo " "
300- print_success " Robot Framework test passed!"
232+ print_success " Acceptance tests passed!"
301233
302234 echo " "
303235 echo -e " ${GREEN} Test Results:${NC} "
@@ -310,10 +242,10 @@ EOF
310242
311243 # Show test summary
312244 if [ -f " $TEST_DIR /results/output.xml" ]; then
313- echo -e " ${GREEN} All Robot Framework tests passed successfully!${NC} "
245+ echo -e " ${GREEN} All acceptance tests passed successfully!${NC} "
314246 fi
315247 else
316- print_error " Robot Framework test failed!"
248+ print_error " Acceptance tests failed!"
317249 echo " "
318250 echo -e " ${YELLOW} Test output available at:${NC} "
319251 echo " Report: $TEST_DIR /results/report.html"
0 commit comments