1

Currently, we have a feature branch development environment. Features are specified as stories that each developer takes on. Once a feature is done on a feature branch, a pull request for said feature is opened. Now two steps are left: a) test business functionality: Somebody checks whether the feature was actually implemented as specified by the story. This should ideally be somebody else than the developer b) code review: Somebody does a code review on said branch. This should ideally be somebody else than the developer

a) has an impact on b): If the functionality is not implemented as desired, the code must definitely change.

b) has an impact on a): If there is a bug in the code, the feature might be impacted.

Based on this, it seems to be a good idea to first test the business functionality (a) and then do a code review (b).

Is this true? What are flaws in this setup?

Further question: If this is a way to go for it, what kind on tooling do you use to deploy many branches? Having microservices etc. will quickly give rise to conflicts (e.g., ports overlapping, server resource limitations, ...)

1

It seems rather nitpicky to determine if the order of reading code and performing any manual testing, especially since it's an iterative process.

Since it's not stated, there's an assumption that the developer who did the work didn't just write code and throw it over the wall. They tested it, by some combination of writing automated test code as well as running some manual tests over their changes. When the code review is initiated, the developer has reasonable confidence that what they are submitting is correct as far as they have understood the work before them and the review not only includes the product changes but all automated test code as well. If any manual testing was performed, the developer should be able to explain what testing was done.

If this holds, then I don't see why you need to draw a distinction between "test business functionality" and "code review". Perhaps don't think of it as a "code review", but rather a peer review of the work - the production code, the automated testing, and the manual testing performed. The reviewer is really checking the quality of all of these things, and perhaps doing some additional exploratory work to confirm that it is suitable. Depending on the nature of the changes, the effort can be put toward different things at the discretion of the reviewer.

|improve this answer|||||
  • I agree with the notion that the dev tests what they implement and only open the branch up to more people as soon as they are confident that their implementation fulfills quality and requirements. However, we usually have someone reviewing the business functionality that has a unique insight into the requirements (also regarding UI/UX "feel" the client might desire), because they are in direct contact with the client (e.g., customer facing project management). The changes they request are usually not ones that our devs come up with, but also not ones that are easily specified beforehand. – BracketJohn Mar 18 at 17:25
  • @BracketJohn If an individual has "unique insights" and isn't sharing those with the team early, that's a huge risk for your project. Getting that relevant information to the developers early and often is critical, otherwise this one person becomes a bottleneck. It may make sense for them to review at an iteration or release level, but your development team (developers + testers) should be equipped to, with high confidence, produce something that is acceptable to end users. – Thomas Owens Mar 18 at 20:39
  • 1
    I would also add that you need to monitor – and the developers must also monitor – that the business functionality is completely and correctly understood at the beginning, immediately trying to identify anything that is ambiguous or unclear and getting an answer for it immediately. It is extremely wasteful for a programmer to think that (s)he has completed the task, only to then discover that something wasn't actually designed right, because the programmer will have put a lot of sweat into it that's now wasted. "Do it during, not after!" – Mike Robinson Mar 19 at 5:39
1

Post-Hoc Testing is an Anti-Pattern

You have succinctly described the use case for test-first development. In general, you want to first determine if you've built the right thing. Then you need to determine if you've built the thing right!

With that said, the notion of divorcing functionality from code correctness is a false dichotomy. In order to meet a useful Definition of Done, you need to do both. More importantly, design and testing need to be done in close collaboration to avoid unnecessary hand-offs and process friction.

Treating unit and acceptance testing as post-hoc activities is often a hallmark of waterfall projects and "big, upfront planning." There are still some project domains where this is required or necessary, but if you're asking the question then your specific project probably isn't one of them.

Even if you aren't following an agile methodology per se, a well-crafted Definition of Done and a test-first approach are more likely to get you the business and technical results you need than trying to determine which post-hoc activity should precede the other. The generally-correct answer is that test design should come before coding or testing, so post-hoc anything (in whatever order) is likely to be an anti-pattern.

A Further Note on Code Reviews

When done properly, a code review is a form of validated learning. Teams that collaborate on code, or that use code discussions to capture lessons learned, are often more agile because it serves as a form of continuous improvement.

Reviewing pull requests, pair programming, or mob programming aren't really "code reviews" in the gating sense of the term. In my professional experience, teams that use code reviews for gating purposes are largely papering over a gap in their current processes or tooling, and should probably consider adding continuous integration (CI), automated testing, or a better branching model to their workflows. This is even more true when the reviews are about style or correctness. The former should be represent a working agreement within the team that's enforced by automated tools, while the latter is best addressed through executable tests.

In other words, if you're using manual code reviews as a form of acceptance testing, don't! There are more effective approaches, and the team should work together to pick the one that works best for the project.

|improve this answer|||||
0

I normally do a business test after the code has been reviewed and tested by the team. This to make sure that we deliver quality software to the users for testing. This prevents them from finding any obvious bugs and raises their trust in the delivered software.

But this does not mean that the users cannot be consulted during the development of the functionality. Showing work that is in progress and checking if you are on the right path is extremely valuable. This helps you build the right things. If it works as it should you can iterate on the right way.

The right thing is more important than the right way I think, as long as you do not willingly introduce technical debt. And how to that? That depends on the functionality and the team. The right way means (for me) that code is clean, documented where needed and optimized for at the time of writing. Building the right thing first can compromise any (an other) of those things. However if you know you have the right thing, you know the time needed to make it the right way, is not wasted

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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