Using Cucumber to test function written in BASH

722 views
Skip to first unread message

Kfir Lavi

unread,
Sep 2, 2012, 7:52:04 AM9/2/12
to cukes
Hi,
I'm currently using BASH as my programing language, and use shunit2 as my unit test library.
I have thought of using cucumber to test my bash scripts.
System tests are obvious and I can use cucumber and Aruba to test the script from the outside.
My question is: Can I use Cucumber to test my bash functions? If yes, How can I do that?

Regards,
Kfir

Rob Park

unread,
Sep 2, 2012, 9:39:26 AM9/2/12
to cu...@googlegroups.com
I don't see why not. You certainly can exec stuff from the command line from your steps and then verify system results.

You may also want to check out Destroy All Software for a screencast named "Test Driving Shell Scripts". 
Gary uses shunit for that.

//rob

--
-- Rules --
 
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
 
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
 
 

Kfir Lavi

unread,
Sep 2, 2012, 10:02:37 AM9/2/12
to cu...@googlegroups.com
Thanks,
I would like to test function inside the file like:

log() {
   logger aaa
}

Then test this function with cucumber.

Kfir

aslak hellesoy

unread,
Sep 2, 2012, 10:15:09 AM9/2/12
to cu...@googlegroups.com
On Sun, Sep 2, 2012 at 12:52 PM, Kfir Lavi <lavi...@gmail.com> wrote:
> Hi,
> I'm currently using BASH as my programing language, and use shunit2 as my
> unit test library.
> I have thought of using cucumber to test my bash scripts.
> System tests are obvious and I can use cucumber and Aruba to test the script
> from the outside.

That sounds like an appropriate level of testing with Cucumber and bash scripts.

> My question is: Can I use Cucumber to test my bash functions? If yes, How
> can I do that?
>

Cucumber is not a unit testing tool. (I'd consider a bash function a
"unit"). So this would be using the wrong tool for the job.
If you need to test individual functions I'd rather use a bash unit
testing tool. I'm sure there's tons of them out there.

Aslak

Cleide Possamai

unread,
Aug 21, 2013, 1:01:25 PM8/21/13
to cu...@googlegroups.com
Hi Aslak,
Did you have proceed with the idea of using Cucumber to test your BASH programms? I got curious about it...
Cleide

Aslak Hellesøy

unread,
Aug 21, 2013, 1:21:32 PM8/21/13
to cu...@googlegroups.com

On Wednesday, 21 August 2013 at 18:01, Cleide Possamai wrote:

Hi Aslak,
Did you have proceed with the idea of using Cucumber to test your BASH programms?
I have already replied to that question in this thread. 
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages