From 758e7e70ac0b49b92abc4bd693d0a48ce227a175 Mon Sep 17 00:00:00 2001 From: Filip Rechtoris Date: Fri, 6 Nov 2015 11:28:11 +0100 Subject: [PATCH] Robot workshop testcrunch --- Config.robot | 5 ++ Resources/Selenium.robot | 16 ++++++ Testsuites/LinkedIn.robot | 15 ++++++ Testsuites/REST_APIs.robot | 31 +++++++++++ Testsuites/YPS_tests - intial.robot | 54 +++++++++++++++++++ .../YPS_tests_-_test_init_and_teardown.robot | 22 ++++++++ 6 files changed, 143 insertions(+) create mode 100644 Config.robot create mode 100644 Resources/Selenium.robot create mode 100644 Testsuites/LinkedIn.robot create mode 100644 Testsuites/REST_APIs.robot create mode 100644 Testsuites/YPS_tests - intial.robot create mode 100644 Testsuites/YPS_tests_-_test_init_and_teardown.robot diff --git a/Config.robot b/Config.robot new file mode 100644 index 0000000..7ca6f62 --- /dev/null +++ b/Config.robot @@ -0,0 +1,5 @@ +*** Variables *** +${ip_address} 10.0.13.69 +${port} 8443 +${login} safeq +${password} password diff --git a/Resources/Selenium.robot b/Resources/Selenium.robot new file mode 100644 index 0000000..6cdff56 --- /dev/null +++ b/Resources/Selenium.robot @@ -0,0 +1,16 @@ +*** Settings *** +Library Selenium2Library + +*** Keywords *** +Test init + Open Browser http://10.0.13.69:8080 firefox + Maximize Browser Window + +Test teardown + Close Browser + +Prepare data + ${r1} = Evaluate random.randint(1000, 999999) random,sys + ${r2} = Evaluate random.randint(1000, 999999) random,sys + Set Test Variable ${userId} ${r1} + Set Test Variable ${testerName} tester-${r2} diff --git a/Testsuites/LinkedIn.robot b/Testsuites/LinkedIn.robot new file mode 100644 index 0000000..bcb43fa --- /dev/null +++ b/Testsuites/LinkedIn.robot @@ -0,0 +1,15 @@ +*** Settings *** +Library Selenium2Library + +*** Test Cases *** +Find Petr Neugebauer on LinkedIN + Open Browser http://www.linkedin.cz/ firefox + Maximize Browser Window + Input Text name=first Petr + Input Text name=last Neugebauer + Click Element name=search + Click Link Petr Neugebauer + Page Should Contain Testing is like sex. If it’s not fun, then you’re doing it wronk + Sleep 3 + Capture Page Screenshot + Close All Browsers diff --git a/Testsuites/REST_APIs.robot b/Testsuites/REST_APIs.robot new file mode 100644 index 0000000..354350b --- /dev/null +++ b/Testsuites/REST_APIs.robot @@ -0,0 +1,31 @@ +*** Settings *** +Resource ../Resources/Selenium.robot +Library RequestsLibrary +Library urllib +Library uuid +Library json.JSONEncoder ensure_ascii=False +Resource ../Config.robot +Library OperatingSystem + +*** Test Cases *** +Create customer + Prepare data + ${auth}= Create List safeq password + Create Session main_session https://10.0.13.69:8443/payment-system/api/v2/ auth=${auth} + ${data} Create Dictionary guid=${userId} name=${testerName} lookupKey=${testerName} minimumBalance=0.00 state=ENABLED + ${jsondata}= json.JSONEncoder.Encode ${data} + ${headers}= Create Dictionary Content-Type=application/json;charset=UTF-8 + ${response} Post main_session /customer ${jsondata} headers=${headers} + Should Be Equal As Strings ${response.status_code} 201 + Delete All Sessions + +Create customer with configuration file + Prepare data + ${auth}= Create List ${login} ${password} + Create Session main_session https://${ip_address}:${port}/payment-system/api/v2/ auth=${auth} + ${data} Create Dictionary guid=${userId} name=${testerName} lookupKey=${testerName} minimumBalance=0.00 state=ENABLED + ${jsondata}= json.JSONEncoder.Encode ${data} + ${headers}= Create Dictionary Content-Type=application/json;charset=UTF-8 + ${response} Post main_session /customer ${jsondata} headers=${headers} + Should Be Equal As Strings ${response.status_code} 201 + Delete All Sessions diff --git a/Testsuites/YPS_tests - intial.robot b/Testsuites/YPS_tests - intial.robot new file mode 100644 index 0000000..d54ef21 --- /dev/null +++ b/Testsuites/YPS_tests - intial.robot @@ -0,0 +1,54 @@ +*** Settings *** +Library Selenium2Library + +*** Test Cases *** +Create customer + Open Browser http://10.0.13.69:8080 firefox + Click Link Payment System Administration + Input Text username safeq + Input Text password password + Click Button log-in + Click Link create-customer + Input Text guid 1 + Input Text create-customer-name Tester + Input Text create-customer-lookup-key tester + Input Text create-customer-initial-balance 0 + Click Button Create customer + Close Browser + +Create customer with verification + Open Browser http://10.0.13.69:8080 firefox + Click Link Payment System Administration + Input Text username safeq + Input Text password password + Click Button log-in + Page Should Contain YSoft Payment System (1.25.31), Copyright© 2000-2015 + Click Link create-customer + Input Text guid 1 + Input Text create-customer-name Tester + Input Text create-customer-lookup-key tester + Input Text create-customer-initial-balance 0 + Click Button Create customer + Page Should Contain Customer has been created. + Click Button Log out + Close Browser + +Create unique customer with verification + ${r1} = Evaluate random.randint(1000, 999999) random,sys + ${r2} = Evaluate random.randint(1000, 999999) random,sys + Open Browser http://10.0.13.69:8080 firefox + Maximize Browser Window + Click Link Payment System Administration + Input Text username safeq + Input Text password password + Click Button log-in + Page Should Contain YSoft Payment System (1.25.31), Copyright© 2000-2015 + Click Link create-customer + Input Text guid ${r1} + Input Text create-customer-name Tester-${r2} + Input Text create-customer-lookup-key tester-${r2} + Input Text create-customer-initial-balance 0 + Click Button Create customer + Page Should Contain Customer has been created. + Click Button Log out + Close Browser diff --git a/Testsuites/YPS_tests_-_test_init_and_teardown.robot b/Testsuites/YPS_tests_-_test_init_and_teardown.robot new file mode 100644 index 0000000..f64a20b --- /dev/null +++ b/Testsuites/YPS_tests_-_test_init_and_teardown.robot @@ -0,0 +1,22 @@ +*** Settings *** +Suite Setup Test init +Suite Teardown Test teardown +Library Selenium2Library +Resource ../Resources/Selenium.robot + +*** Test Cases *** +Create customer + Prepare data + Click Link Payment System Administration + Input Text username safeq + Input Text password password + Click Button log-in + Page Should Contain YSoft Payment System (1.25.31), Copyright© 2000-2015 + Click Link create-customer + Input Text guid ${userId} + Input Text create-customer-name ${testerName} + Input Text create-customer-lookup-key ${testerName} + Input Text create-customer-initial-balance 0 + Click Button Create customer + Page Should Contain Customer has been created. + Click Button Log out