Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how does QA test code and merge with a stable branch in mercurial?

My dev team is just starting out with Mercurial and we're confused on the following point:

We are a php webdev team.

We have 3 developers. Most of what we are doing now is bugfixes on a very new product. Also doing some new feature development.

We have 2 QA people. Every bugfix and feature must be tested before it is allowed to go live.

So far, each developer has his own repository. We have a central sever called WebDev with it's own repo. A developer pulls from WebDev, then makes some changes (ie, fixes a bug), and pushes to Webdev. Then a QA tester will test the code on the central server (so testing on the code in WebDev) and if it works, he will push that code to our production server.

This does not work well, because... what happens when Developer-1 (dev-1) fixes a bug, and pushes to WebDev. At the same time, dev-2 fixes a different bug and pushes to WebDev. the QA person tests the code there, and approves the second bugfix but not the first. How would he push the second changeset to production without the first one as well? We seem to be losing all the advantages of a version control system.

I've read up a lot on branching, but I cannot figure out how to make this work for us... do we create a new branch for every bugfix and new feature, and the only after it is tested, QA will merge into the default branch on WebDev? Is that the best way, or is there something I am missing?

Thanks!!

----UPDATE----

thanks to everyone who answered so far. here is where i am holding now... i can think of two solutions.

1) dev-1 fixes a bug for bug-101. he pulls from webdev, merges and commits locally. he sets it in-testing. QA pulls directly from his repository, and test locally. if it passes, QA will pull from webdev ->merge -> push to webdev (and if its a big change, can review again there to make sure it is fine). so we are only testing one thing at a time, WebDev only contains changes that have been tested locally by the testers and is always stable.

2) create branches for everything. dev-1 creates branch "bugfix-101" then pushes to webdev without merging it. QA can test the branched code, and if it's approved, merge it with the default branch. I have four questions on this method - (a) is it possible to push an open branch to a remote repository? (b) if QA merges and closes the branch on webdev, the next time i pull, will my local repo also close and merge the branch? and (c) how do you test from the branched code? when i run the web app in the browser, how do i test from the branch?? (d) are there performance issues with creating so many named branches (assuming that most of them will get closed quickly)?

Thanks again.

like image 885
esther h Avatar asked Dec 20 '11 19:12

esther h


3 Answers

Folow up to Bassam:

Your team is obviously missing the (really easy) branching and merging in Mercurial and working with a monolitic (?) default branch.

Just change your thinking and workflow slightly and you will see a big difference:

  1. Each QA-member has a permanent clone of the repo and only pulls a developer's repo on request (it's faster, pulled changes are more visible); maybe branch QA also have sense
  2. Use a separate branch for each and every big change (feature or bugfix)
  3. When a dev has a changeset X in branch "Bugfix Y" in his repo finished and ready to test, he asks QA to "pull and test changeset X"
  4. QA does that, maybe merges "Bugfix Y" to the "QA" branch in his repo (as a "test passed" sign?) and merges the "QA" branch to mainline ("Stable" or "default" branch), and finally pushes the results to needed destinations (WebDev and Prod?)
  5. On every next request step 4 must n\be repeated

This way you never mix in one approve-cycle more than one development action

like image 121
Lazy Badger Avatar answered Nov 09 '22 06:11

Lazy Badger


This is a good place to use tags. Have either the dev or qa person tag the release containing only the changes they want, and then the qa person can clone the repository at the tag level (or update the repository to the tagged changeset if that fits better for you... your preference). Then do the test using the tagged version of the code.

As a side note, it would be worth looking into these two answers on the Kiln stackexchange site to see Fog Creek's repository strategies (see how they eat their own dog food):

  • http://kiln.stackexchange.com/questions/354/release-repo-suggestions/355#355
  • http://kiln.stackexchange.com/questions/500/should-i-use-more-than-one-repository/504#504

Update

There is a good description in this post about why it is better to fix bugs in a stable branch and push them back to dev, while using a dev branch for features (which get pushed back to the stable branch as well... two way pushing/pulling). This is how we do it as well. It is not directly answering your question, but is related enough that I thought I'd include it.

like image 39
Jason Down Avatar answered Nov 09 '22 07:11

Jason Down


Creating branches with Mercurial is a breeze, use that :) I would create separate branches for different feature and different bugs and have the QA person merge them to the main branch whenever the ensure that a bug is fixed.

Another alternative is to use named branches which is essentially the same thing but instead of seperate branches, your named branches is going side by side with the default branch until they are ready to be merged in.

Note: We have been alternating between both strategies at my work place.

like image 1
Bassam Mehanni Avatar answered Nov 09 '22 06:11

Bassam Mehanni