Meego Wiki
Views

Release Infrastructure/BOSS Testing/Participants Testing

From MeeGo wiki
< Release Infrastructure | BOSS Testing
Revision as of 08:22, 28 February 2011 by Weifeyao (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Introduction

BOSS Participant Testing provides us with a basic functional test framework for testing all kinds of BOSS participants. This test framework itself is also a boss participant with structure based on boss-participant-template.

Usage

File structure:

  • testparticipant.py : this is a standard boss participant and is wrote based on boss-participant-template. Its function is to assert the test result specified in 'expected_result'.
  • testparticipant-client.py : this file reads test case config file and then launches a test request to BOSS.
  • testparticipant-case.conf : in this file, you can define all kinds of test cases to test BOSS participants. Each test case is grouped by participant name and case ID in brackets as identifier of this test case.


How to run BOSS Participants Testing:

  • start up BOSS and those participants which you want to test (e.g. getchangelog, bz)
  • start up testparticipant
  • python ./testparticipant-client.py -c <env config> -f <testcase_config> -p <participant_name> -i <case_id>
    e.g. python ./testparticipant-client.py -c config -f ./testparticipant-case.conf -p getchangelog -i case1

Implementation

  • Execution process
  • The purpose of this testing framework is to test BOSS participants. Its design is simple and just check test results in testparticipant after executing whatever participant which you are testing.The work flow is just like as follows.

     pdef = """
             Ruote.process_definition :name => 'test' do
               sequence do
                 #{participant_name}
                 testparticipant
               end
             end
           """
    

  • Define a functional test case
  • Each test case is just a section in testparticipant-case.conf and the section title is consisted of participant name and case ID. Then you can add fields(or items) that you want to pass onto workitem and specify expected test result in this section.

     [getchangelog.case1]
     name = just description of this test case
     project = Tools:n900
     package = flasher
     rev = 1
     expected_result1 = ["error", "EQUAL", "None"]
     expected_result2 = ["changelog", "INCLUDE", "some key words"]
     #more expected results if necessary
    

  • Define an integration test case
  • Each test case is just a section in testparticipant-case.conf and the section title is consisted of keyword 'integration' and case ID. Then you can add fields(or items) that you want to pass onto workitem and specify expected test result in this section. 'participants' and 'parentcase' are keywords in defining fields. parentcase means that you can inherit fields from those test cases which you have ever defined.

     [integration.case1]
     participants = ['getchangelog', 'notify']
     parentcase = ['getchangelog.case1', 'notify.case1']
     project = "myproject"    #here project field will overwrite the project field which has been defined in getchangelog.case1 or notify.case1
     expected_result1 = ["error", "EQUAL", "None"]
     expected_result2 = ["changelog", "INCLUDE", "some key words"]
    


  • Check test results
  • Test result checking is defined in testparticipant-case.conf. The item 'expected_result[No.]' can be multiple and indicates expected test results. It includes threee components: field name, checking condition and expected values.

    • Field name: the field contained in workitem whose value you want to check
    • Checking condition
    •   EQUAL: the value of field is equals to specified value
        NOT_EQUAL: the value of field is not equals to specified value
        INCLUDE: the value of field includes specified value
        EXCLUDE: the value of field excludes specified value
        APPROXIMATE: the value of field includes specified value or vice versa
        FILE_EXIST: the specified file is existing
        EQUAL_TO_FILE: the value of field is equals to content of specified file
        NOT_EQUAL_TO_FILE: the value of field is not equals to content of specified file
        APPROXIMATE_TO_FILE: the value of field is approximating to content of specified file
        EQUAL_TO_CMD: the value of field is equals to output of CMD
        APPROXIMATE_TO_CMD: the value of field approximating to output of CMD
        INCLUDED_IN_WEB: the value of field is included in specified webpage
      
    • Expected value: you expect to what the value of field specified above should be


  • Customize workflow
  • Sometimes you want to run your own workflow to test particular participants following specified workflows. The keyword _workflow_ indicates your workflow file path.

     [integration.case1]
     parentcase = ['defineimage.case1', 'getchangelog.case1']
     _workflow_ = file://#{Your workflow file path}
     expected_result1 = ["error", "EQUAL", "None"]
     expected_result2 = ["changelog", "INCLUDE", "some key words"]
    

    The content of workflow file may be as following.

     Ruote.process_definition :name => 'test' do
       sequence do
         defineimage :image_type=>"testing"
         getchangelog
         testparticipant
       end
     end
    

Test cases

  • boss-participant-getchangelog
  •  [getchangelog.case1]
     project = Tools:n900
     package = flasher
     rev = 1
     expected_result1 = ["changelog", "EQUAL_TO_FILE", "n900.flasher.changes"]
    
     [getchangelog.case2]
     project = Ilmatar:Accepted:release:0.2010.23.1
     package = python-which
     rev = 1
     expected_result1 = ["changelog", "NOT_EQUAL", "anything"]
    
     [getchangelog.case3]
     project = Ilmatar:Accepted
     package = video-suite
     rev = 2
     expected_result1 = ["relevant_changelog_entries", "INCLUDE", "* Wed October 1 2010 Tero Siironen   <tero.siironen@nokia.com> - 0.0.12"]
    
     [getchangelog.case4]
     params = :from=> "actions"
     actions = [{"sourceproject" : "Ilmatar:Trunk", "sourcepackage" : "video-suite", "sourcerevision" : "1", "targetproject" : "Ilmatar:Accepted", "targetpackage" : "video-suite"}]
     expected_result1 = ["relevant_changelog_entries", "INCLUDE", "* Wed October 1 2010 Tero Siironen <tero.siironen@nokia.com> - 0.0.12"]
    
     [getchangelog.case5]
     params = :from=> "actions"
     actions = [{"sourceproject" : "Ilmatar:Trunk", "sourcepackage" : "usb-moded", "sourcerevision" : "1", "targetproject" :   "Ilmatar:Accepted", "targetpackage" : "usb-moded"}]
     project = Ilmatar:Accepted
     package = usb-moded
     #rev = 2
     expected_result1 = ["relevant_changelog_entries", "INCLUDE", "* Wed October 1 2010 Tero Siironen <tero.siironen@nokia.com> - 0.0.12"]
    


  • boss-participant-bugzilla
  •  [bz.case1]
     relevant_changelog_entries = ["Fixes: BMC#214658 at '#{Time}'"]
     package = NothingForYou
     signature = '#{Time}'
     expected_result1 = ['__result__', 'EQUAL', 'True']
     expected_result2 = ['signature', 'INCLUDED_IN_WEB', ['https://projects.maemo.org/', 'bugzilla/show_bug.cgi?id=214658', 'username', 'password']]
    


  • boss-participant-defineimage
  •  [defineimage.case1]
     params = :image_type=>"testing"
     project = Tools:MeeGoInfra
     repository = openSUSE_11.2
     arch=i586
     packages=['image-creator']
     expected_result1 = ["selected_packages", "INCLUDE", "mic2"]
     expected_result2 = ["msg", "INCLUDE", "mic2"]
    
     [defineimage.case2]
     params = :image_type=>"testing"
     project = Tools:MeeGoInfra
     repository = openSUSE_11.2
     arch=i586
     packages=['boss-participant-checkprocess', 'boss-participant-swpro']
     expected_result1 = ["selected_packages", "INCLUDE", "boss-participant-checkprocess"]
     expected_result2 = ["selected_packages", "INCLUDE", "boss-participant-swpro"]
     expected_result3 = ["msg", "INCLUDE", "boss-participant-checkprocess"]
     expected_result4 = ["msg", "INCLUDE", "boss-participant-swpro"]
    


  • boss-participant-notify
  •  [notify.case1]
     params = :template=>"testing",:subject=>"just for testing notify***"
     email = ['yourname@nokia.com']
     #msg = "boss-participant-notify testing"
     expected_result1 = ["__result__", "EQUAL", "True"]
    
     [notify.case2]
     params = :template=>"testing",:subject=>"just for testing notify***"
     email = ['yourname@nokia.com']
     #msg = "boss-participant-notify testing"
     expected_result1 = ["__result__", "NOT_EQUAL", "False"]
    


  • boss-participant-obsticket
  •  [obsticket.case1]
     params = :action=>"get",:lock_project=>"project_testing"
     expected_result1 = ["__result__", "EQUAL", "True"]
    
     [obsticket.case2]
     params = :action=>"release",:lock_project=>"project_testing"
     expected_result1 = ["__result__", "EQUAL", "True"]
    


  • boss-participant-repomaker
  •  [repomaker.case1]
     params = :action=>"create", :debug_dump=>'yes', :project=>'test1', :target=>'hello1'
     expected_result1 = ["__result__", "NOT_EQUAL", "False"]
    

Resource

Personal tools