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 


Preparation

  • Install required software (\\nsn-intra.net\dfs\IPA2800\IPA Test_Automation\Tools&Apps\HUDSON\hudsonsoft)
    1. Python & python-ldap-2.3.5.win32-py2.5.msi
    2. Robot framework (version > 2.1.0)
    3. Svn command version; Slik-Subversion-1.5.4-win32.msi.zip
    4. JDK; Jdk-6u4-windows-i586-p.exe
    5. Hudson.war (version >= 1.337)
    6. 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
    7. Installbeatifulsoup

  • Enviroment variable configuration (Example)
    1. 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
    2. JAVA_HOME
      • E.g: C:\Program Files\Java\jdk1.6.0_04
    3. 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
    4. ANT_HOME
      • E.g: C:\aisw-DP\apache-ant-1.7.0

  • Test all software installed (Command)
    1. python --help
    2. svn --help
    3. pybot --version
    4. java
    5. ant --help

  • Caution!!!
    1. Please make sure there is no IPAMML library configured in environment variablePYTHONPATH
    2. Please make sure your svn command line version output is in English

      Start Hudson

    3. Make sure there are not any other webserver that occupy tcp port 8080, or you change http port byStartup Command.
    4. Execute command"java -jar hudson.war"in command line.
    5. After hudson startup finished, open web browser and input URL"http://hostname:8080"to access it.

    Global Level Configuration

  • Needed File Or Directory:
    1. Main execution filemultibuild.xmlshould be put in "HUDSON_HOME/jobs/"
    2. Python filefixml.pyshould be put in "HUDSON_HOME/jobs/"
    3. Checkout "Tools" directory in "HUDSON_HOME/jobs/" from svn url:https://svne1.access.nokiasiemensnetworks.com/isource/svnroot/IPA_TestAutomation/trunk/Tools
    4. 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}

Project Level Configuration

  • Needed File Or Directory:
  • Note: if use robot scheduler, some configurations maybe different. please seerobot schedulefor detail
    1. Create new project in hudson webhow to create new project, and build it.
    2. Create python files for running project acturally, see exampleproject.py
    3. Upload python files toworkspacedirectory of project, see examplefile project1,project2 in workspace
    4. 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
    1. Add hudson project level parameter"RUN_TARGET"
    2. Configure build mode and archive in post buildbuild&post build

Useful Parameters

Project Parameters In Hudson Web


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>

TAG:

 

评分:0

我来说两句

Open Toolbar