Updated Branches:
refs/heads/master 3d10f700f -> 48540dcf5
CLOUDSTACK-2282: Selenium Headless configuration using PhantomJS.
Description:
Putting in selenium_headless support.
Command Line parameter added for management server ip.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/48540dcf
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/48540dcf
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/48540dcf
Branch: refs/heads/master
Commit: 48540dcf5621d0cd7a925e8da299a3ef2d7d0c31
Parents: 3d10f70
Author: Parth Jagirdar <[email protected]>
Authored: Wed May 1 10:44:26 2013 -0700
Committer: Edison Su <[email protected]>
Committed: Wed May 1 17:17:15 2013 -0700
----------------------------------------------------------------------
test/selenium/ReadMe.txt | 36 ++++++++++++++++-------
test/selenium/lib/initialize.py | 17 ++++++++++-
test/selenium/smoke/Login_and_Accounts.py | 5 ++-
test/selenium/smoke/main.py | 2 +-
4 files changed, 45 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48540dcf/test/selenium/ReadMe.txt
----------------------------------------------------------------------
diff --git a/test/selenium/ReadMe.txt b/test/selenium/ReadMe.txt
index 30b0e0d..bc968f1 100644
--- a/test/selenium/ReadMe.txt
+++ b/test/selenium/ReadMe.txt
@@ -1,31 +1,41 @@
##############################################
+
+Questions? Post'em @ [email protected]
+
+##############################################
+
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.
##########################################################################################################################################
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48540dcf/test/selenium/lib/initialize.py
----------------------------------------------------------------------
diff --git a/test/selenium/lib/initialize.py b/test/selenium/lib/initialize.py
index e8cc49a..55e5d9a 100644
--- a/test/selenium/lib/initialize.py
+++ b/test/selenium/lib/initialize.py
@@ -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
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48540dcf/test/selenium/smoke/Login_and_Accounts.py
----------------------------------------------------------------------
diff --git a/test/selenium/smoke/Login_and_Accounts.py
b/test/selenium/smoke/Login_and_Accounts.py
index c5132d9..44b1e83 100644
--- a/test/selenium/smoke/Login_and_Accounts.py
+++ b/test/selenium/smoke/Login_and_Accounts.py
@@ -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.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48540dcf/test/selenium/smoke/main.py
----------------------------------------------------------------------
diff --git a/test/selenium/smoke/main.py b/test/selenium/smoke/main.py
index 86bb930..921192d 100644
--- a/test/selenium/smoke/main.py
+++ b/test/selenium/smoke/main.py
@@ -21,7 +21,7 @@ import xmlrunner
global DRIVER
-
+global MS_ip
# Import test cases