Hello, I am new to Asterisk, just wrote my first module.
I have been trying all day to come up with an ATS test for my dial plan.
Can anyone advise on how to set this up ?
My dial plan
[main-menu]
exten => s,1,Answer()
same => n,Playback(welcome) ; Play a welcome message
same => n,Read(choice,enter-option,1) ; Prompt the user to enter an option
; Toggle module enablement if user presses 1
exten => 1,1,Verbose(1,Toggle module enablement)
same => n,Set(GLOBAL(APP_KNISPER_ENABLE)=${IF($[${ISNULL(${GLOBAL(APP_KNISPER_ENABLE)})} | $[${GLOBAL(APP_KNISPER_ENABLE)} = 0]]?1:0)})
same => n,Goto(main-menu,s,1)
; Set AGE variable to 60 if user presses 2
exten => 2,1,Verbose(1,Set AGE to 60)
same => n,Set(GLOBAL(APP_KNISPER_AGE)=60)
same => n,Goto(main-menu,s,1)
; Set AGE variable to 70 if user presses 3
exten => 3,1,Verbose(1,Set AGE to 70)
same => n,Set(GLOBAL(APP_KNISPER_AGE)=70)
same => n,Goto(main-menu,s,1)
; Set AGE variable to 80 if user presses 4
exten => 4,1,Verbose(1,Set AGE to 80)
same => n,Set(GLOBAL(APP_KNISPER_AGE)=80)
same => n,Goto(main-menu,s,1)
; Set AGE variable to custom value (two digits) if user presses 5
exten => 5,1,Verbose(1,Enter custom AGE value)
same => n,Read(AGE,enter-age) ; Prompt the user to enter a custom age
same => n,Set(GLOBAL(APP_KNISPER_AGE)=${AGE})
same => n,Goto(main-menu,s,1)
; Hang up if user doesn't press 1, 2, 3, 4 or 5
exten => i,1,Hangup()
exten => t,1,Hangup()
exten => e,1,Hangup()
What I would like to test:
properties:
run: 1
test:
- name: test_1
dtmf: "1"
variable: "APP_KNISPER_ENABLE"
expected_value: "1"
- name: test_2
dtmf: "2"
variable: "APP_KNISPER_AGE"
expected_value: "60"
- name: test_3
dtmf: "3"
variable: "APP_KNISPER_AGE"
expected_value: "70"
- name: test_4
dtmf: "4"
variable: "APP_KNISPER_AGE"
expected_value: "80"
- name: test_5
dtmf: "5"
custom_age_dtmf: "45"
variable: "APP_KNISPER_AGE"
expected_value: "45"
I have built the ATS, but I had to use Python 3.9 because of bug in 3.11.
I have created a folder in tests named knisper, and add a test-config.yaml,
and then I try to run it as follows :
./runInVenv.sh /usr/bin/python3.9 runtests.py -t tests/knisper
Error is
ValueError: tests/knisper: Missing properties section