13

We have someone (let's call him Ted) that is responsible for testing new features and bug fixes.

We're using Git and GitHub. master should be/is always deployable and development is where we commit/merge new features or bug fixes, but only after they have been tested by Ted.

The project is in PHP.

I'd like the testing process to go like this:

  1. A developer wants to work on a new feature (let's say the feature/bug #123 as Ted documented in the issue tracker), so he pulls origin/development to development on his local repository and creates a new branch (let's say issue-123) from there.
  2. Once he's happy with his work, he commits and pushes his new branch to origin.
  3. Ted connects to test.ourproject.com/choose-branch and sees a list of the branches on origin and chooses to switch on issue-123 (it should be doable through the webpage). He then goes on test.ourproject.com, tests the hell out of the web application (he's really pitiless) and after some back and forth with the developer, he's happy with the feature.
  4. Ted tells the developer that he can merge issue-123 onto development on origin.
  5. Rinse and repeat.

For the third step, I could hack something that does the job (showing and switching branches from a specific page), but I feel that what I've described is a very common pattern.

So my question is: Is this a good / sustainable / maintainable workflow for branching? Can you back up your answer by citing some examples of other projects following this workflow?

6
  • "tests the hell out of the webapp (he's really reckless) and after some back and forth with the dev, he's happy with the feature." - This person must be close to genius. Does he actually know what the code in question is about? There are projects like this but i really doubt in results of step 3.
    – SChepurin
    Commented Feb 22, 2013 at 11:42
  • I should have made clearer the issue-123 refers to the bug/feature #123 as Ted documents every bug/new feature on our issue tracker.
    – cpa
    Commented Feb 22, 2013 at 11:48
  • @cpa: Than make it clearer. The questions are editable.
    – Jan Hudec
    Commented Feb 22, 2013 at 11:49
  • @SChepurin: The tester does not need to know anything about the code. They just need to have a list of required features and bugs and test cases for them.
    – Jan Hudec
    Commented Feb 22, 2013 at 12:06
  • 1
    @cpa Not quite sure what you're after. You want some software that helps testers figure out what branches are available for testing, and switches branches for them? Or a process for testers for follow?
    – mjs
    Commented Mar 6, 2013 at 10:49

3 Answers 3

6

The branch workflow sounds a lot like gitflow http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow and there are support tools around it. It is highly recommended.

If there is only one tester, your testing workflow sounds fine, but if there are multiple people then development might move between start and finish, and of course testing should ideally be fully performed after any merge. This is where automated testing can really help or a slow (thorough) tester might never finish!

Another problem is that with many features and branches it becomes temping to mix and match features into a release (or to choose to evict after acceptance and merging) or perhaps if features are dependent on each other. The problem is if you start getting temped to rewrite history (rebase/delete a commit or merge) on a PUBLISHED branch-meaning one which has been pushed to a multidev repo. This is rewriting public history. It can be done for good or evil and even if done for good can cause problems to the unwary, and best practice is to avoid it so the question will never come up. However, some integration branch workflows make this very tempting, so if you have strong protection on such branches (eg gitolite per user branch restrictions) and people expect such activity so always rebase their code on such a branch, proceed--with caution!

I'd also like to recommend reading http://sethrobertson.github.com/GitBestPractices/ which discusses all of these matters and has many good references.

1
  • git-flow isn't exactly what I was looking for, but it's definitely something we need! Thanks!
    – cpa
    Commented Mar 12, 2013 at 11:06
2

I am not sure the switching page itself is a common pattern. Most projects probably simply have the tester check it out with git command.

The general approach definitely sounds reasonable.

Google even wrote Gerrit to support similar style; it's more about reviewing the code, but approving integration normally involves both review and testing. Usually it is also interconnected with continuous integration server which builds all the submissions first (I am not sure whether they use Jenkins in Google, but I believe I've seen appropriate connectors somewhere).

Git itself uses a slight variation on the theme. It's maintainer has a script that merges all pending submissions into a branch called pu (for "proposed updates" presumably; the branch is deleted and re-created each time as the pending submissions are often rebased). This is than tested by various people. If it's fine, than the submissions that are considered complete are merged into next (that's the same as your development). If not, than somebody tests the individual submissions to see which one is broken. This makes it a bit easier for the tester since they don't have to switch branches most of the time; they simply report whether the test integration works.

1

If your testing is done automatically rather than manually, I think Travis (a CI system for GitHub) will pretty much do what you want--it automatically runs tests on all pull requests. (More information about this process, including screenshots.)

Note that tests are run not on the branch, but the branch after it's been merged into master. (i.e. what you would get after merging the branch into master--you're guaranteed that tests will still run successfully post-merge.)

If commits are added to the branch, tests are re-run. (Though for some reason adding commits to master doesn't seem to re-run the tests.)

2
  • What if tests fail on the branch? Do you really want to have code on master with failing tests? ... that could have been picked up on the branch itself before merging to master? Personally I think only code that builds and passes all unit, integration and other tests should ever be merged into master, since this is where release builds sit.
    – Ash
    Commented May 31, 2017 at 5:52
  • @Ash The code is not actually merged into master; as I understand it the tests are run on essentially a temporary branch that is the result of merging the branch-under-test into master.
    – mjs
    Commented May 31, 2017 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.