hudson for python
上一篇 / 下一篇 2013-01-17 10:45:30 / 个人分类:单元测试
1. python 2.5.x/2.6.x
2. robat framework 2.1.x
3. jdk 1.6.x and set enviroment JAVA_HOME
4. hudson.war
5. unzip apache-ant-1.7.1-bin.zip and copy it to c:\apache-ant-1.7.1-bin
6. add c:\apache-ant-1.7.1-bin\bin to enviroment parameter
1.在配置环境变量 HUDSON_HOME C:\HUDSON
2.配置HUDSON PROJECT 参数 --->choice -->name RUN_TARGET--->choices MAIN
3.ant 配置 invoke ant C:\HUDSON\Test\Test.xml
Test.xml
<project name="Test" default="ALL">
<property environment="env" />
<property name="hudson.home" value="${env.HUDSON_HOME}"/>
<property name="project.name" value="C:/HUDSON/Test" />
<property name="runner.dir" value="${hudson.home}/Test" />
<target name="ALL">
<antcall target="${RUN_TARGET}" inheritAll="true"/>
</target>
<target name="MAIN" description="Run PHPUnit tests" depends="run,clean" />
<target name="run">
<exec executable="python" dir="${runner.dir}" resultproperty="result">
<arg value="Test.py"/>
</exec>
</target>
<target name="clean">
</target>
</project>
2. robat framework 2.1.x
3. jdk 1.6.x and set enviroment JAVA_HOME
4. hudson.war
5. unzip apache-ant-1.7.1-bin.zip and copy it to c:\apache-ant-1.7.1-bin
6. add c:\apache-ant-1.7.1-bin\bin to enviroment parameter
Preparation
- Install required software (\\nsn-intra.net\dfs\IPA2800\IPA Test_Automation\Tools&Apps\HUDSON\hudsonsoft)
- Python & python-ldap-2.3.5.win32-py2.5.msi
- Robot framework (version > 2.1.0)
- Svn command version; Slik-Subversion-1.5.4-win32.msi.zip
- JDK; Jdk-6u4-windows-i586-p.exe
- Hudson.war (version >= 1.337)
- Ant extra library: ant-contrib-0.6.jar,commons-net-2.0.jar, jakarta-oro-2.0.7.jar, put them to %ANT_HOME%\lib
- Installbeatifulsoup
- Enviroment variable configuration (Example)
- PATH
- E.g: C:\Program Files\TortoiseSVN\bin;C:\Python25\Scripts;C:\Python25;C:\Sun\SDK\jdk\bin;C:\Program Files\SlikSvn\bin;C:\aisw-DP\apache-ant-1.7.0\bin
- JAVA_HOME
- E.g: C:\Program Files\Java\jdk1.6.0_04
- HUDSON_HOME: A directory which will be used to store all hudson related data(jobs setting, result of testing...) in server
- E.g: C:\HUDSON
- ANT_HOME
- E.g: C:\aisw-DP\apache-ant-1.7.0
- PATH
- Caution!!!
- Please make sure there is no IPAMML library configured in environment variablePYTHONPATH
- Please make sure your svn command line version output is in English
Start Hudson
- Make sure there are not any other webserver that occupy tcp port 8080, or you change http port byStartup Command.
- Execute command"java -jar hudson.war"in command line.
- After hudson startup finished, open web browser and input URL"http://hostname:8080"to access it.
Global Level Configuration
- Needed File Or Directory:
- Main execution filemultibuild.xmlshould be put in "HUDSON_HOME/jobs/"
- Python filefixml.pyshould be put in "HUDSON_HOME/jobs/"
- Checkout "Tools" directory in "HUDSON_HOME/jobs/" from svn url:https://svne1.access.nokiasiemensnetworks.com/isource/svnroot/IPA_TestAutomation/trunk/Tools
- Rename Tools/ipatestrunner/src/ipatestrunner/ccrobotsettings.py.tempate to ccrobotsettings.py, and modify content to meet your requirement like following:
cc_host = '10.140.87.71'
smtp_server = 'mail.emea.nsn-intra.net'
sender_noe_account = 'jinbyu' # change in case of smtp needs auth
sender_noe_password = ''
sender_noe_mailaddr = 'jinbo.yu@nsn.com'
notification_cc_list = '' # multiple recipients delimitered by semicolon
max_number_of_processes = 1
parallel_process_polling_interval = 5
auto_version_detect = 0 # non-zero to check version from host and then checkout corresponding local copy automatically
auto_svn_update = 0 # non-zero to update automatically
analyzer_plugin = 0 # non-zero to enable this plug-in in test log.
svn_lib_branches = 'https://svne1.access.nokiasiemensnetworks.com/isource/svnroot/ipatap/ipata/ipamml/branches' # used to checkout local copy automatically
svn_case_branches = 'https://svne1.access.nokiasiemensnetworks.com/isource/svnroot/IPA_TestAutomation/branches'
log_to_workspace = 0 # if set 1, all logs will output to workspace directory, added for robot schedule
switch_package_priority = "AISW" # if set AISW, project will use package installed by AISW tool at first.
branch='dummy' # used when auto detect suspended
path_to_local_lib = 'C:/HUDSON/jobs/default_IPA_LIB/src'
path_to_local_case = 'C:/HUDSON/jobs/default_TestCase/TestCase'
message_to_tags = {'Failure when checking log entries.':'log-check-failure', # ${LOG_CHECK_FAILURE}
'Testbed configuration inappropriate for executing this test.':'not-run', # ${TESTBED_CONFIGURATION_FAILURE}
'Suite setup failed:':'not-run',
'Setup failed:':'not-run',
'Setup of the parent suite failed':'not-run'
}
tear_down_message_to_tags = {'This test did not cover all required unit types or combinations.':'partially-covered', # ${TEST_PARTIALLY_COVERED}
- Mandatory:
- Reporting Sever Parameter(FTP parameter)
- Optional:
Project Level Configuration
- Needed File Or Directory:
- Note: if use robot scheduler, some configurations maybe different. please seerobot schedulefor detail
- Create new project in hudson webhow to create new project, and build it.
- Create python files for running project acturally, see exampleproject.py
- Upload python files toworkspacedirectory of project, see examplefile project1,project2 in workspace
- Configure robot setting in python file:
common_robot_settings = [
'--loglevel', 'Trace',
'--variable', 'bug_tracker:1',
'--variable', 'logsize:4096',
'--suite', 'TestCase.DATest.TT.ATM Transport.AAL2 path management',
'--variable', 'HOST:10.56.117.19',
'--variable', 'RE_RUN_TYPE:AUTO_RESTART',
'--variable', 'RE_RUN_TIMES:2',
'--variable', 'RELEASE_TYPE:CB',
'--variable', 'CC_AUTO_SWITCH:CB98R#0',
'--variable', 'CC_AUTO_DIRECTORY:FCB_9_5_R',
]
- Mandatory Configuration In Hudson Web
- Add hudson project level parameter"RUN_TARGET"
- Configure build mode and archive in post buildbuild&post build
- Optional Configuration In Hudson Web
- Discard Old Builds
- Project level parameterAISW PROJECT NAMEfor trigger file path of AISWTOOL
- Schedule build time and select lock for synchronize some build in one DUTSchedule&Locks
- Mail notification
Useful Parameters
Project Parameters In Hudson Web
- AISW PROJECT NAME, described previously.
- RELEASE TYPE, to filter release type from trigger file in AISWTOOL.
- ROBOT_SETTING, to replace function of common_robot_settings python file partly
1.在配置环境变量 HUDSON_HOME C:\HUDSON
2.配置HUDSON PROJECT 参数 --->choice -->name RUN_TARGET--->choices MAIN
3.ant 配置 invoke ant C:\HUDSON\Test\Test.xml
<project name="Test" default="ALL">
<property environment="env" />
<property name="hudson.home" value="${env.HUDSON_HOME}"/>
<property name="project.name" value="C:/HUDSON/Test" />
<property name="runner.dir" value="${hudson.home}/Test" />
<target name="ALL">
<antcall target="${RUN_TARGET}" inheritAll="true"/>
</target>
<target name="MAIN" description="Run PHPUnit tests" depends="run,clean" />
<target name="run">
<exec executable="python" dir="${runner.dir}" resultproperty="result">
<arg value="Test.py"/>
</exec>
</target>
<target name="clean">
</target>
</project>
TAG:
标题搜索
日历
|
|||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
1 | 2 | 3 | 4 | 5 | 6 | ||||
7 | 8 | 9 | 10 | 11 | 12 | 13 | |||
14 | 15 | 16 | 17 | 18 | 19 | 20 | |||
21 | 22 | 23 | 24 | 25 | 26 | 27 | |||
28 | 29 | 30 |
我的存档
数据统计
- 访问量: 118247
- 日志数: 72
- 建立时间: 2010-09-08
- 更新时间: 2013-04-16