2017-12-19 19 views
-1

私はロボットフレームワークを初めて使用しており、ロボットフレームワークを通じてPOSTリクエストを行う必要があります。私はpostmanツールを使って投稿要求を正常に実行することができます。以下は、私は郵便配達ツールで生成されたcurlコマンドです:ロボットフレームワークからPOSTリクエストを行う必要があります

curl -X POST \ 
    http://ip:port/ai/data/upload \ 
    -H 'content-type: multipart/form-data \ 
    -F '[email protected]:\Users\xyz\Desktop\report.html' \ 
    -F clientId=client \ 
    -F subClientId=test \ 
    -F fileType=compliance 

誰かがロボットで上記カール要求の同等で私を助けることができます。アレックスはあなたがcommand.shファイル内の別 https://github.com/bulkan/robotframework-requests

ストア命令(カール...)の顔をしているし、その後でこのcommand.shファイルを実行したいと思い示唆したように

+0

[そう]へようこそ。質問は特定の基準を満たすことが期待されます。これらは[ask]ページに説明されています。さらに、私たちはあなたにすでにある程度の努力を費やされていることを期待しています。あなたが模倣したい 'curl'ステートメントを提供してくれましたが、あなたが試したことのRobot Framework Codeはありません。これは私にはあなたがまだ問題に十分な時間を費やしておらず、働くコードがほしいと思うだけであることを示唆しています。これは何のためのものではありません。 –

答えて

0

プロセスライブラリhttp://robotframework.org/robotframework/2.8.6/libraries/Process.html

コード:

*** Settings *** 
Library Process 
*** Variables *** 
*** Test cases *** 
Test Requests 
    test process 
*** Keywords *** 
test process 
    ${handle}= Start Process command.sh  #make sure your robotfile and command.sh is in same directory or give path till sh file 
0

使用ロボットRequestsLibrary

ここには、マルチパートファイルのアップロードに関する関連リンクがあります。

https://github.com/bulkan/robotframework-requests/issues/131

これを試してみてください:

*Settings* 

Library RequestsLibrary 
Library OperatingSystem 

*Test Case* 
Test One 
    &{data}= Create Dictionary foo=bar 
    Create File foobar content=foobarcontent 
    &{files}= Evaluate {'foofile': open('foobar')} 
    ${resp}= Evaluate 
    ... requests.post('http://localhost:8000/foo', data=$data, files=$files) 
    ... modules=requests 
    Log ${resp} console=${TRUE} 
関連する問題