Contents |
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.
File structure:
How to run BOSS Participants Testing:
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
"""
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
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"]
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.
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
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
[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"]
[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']]
[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"]
[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"]
[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"]
[repomaker.case1] params = :action=>"create", :debug_dump=>'yes', :project=>'test1', :target=>'hello1' expected_result1 = ["__result__", "NOT_EQUAL", "False"]