-
Notifications
You must be signed in to change notification settings - Fork 2
4. Example Test Suite
Chesko edited this page Oct 9, 2016
·
4 revisions
The following is a complete example test suite. In this test, we want to verify that our quest starts, and when an objective is completed, the quest completes and shuts down correctly.
scriptname MurderMysteryQuestTests extends Lilac
Quest property MurderMysteryQuest auto
function TestSuites()
describe("The Murder Mystery Quest", storyQuestSuite())
endFunction
bool function storyQuestSuite()
it("should be able to start", questStartTest())
it("should complete and shut down when objective is complete", questObjectiveTest())
; return required by compiler - has no function
return true
endFunction
function beforeEach()
if MurderMysteryQuest.IsRunning()
MurderMysteryQuest.Stop()
endif
endFunction
function afterEach()
if MurderMysteryQuest.IsRunning()
MurderMysteryQuest.Stop()
endif
endFunction
bool function questStartTest()
MurderMysteryQuest.Start()
expect(MurderMysteryQuest.IsRunning(), to, beTruthy)
; return required by compiler - has no function
return true
endFunction
bool function questObjectiveTest()
MurderMysteryQuest.Start()
expect(MurderMysteryQuest.IsRunning(), to, beTruthy)
MurderMysteryQuest.SetObjectiveCompleted(1, true)
expect(MurderMysteryQuest.IsObjectiveCompleted(1), to, beTruthy)
expect(MurderMysteryQuest.IsCompleted(), to, beTruthy)
expect(MurderMysteryQuest.IsRunning(), to, beFalsy)
; return required by compiler - has no function
return true
endFunction