2017-12-19 7 views
-1

저는 로봇 프레임 워크에 익숙하지 않으며 로봇 프레임 워크를 통해 POST 요청을해야합니다. 우편 배달부 도구를 통해 게시 요청을 성공적으로 실행할 수 있습니다.로봇 프레임 워크를 통한 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)'문장을 제공했지만, 시도한 것에 대한 로봇 프레임 워크 코드는 없습니다. 이것은 나에게 당신이 아직 문제에 대한 충분한 시간을 보지 못했을뿐 아니라 작업 코드를 원한다고 제안한다. 이것은 무엇을위한 것이 아닙니다. –

답변

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}