Skip to content
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

putting tests at next level #5

Open
franiglesias opened this issue Aug 4, 2018 · 6 comments
Open

putting tests at next level #5

franiglesias opened this issue Aug 4, 2018 · 6 comments

Comments

@franiglesias
Copy link
Collaborator

Yesterday I was thinking in a sort of set up (prepare scenario) and tear down (remove scenario) for test cases, and just see pr #4 where you implement in part this idea.

In fact, what I am thinking of is a sort of "callback" in the testAll.sh script that looks for and execute a global set up (and tear down after all tests are finished) and even one test case based.

With this you can isolate the scenario creation from the test itself so they will become easier to understand.

@pkristian
Copy link
Owner

hm, could you visualize schema you have in mind? pseudocode will be anough. because i am afraid i do not fully understand how it should look like.
maybe #4 is place where it could fall into?

@franiglesias
Copy link
Collaborator Author

testAll.sh is sort of a generic test runner. Sometimes you need to create a scenario for the test to run (in this case you need to create repositories, directories, etc). Sometimes this scenario is common for all the tests, and sometimes is different.

The idea is something like:

#!/usr/bin/env bash

set -e

cd "$(dirname "$0")"

if [ -e "./setUp.sh" ];then
    bash "./setUp.sh"
fi

countTests=0
countFailed=0

for testCase in $(ls -d */)
do
{
    countTests=$((countTests + 1))

    expected="$(cat $testCase/expected)"

    # execute if present bash $testCase/setUp.sh
    actual="$(bash $testCase/command.sh)"
    # execute if present bash $testCase/tearDown.sh

   # all other stuff 
}
done

if [ -e "./tearDown.sh" ];then
    bash "./tearDown.sh"
fi

# all other stuff

The setUp.sh scripts are optional and used to prepare scenarios
The tearDown.sh scripts are optional and used to remove scenarios, so you leave the system clean

@pkristian
Copy link
Owner

oh, thank you! i like this, so i should create TestAll.sh make more generic, aye? copy :)

@pkristian
Copy link
Owner

extended duplicate of #4

@pkristian
Copy link
Owner

i decidet this should be sole PR... :) thx @franiglesias ! :)

@pkristian pkristian reopened this Aug 5, 2018
@pkristian pkristian changed the title set up and tear down for tests putting tests an next level Aug 5, 2018
@pkristian
Copy link
Owner

pkristian commented Aug 5, 2018

  • setUp and TearDown
  • comprimed test remote
  • failing test diff

@pkristian pkristian changed the title putting tests an next level putting tests at next level Aug 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants