PycURLLibrary is client-side URL transfer test library based on PycUrl for Robot Framework.
It supports FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, IMAP, SMTP, POP3 and RTSP. libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, Kerberos4), file transfer resume, http proxy tunneling and more!
Example:
Setting | Value | Value |
---|---|---|
Library | PycURLLibrary |
Test Case | Action | Argument | Argument | Argument |
---|---|---|---|---|
My Test | [Documentation] | Example test | ||
Verbose | ||||
Insecure Ssl | ||||
Set Url | http://localhost:53004/soap | |||
Headers File | ./headers-file.txt | |||
Client Certificate File | ./client_cert.cer | |||
Private Key File | ./privkey.pem | |||
Post Fields File | ./soap-request.xml | |||
Perform | ||||
Log Response | ||||
Response Status Should Contain | 200 | |||
${root}= | Parse Xml | |||
Should Contain Element | ${root} | .//{http://ws.poc.jivalo/hello/v1}customer | ||
${elem}= | Find First Element | ${root} | .//name | |
Element Should Contain | ${elem} | Hello, world! |
- cURL must be installed
- PycUrl must be installed.
- Python-dev should be installed
NOTE: PycURL must not be binded with GnuTLS (Unfortunately at least Debian based distribution has wrong SSL library binded with; OpenSSL should be used instead) in order to work properly.
-
sudo apt-get install curl
-
sudo apt-get install python-dev
-
PycURL build from source; see information below
If connection establishemnt failes with message then GnuTLS is used for SSL connections:
gnutls_handshake() failed: A TLS fatal alert has been received.
Then OpenSSL must be used for SSH connections. Verify GnuTLS:
>>> import pycurl
>>> pycurl.version
'libcurl/7.22.0 GnuTLS/2.12.14 zlib/1.2.3.4 libidn/1.23 librtmp/2.3'
-
sudo apt-get install build-essential fakeroot dpkg-dev
-
sudo apt-get install libcurl4-openssl-dev
-
mkdir ~/python-pycurl-openssl
-
cd ~/python-pycurl-openssl
-
apt-get source python-pycurl
-
cd pycurl_7.19.0
-
Edit the debian/control file and replace all instances of "libcurl4-gnutls-dev" to "libcurl4-openssl-dev"
-
Edit the debian/pathes/10_setup.py.dpatch file and replace HAVE_CURL_GNUTLS with HAVE_CURL_OPENSSL
-
Edit the debian/changelog file by adding new version pycurl (7.19.0-4ubuntu3+openssl) precise; urgency=low
* Rebuild to use OpenSSL dependency instead GnuTLS. -- Markku Saarela <ivalo@iki.fi> Wed, 18 Sep 2013 09:15:26 +0000
-
dpkg-buildpackage -rfakeroot -b
-
sudo dpkg -i ../python-pycurl_7.19.0-4ubuntu3+openssl_amd64.deb
After this procedure output should be following:
'libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3'
For cURL and pycURL installation look here:
-
cURL downloads: http://curl.haxx.se/download.html.
-
pycURL downloads: http://pycurl.sourceforge.net/download/ (Select OpenSSL version)
pip install robotframework-pycurllibrary
The source code can be retrieved either as a source distribution or as a clone of the main source repository.
Install it with following command:
python setup.py install
python
import PycURLLibrary
pip install robotframework-pycurllibrary --upgrade