Is there a way to run tests on a git branch while working on another?

I have a large test suite that needs to be run before I push my changes back to the repo used by CI. Ideally, I would like to use the following workflow:

  • Create a branch for developing a function or fixing bugs;
  • Develop a function in this thread using TDD, but perform only the most obvious related tests;
  • After development is complete, run the entire test suite;
  • While I run the entire test suite (20 minutes), I would like to start another function in another branch.

If I do a git check, my whole working copy is changed to this branch, so I cannot run my tests. Maybe I should use 2 working copies, but I would prefer a more elegant solution.

edit: typo

+6
source share
1 answer

You will need to make a second working copy; Keep in mind that your next implementation function may not be a new branch, but instead uses an existing branch or a branch based on another branch (something that means that you will check the code that returns your last function implementation during a test run )

You can make a script to handle all of this - you may finish the development of the current function, and then run the "buildandtesteverything {featurebranchname}" script. the script will move to the directory containing the root of your git repository, clone the repository into a temporary folder (checking the named branch), and then run your tests and clear it after itself.

+5
source

Source: https://habr.com/ru/post/890764/


All Articles