Parallel testing with python and selenium.
0There are different approach to run your tests, if you run your test locally then you should not send jobs concurrently to a single RS server.More than 2 tests at the same time will consistently affect performance such that any reduction in test time will not be significant.
regular ways:->
$ python test1.py$ python test2.py$ python test3.py$ python test4.py
or else small script that runs them automatically
import os
import glob
tests = glob.glob('test*.py')
for test in tests:
os.system('python %s' % test)
running time faster than before
second approach:->
from subprocess import Popen
import globtests = glob.glob('test*.py')processes = []for test in tests: processes.append(Popen('python %s' % test, shell=True))for process in processes: process.wait()You can see execution time is much much faster than earlier.
Executing Selenium 2 using Python Language.
0Install the Python Client.
Download
http://selenium.googlecode.com/files/selenium-server-standalone-2.14.0.jar
start the selenium server.
java -jar selenium-server-standalone-2.14.0.jar
Example¶
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time
browser = webdriver.Firefox() # Get local session of firefox
browser.get("http://www.yahoo.com") # Load page
assert "Yahoo!" in browser.title
elem = browser.find_element_by_name("p") # Find the query box
elem.send_keys("seleniumhq" + Keys.RETURN)
time.sleep(0.2) # Let the page load, will be added to the API
try:
browser.find_element_by_xpath("//a[contains(@href,'http://seleniumhq.org')]")
except NoSuchElementException:
assert 0, "can't find seleniumhq"
browser.close()
Download and installed python client on Selenium 2
0Download the latest version of selenium(2.17)
As i have already explain in my previous post to setup Setuptools and Virtualenv on window machine in replacement of PIP.
Go to the ‘C:\Selenium\Python27\Scripts and install python client.
C:\Selenium\Python27\Scripts>easy_install -U selenium
You will see, it will read process,installed and finish processing.
Setup Python dev env on Windows.
0
Installation
download the latest version of Python visiting http://www.python.org/
Once installed, you must modify the PATH environment variable.
Go to Start -> Settings -> Control Panel -> System. Under the Advanced tab, find the Environment Variables button. Under System Variables, find Path or PATH, click Edit and add this to your PATH (assuming that your Python installation is in C:\..\python27\)
make sure to add below path to the env variable.
;C:\Python27\;C:\Python27\Lib\site-packages;C:\Python27\Scripts\
Next go to window terminal
c:\>python
you should get python version number details and your python is installed.
Setuptools and Virtualenv for python application development.
To install setuptools visit http://pypi.python.org/pypi/setuptools
(Download ez_setup.py for 64bits window machine )
go to the Download path on window prompt and run:c:\..>ez_setup.py
For Virtualenv simply easy_install it with the following command
C:\..\Python27\Scripts>ez_setup.py
Eclipse plugin for Python:
URLs for Aptana Studio 3 (with PyDev preinstalled):
Eclipse plugin (update manager URL): http://download.aptana.com/studio3/plugin/install
or
URLs for PyDev as Eclipse plugin
| Related link:->
http://pypi.python.org/pypi/setuptools http://pydev.org/download.html |
jmeter-interview-questions-and-answers.
0Please go through the below link for more details.
http://java-success.blogspot.com/2011/10/jmeter-interview-questions-and-answers.html
Testing Web service using Web Service Client.
0please go through the below link for more details.
http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/WebServiceClient/WebServiceClient.html
SQL’s and ant scripting Execution.
0Steps to install ANT and Run a simple Hello world ANT script
1. Download ANT 1.7.1 from ant.apache.org, unzip it to a directory
2. Make sure JAVA_HOME is set on your windows PC c:\>echo %JAVA_HOME%
3. Set ANT_HOME in windows environment variables
4. Set PATH for ANT, C:\ant.1.7.1\bin
5. Go to command prompt test your ant installation by typing c:\> ant
Buildfile: build.xml does not exist!
Build failed
this error is because , by default ant try to find a build.xml file in current working dir.
6. Create a build.xml and place it on current dir. and run ant again.
7. All set
8. try this ant -f build1.xml createTables_MySQL.
build.xml:->
<project name=“Database creation” basedir=“.”>
<property name=“sql.driver” value=“org.gjt.mm.mysql.Driver”/>
<property name=“sql.url” value=“jdbc:mysql://localhost/sample_project”/>
<property name=“sql.user” value=“”/>
<property name=“sql.pass” value=“”/>
<target name=“createTables_MySQL”>
<sql driver=“${sql.driver}” url=“${sql.url}” userid=“${sql.user}” password=“${sql.pass}” >
<classpath>
<pathelement location=“mysql-connector-java-3.0.9-stable-bin.jar”/>
</classpath>
use sample_project;
<transaction src=“employees.sql”/>
<transaction src=“project.sql”/>
<transaction src=“timetable.sql”/>
</sql>
</target>
</project>
<!–
– File: TIMETABLE.sql
CREATE TABLE TIMETABLE (
PROJECT_ID BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
EMPLOYEE_ID BIGINT NOT NULL
);
– File: PROJECT.sql
CREATE TABLE PROJECT (
PROJECT_ID BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
PROJECT_NAME TEXT NOT NULL
);
– File: EMPLOYEES.sql
CREATE TABLE EMPLOYEES (
EMPLOYEE_ID BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
EMPLOYEE_NAME TEXT NOT NULL
);
–>
Cucumber(BDD) and Slenium 2.
0An agile software development technique that encourages collaboration between developers, QA and non-technical or business participants in a software project.
BDD focuses on obtaining a clear understanding of desired software behavior through discussion with stakeholders. It extends TDD by writing test cases in a natural language that non-programmers can read.
Cucumber is a framework for writing and executing high level descriptions of your software’s functionality. Call these tests, examples, specifications, whatever… it doesn’t matter too much. The advantage of this is that these feature descriptions can be written and/or understood by non-technical people involved in the project.
Cucumber plays a central role in a development approach called Behaviour Driven Development (BDD).
More Details on Cucumber and how to use,integrate with Selenium, please go through the below link.
http://thomassundberg.wordpress.com/2011/10/18/testing-a-web-application-with-selenium-2/
Managing an Agile Performance Test Cycle.
0I have very good article as mentioned below about agile process on performance test Cycle.
Selenium and Agile Automation Tool.
0
Selenium is an automation tool that can be used to test the functionality in a web based project, automation is an integral part of Agile based environment. Always keeps in mind our code should be robust and reusable so that other teams or developer can reused the automated script whenever they need it when there is a changes to the requirement.
Here is different opinion and comment regarding how selenium is implemented on Agile based environment.
http://www.seleniumwiki.com/
http://submissions2008.agilealliance.org/node/2766/
http://www.kohl.ca/blog/archives/000183.html
www.informit.com/articles/article.aspx?p=462520
http://www.javaworld.com/javaworld/jw-08-2011/110823-atdd-for-web-apps.html?page=1
http://blog.dutchworks.nl/2009/08/05/automated-functional-testing-with-webdriver/
http://www.slideshare.net/saucelabs/selenium-2-conversion-challenges