sstephenson / bats

Bash Automated Testing System
MIT License
7.12k stars 518 forks source link

[Question] Is there any possible way to pass parameter to bats call? #204

Closed ShahriyarR closed 7 years ago

ShahriyarR commented 7 years ago

I want to pass say some parameter from command-line to be used in bats:

[root@centos7-base ~]# bats test.bats fff
bats: /root/fff does not exist
/usr/local/libexec/bats-exec-suite: line 20: let: count+=: syntax error: operand expected (error token is "+=")
ShahriyarR commented 7 years ago

@mislav Maybe you have some idea about this? :)

nilamjyotigoswami commented 7 years ago

@ShahriyarR We pass run-time argument using the following

='' bats --log script_name.bats eg : vm_type='Linux' bats --log vmcreate.bats In the script , we can use the variable $vm_type Hope it helps
ShahriyarR commented 7 years ago

Exactly, it works :) Thanks for comment. Closing now.