-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit tests for Inner Function without calling the outer function #307
Comments
Hello @emiljoshva. Why don't you define # Code not tested
Describe 'Inner'
Include common/Outer.sh
setup() {
Outer >> /dev/null # define Inner
}
It 'call Inner'
setup
When call Inner
The output should equal "Inner"
End
End But maybe you'll need to deal with contexts (I call it context swamp of ShellSpec, the contexts are too confusing to understand at first). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Outer.sh
Outer_spec.sh
Upon executing
_Running: /bin/sh [bash 4.2.46(2)-release]
..F
Examples:
Outer Test Inner Function Call call Inner
When call Inner
1.1) The output should equal Inner
1.2) WARNING: It exits with status non-zero but not found expectation
1.3) WARNING: There was output to stderr but not found expectation
Finished in 0.26 seconds (user 0.23 seconds, sys 0.05 seconds)
3 examples, 1 failure
Failure examples / Errors: (Listed here affect your suite's status)
shellspec spec/Outer_spec.sh:9 # 1) Outer Test Inner Function Call call Inner FAILED
Aborted with status code [executor: 0] [reporter: 1] [error handler: 0]
Fatal error occurred, terminated with exit status 1._
In the actual scenarios there are many inner functions and many more processing happens in the Outer(). Hence is not advisable to call Outer function everytime for an inner function.
Kindly help to write testcases for the inner functions
The text was updated successfully, but these errors were encountered: