Upload
jack-jill
View
52
Download
0
Embed Size (px)
Citation preview
1©2011 InfoStretch Corporation. All rights reserved. www.infostretch.com
InfoStretch Test Automation FrameworkRequirements and Settings Document
By Chirag JayswalAugust 2011
2©2011 InfoStretch Corporation. All rights reserved. www.infostretch.com
Test Automation Requirements and Settings
Requirements and Settings Document
Prerequisites
1.1 Java (1.6 or Later) 1.2 ANT
Dir Structure
Application Settings
Configuration Settings
Selenium Automation Execution
Automation Test Results
APPENDIX
7.1 Setup System Environment Variables
IS Selenium Framework Download
About InfoStretch
I
II
III
IV
V
VI
VII
3
4
5
5
7
7
8
11
11
Index
3©2011 InfoStretch Corporation. All rights reserved. www.infostretch.com
Test Automation Requirements and Settings
I. Prerequisites
1.1 Java (1.6 or Later)
To check whether java is already installed in the system the following steps are performed:
1. Go to command prompt.
2. Type javac -version
It will display the version of JDK in the system.
3. Type java -version.
It will display the version of java runtime installed in the system.
If java is not present in the system, the following message is displayed:
‘java’ is not recognized as an internal or external command, operable program or batch file.
If you don’t have java 1.6 or later installed then Java can be downloaded from the link given below online. http://www.oracle.com/technetwork/java/javase/downloads/index.html
Requirements and Settings Document
4©2011 InfoStretch Corporation. All rights reserved. www.infostretch.com
Test Automation Requirements and Settings
I. Prerequisites Continued
II. Dir Structure
1.2 ANT
To check whether Apache-ant is present in the system, perform the following steps:
1. Go to command prompt.
2. Type ant.
If ant is not installed in the computer the following message is displayed:
‘ant’ is not recognized as an internal or external command, operable program or batch file.
If above message is displayed then ant has to be installed in the system before running the aravo automation scripts. Ant can be downloaded from http://ant.apache.org/bindownload.cgi
NOTE: You also required to check whether JAVA_HOME and ANT_HOME environment variable settled or not. To set it up please check appendix.
The config directory contains testrun_config.xml file, and is a place holder for run configuration files.
The lib directory contains required jar files, and is a place holder for other library jars/zips.
The resources directory contains all required resources including properties files and data files, and is a place holder for other resources.
The scripts directory contains ant script to build and run automation. It also contains bat file for windows environment.
The Server directory contains selenium server jar. Download selenium server.jar from the SeleniumHQ website and place here if one not exists.
The src directory contains all java files and is a place holder for other java files.
The bin directory contains compiled classes, and is a volatile directory that is deleted by the target clean in build.xml file.
The test-results directory contains result files.
Requirements and Settings Document
5©2011 InfoStretch Corporation. All rights reserved. www.infostretch.com
Test Automation Requirements and Settings
You can setup/verify application specific properties available under <TestAutomation_Project_root>\resources\application.properties.
Few of them are described below:
selenium.server
It is used to set the selenium host, default is localhost.
selenium.port
It is used to specify port selenium uses, default is 4444.
selenium.browser.url
It is used to specify the web application base URL on which we will perform the tests. This is one of the important properties that need to be verifying for correct value.
selenium.wait.timeout
Specify the wait timeout period for wait service to use in different wait conditions, i.e. the amount of time in milliseconds.
selenium.success.screenshots
Set this flag to 1 when you want screenshot to be captured with every verification point. It is ideally set to 0, when it captures a screenshot only in case of a failure in the test case.
III. Application Settings
IV. Configuration Settings
One can configure test execution by modifying run configuration xml file available under
<TestAutomation_Project_root>\config \testrun_config.xml
This is a standard TestNG configuration file where you can customize your test run. One of the important configuration settings is browser to be used. It can be set by providing value for browser parameter in configuration file.
<parameter name=”browser” value=”*chrome”/>
Value can be any browser string supported by selenium. For IE it can be “*iexplore” or “*iehta”.
Requirements and Settings Document
6©2011 InfoStretch Corporation. All rights reserved. www.infostretch.com
Test Automation Requirements and Settings
IV. Configuration Settings Continued
Examples:
You can run specific group, package, classes with include/exclude options.
The configuration provided below will run all test cases from all classes in package “com.automation.test”
<!DOCTYPE suite SYSTEM “http://testng.org/testng-1.0.dtd”><suite name=”Test automation” verbose=”1” > <parameter name=”browser” value=”*chrome”/> <test name=”Sample test” > <packages> <package name=”com.automation.test” /> </packages> </test></suite>
Following will run test cases only form Suit1.java except TCEx
<!DOCTYPE suite SYSTEM “http://testng.org/testng-1.0.dtd”><suite name=”Test Automation” verbose=”1” > <parameter name=”browser” value=”*chrome”/> <test name=”Sample test” > <classes> <class name=”com.automation.test.Suit1”> <methods> <exclude name=”TCEx”></exclude> </methods> </class> </classes> </test></suite>
Requirements and Settings Document
7©2011 InfoStretch Corporation. All rights reserved. www.infostretch.com
Test Automation Requirements and Settings
V. Selenium Automation Execution
VI. Automation Test Results
To specific group of test from configured classes/packages one can use method-selector.
<!DOCTYPE suite SYSTEM “http://testng.org/testng-1.0.dtd”>
<suite name=”Selenium web test Automation” verbose=”1” >
<parameter name=”browser” value=”*iehta”/>
<test name=”MockTests” >
<method-selectors>
<method-selector>
<script language=”beanshell”><![CDATA[
groups.containsKey(“Transaction”)
]]></script>
</method-selector>
</method-selectors>
<packages>
<package name=”com.automation.test” />
</packages>
</test>
</suite>
The following steps should be taken in order to execute an automation script.
1) Go to <TestAutomation_Project_root>\scripts.
2) Click on startSelenium.bat to start the selenium server.
3) Go to <TestAutomation_Project_root>\scripts\testRunner.
4) Click on seleniumTestRunner.bat to run the automation scripts for various test cases.
After completion of script execution, test results will be found under
<TestAutomation_Project_root>\test-results\<report-dir>\<Latest timestamp>.
Open index.htm to view test results.
IV. Configuration Settings Continued
Requirements and Settings Document
8©2011 InfoStretch Corporation. All rights reserved. www.infostretch.com
Test Automation Requirements and Settings
VII. APPENDIX
7.1 Setup System Environment Variables
Once java is successfully installed in the system, configure the java environment in the system by performing the following steps:
1. Right click on My Computer, and select Properties.
2. Go to Advanced tab and click on Environment Variables.The following diagram depicts some of the groups involved.
3. Go to system variables and add a new variable JAVA_HOME, if it does not already exist.
4. Enter the variable value as the install path for the Development Kit 5.
Requirements and Settings Document
9©2011 InfoStretch Corporation. All rights reserved. www.infostretch.com
Test Automation Requirements and Settings
VII. APPENDIX
5. Go to Path, click edit and add the java bin file path in the end. E.g. %JAVA_HOME%\bin
6. Go to system variables and add a new variable ANT_HOME, if it does not already exist.
Requirements and Settings Document
10©2011 InfoStretch Corporation. All rights reserved. www.infostretch.com
Test Automation Requirements and Settings
VII. APPENDIX
1. Write the ant file path in the variable value.
2. Go to Path, click edit and add the bin directory path in the end.E.g. %ANT_HOME%\bi6.
Go to system variables and add a new variable ANT_HOME, if it does not already exist.
Requirements and Settings Document
11©2011 InfoStretch Corporation. All rights reserved. www.infostretch.com
InfoStretch is ready to help you with your specific needs. Call us at (408) 727-1100 email [email protected]
InfoStretch Headquarters SANTA CLARA, CAInfoStretch Corporation2880 Lakeside Drive, Suite 200Santa Clara, CA 95054Phone (408) 727-1100 | Fax (408) [email protected] | www.infostretch.com
InfoStretch OfficesNEW YORK, NY AHMEDABAD, INDIA MUMBAI, INDIA
All registration marks are the property of their respective owners.
Download
About InfoStretch
Download the InfoStretch Selenium Framework
http://www.infostretch.com/infostretch-selenium-framework
InfoStretch specializes in Enterprise Application Testing, QA and Test Automation Services with an emphasis on Enterprise 2.0 and Cloud Infrastructure-based SaaS applications. InfoStretch delivers high-quality, reliable and cost-effective services to clients throughout the US, Europe and Asia-Pacific. InfoStretch focuses on delivering business solutions that command deep technology knowledge, process proficiency and domain expertise.
InfoStretch is a global leader in Mobile Application Development, Testing, Certification and Distribution; Quality Assurance Testing and Automation; Software as a Service (SaaS) Strategy and Enablement; and ERP Testing.
Requirements and Settings Document