[問題] Robot framework 錯誤訊息尋問

作者: raindeer896 (麋鹿)   2023-05-12 23:22:12
你好, 我最近在使robot framework做測試, 發生錯誤訊息如下, 想請問如何修正?
我跑了以下command
robot robot_test
錯誤訊息:
TypeError: string indices must be integers, not 'str'
我的檔案一共有三個
1. robot_test_features.robot
https://imgur.com/
2. robot_test_keywords.robot
https://imgur.com/
3. robot_test_steps.py
https://imgur.com/
4. 測試結果
https://imgur.com/
我發現我執行 robot robot_test
會出現錯誤, 想問如何修正
以下是我的嘗試
(1) 我一開始以為是我robot_test_steps.py python寫錯
assert _tradingFeeRateDict[0]["twdVolume"] == "3000000"
assert 設定錯誤, 但是我把它print 出來又發現是正確
print(_tradingFeeRateDict[0]["twdVolume"]) 結果真的是 "3000000"
(2) 後來想說是type 沒對上, 但是又發現都是str
print(type(_tradingFeeRateDict[0]["twdVolume"]))結果真的是 #<class 'str'>,
yes this is str
(3)那不然單跑這之python的unit test 看看
https://imgur.com/D9OEomw
結果還是通過 def 的function 看起來很正常
好吧, 我真的不知道我為什麼跑 robot robot_test
會失敗,想問如何修正 以上問題謝謝
作者: lycantrope (阿寬)   2023-05-13 08:39:00
改int,string就不能當indice
作者: raindeer896 (麋鹿)   2023-05-14 14:50:00
感謝回覆

Links booklink

Contact Us: admin [ a t ] ucptt.com