mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-2282: Selenium Headless configuration using PhantomJS.
Description: Putting in selenium_headless support. Command Line parameter added for management server ip.
This commit is contained in:
parent
3d10f700f9
commit
48540dcf56
@ -1,31 +1,41 @@
|
||||
##############################################
|
||||
|
||||
Questions? Post'em @ dev@cloudstack.apache.org
|
||||
|
||||
##############################################
|
||||
|
||||
This files contains following:
|
||||
|
||||
1) Installation requirements
|
||||
2) Test Pre requisites
|
||||
3) Running the Test and Generating the report
|
||||
2) Testing pre-requisites
|
||||
3) Running the Tests and Generating the report
|
||||
##############################################
|
||||
|
||||
|
||||
|
||||
##########################################################################################################################################
|
||||
|
||||
1) Installtion Requirements
|
||||
1) Installation Requirements
|
||||
---------------------------
|
||||
|
||||
|
||||
1)Firefox depending on your OS (Good to have Firebug and Selenium IDE for troubleshooting and dev work)
|
||||
1) Firefox depending on your OS (Good to have Firebug and Selenium IDE for troubleshooting and dev work)
|
||||
|
||||
|
||||
2)Install Python 2.7. Recommend to use Active State Python
|
||||
2) Install Python 2.7.
|
||||
|
||||
|
||||
3) Now Open CMD/Terminal and type all of following
|
||||
|
||||
- pypm install pycrypto (Installs Pycrypto)
|
||||
- pypm install paramiko (Install paramiko)
|
||||
- pip install pycrypto (Installs Pycrypto)
|
||||
- pip install paramiko (Install paramiko)
|
||||
- pip install unittest-xml-reporting (Install XML Test Runner)
|
||||
- pip install -U selenium (Installs Selenium)
|
||||
|
||||
4) Get PhoantomJS for your OS from http://phantomjs.org/
|
||||
|
||||
- PhantomJS will run selenium test in headless mode. Follow the instruction on PhantomJS.org.
|
||||
- Make sure the executable is in PATH. (TIP: Drop it in Python27 folder :-))
|
||||
|
||||
5) Now get the HTMLTestRunner for nice looking report generation.
|
||||
- http://tungwaiyip.info/software/HTMLTestRunner.html
|
||||
@ -35,18 +45,22 @@ This files contains following:
|
||||
##########################################################################################################################################
|
||||
|
||||
2) Test Prerequisites
|
||||
---------------------
|
||||
|
||||
- Download and install CS. /cwiki.apache.org has links to Installation Guide and API reference.
|
||||
- Log into the management server and Add a Zone. (Must be Advance Zone and Hypervisor type must be Xen)
|
||||
|
||||
- Download and install CS
|
||||
- Log into the management server nad Add a Zone. (Must be Advance Zone and Hypervisor type must be Xen)
|
||||
|
||||
##########################################################################################################################################
|
||||
|
||||
3) Running the Test and Generating the report
|
||||
---------------------------------------------
|
||||
|
||||
- Folder smoke contains main.py
|
||||
- main.py is the file where all the tests are serialized.
|
||||
- main.py supports HTML and XML reporting. Please refer to end of file to choose either.
|
||||
- Typical usage is: python main.py for XML Reporting
|
||||
- And python main.py >> results.html for HTML Reporting.
|
||||
- Typical usage is: python main.py 10.1.1.10 >> result.xml for XML Reporting
|
||||
- And python main.py 10.1.1.10 >> result.html for HTML Reporting.
|
||||
- 10.1.1.10 (your management server IP) is an argument required for main.
|
||||
|
||||
##########################################################################################################################################
|
||||
|
||||
@ -21,11 +21,26 @@ This will help pass webdriver (Browser instance) across our test cases.
|
||||
|
||||
|
||||
from selenium import webdriver
|
||||
import sys
|
||||
|
||||
DRIVER = None
|
||||
MS_ip = None
|
||||
|
||||
|
||||
def getOrCreateWebdriver():
|
||||
global DRIVER
|
||||
DRIVER = DRIVER or webdriver.Firefox()
|
||||
DRIVER = DRIVER or webdriver.PhantomJS('phantomjs') # phantomjs executable must be in PATH.
|
||||
return DRIVER
|
||||
|
||||
|
||||
def getMSip():
|
||||
global MS_ip
|
||||
if len(sys.argv) >= 3:
|
||||
sys.exit("Only One argument is required .. Enter your Management Server IP")
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
sys.exit("Atleast One argument is required .. Enter your Management Server IP")
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
MS_ip = arg
|
||||
return MS_ip
|
||||
@ -34,11 +34,12 @@ class login(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
||||
MS_URL = initialize.getMSip()
|
||||
self.driver = initialize.getOrCreateWebdriver()
|
||||
self.base_url = "http://10.223.49.206:8080/" # Your management Server IP goes here
|
||||
self.base_url = "http://"+ MS_URL +":8080/" # Your management Server IP goes here
|
||||
self.verificationErrors = []
|
||||
|
||||
|
||||
|
||||
def test_login(self):
|
||||
|
||||
# Here we will clear the test box for Username and Password and fill them with actual login data.
|
||||
|
||||
@ -21,7 +21,7 @@ import xmlrunner
|
||||
|
||||
|
||||
global DRIVER
|
||||
|
||||
global MS_ip
|
||||
|
||||
# Import test cases
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user