December 06, 2014
On Friday, 5 December 2014 at 20:25:49 UTC, Walter Bright wrote:
> On 12/5/2014 1:27 AM, Paulo Pinto wrote:
>> Just because code has tests, doesn't mean the tests are testing what they
>> should. But if they reach the magical percentage number then everyone is happy.
>
> I write unit tests with the goal of exercising every line of code. While one can argue that that doesn't really test what the code is supposed to be doing, my experience is that high coverage percentages strongly correlate with few problems down the road.

It at the very least that is is not dead code and not crashing.
It is already something.
December 06, 2014
On Friday, 5 December 2014 at 20:43:03 UTC, paulo pinto wrote:
> On Friday, 5 December 2014 at 20:25:49 UTC, Walter Bright wrote:
>> On 12/5/2014 1:27 AM, Paulo Pinto wrote:
>>> Just because code has tests, doesn't mean the tests are testing what they
>>> should. But if they reach the magical percentage number then everyone is happy.
>>
>> I write unit tests with the goal of exercising every line of code. While one can argue that that doesn't really test what the code is supposed to be doing, my experience is that high coverage percentages strongly correlate with few problems down the road.
>
> I imagine you haven't seen unit tests written by off-shore contractors....
>
> For example, you can have coverage without asserts.

Code review my friend. Nothing gets in without review, and as
won't usually don't enjoy the prospect of having to fix the shit
of a coworker, one ensure that coworker wrote proper tests.
December 06, 2014
On Friday, 5 December 2014 at 20:43:03 UTC, paulo pinto wrote:
> I imagine you haven't seen unit tests written by off-shore contractors....
>
> For example, you can have coverage without asserts.

Also as a side note, the test framework I use at work raise
warning for test that do not assert anything. You then have to
justify warning in code review.
December 06, 2014
On 6/12/2014 5:45 a.m., Dicebot wrote:
> In my opinion OOP is very unfriendly for testing as a paradigm in
> general. The very necessity to create mocks is usually an alarm.

I really need to start saving quotes. This is definitely a keeper!
December 06, 2014
On Saturday, 6 December 2014 at 01:31:59 UTC, deadalnix wrote:
> On Friday, 5 December 2014 at 20:43:03 UTC, paulo pinto wrote:
>> On Friday, 5 December 2014 at 20:25:49 UTC, Walter Bright wrote:
>>> On 12/5/2014 1:27 AM, Paulo Pinto wrote:
>>>> Just because code has tests, doesn't mean the tests are testing what they
>>>> should. But if they reach the magical percentage number then everyone is happy.
>>>
>>> I write unit tests with the goal of exercising every line of code. While one can argue that that doesn't really test what the code is supposed to be doing, my experience is that high coverage percentages strongly correlate with few problems down the road.
>>
>> I imagine you haven't seen unit tests written by off-shore contractors....
>>
>> For example, you can have coverage without asserts.
>
> Code review my friend. Nothing gets in without review, and as
> won't usually don't enjoy the prospect of having to fix the shit
> of a coworker, one ensure that coworker wrote proper tests.

Good luck making that work in companies.

Code review is something for open source projects and agile conferences.

--
Paulo

December 06, 2014
On Saturday, 6 December 2014 at 01:53:03 UTC, Rikki Cattermole wrote:
> On 6/12/2014 5:45 a.m., Dicebot wrote:
>> In my opinion OOP is very unfriendly for testing as a paradigm in
>> general. The very necessity to create mocks is usually an alarm.
>
> I really need to start saving quotes. This is definitely a keeper!

Except that in procedural code that option doesn't even exist, so no testing without going to the network.
December 06, 2014
On 12/5/2014 11:54 PM, Paulo Pinto via Digitalmars-d wrote:
> On Saturday, 6 December 2014 at 01:31:59 UTC, deadalnix wrote:
>> Code review my friend. Nothing gets in without review, and as
>> won't usually don't enjoy the prospect of having to fix the shit
>> of a coworker, one ensure that coworker wrote proper tests.
>
> Good luck making that work in companies.
>
> Code review is something for open source projects and agile conferences.

I've worked at several companies, both large and gigantic, and it's worked very well at all of them.  Code reviews are an important part of healthy and quality code development processes.
December 06, 2014
On Sat, 06 Dec 2014 07:54:32 +0000
Paulo Pinto via Digitalmars-d <digitalmars-d@puremagic.com> wrote:

> On Saturday, 6 December 2014 at 01:31:59 UTC, deadalnix wrote:
> > On Friday, 5 December 2014 at 20:43:03 UTC, paulo pinto wrote:
> >> On Friday, 5 December 2014 at 20:25:49 UTC, Walter Bright wrote:
> >>> On 12/5/2014 1:27 AM, Paulo Pinto wrote:
> >>>> Just because code has tests, doesn't mean the tests are
> >>>> testing what they
> >>>> should. But if they reach the magical percentage number then
> >>>> everyone is happy.
> >>>
> >>> I write unit tests with the goal of exercising every line of code. While one can argue that that doesn't really test what the code is supposed to be doing, my experience is that high coverage percentages strongly correlate with few problems down the road.
> >>
> >> I imagine you haven't seen unit tests written by off-shore contractors....
> >>
> >> For example, you can have coverage without asserts.
> >
> > Code review my friend. Nothing gets in without review, and as won't usually don't enjoy the prospect of having to fix the shit of a coworker, one ensure that coworker wrote proper tests.
> 
> Good luck making that work in companies.
> 
> Code review is something for open source projects and agile conferences.
hm. i should tell my mates that our company with 100+ employers from several countries is doing something wrong, as no code can be commited here without review...


December 06, 2014
On Saturday, 6 December 2014 at 08:36:28 UTC, ketmar via Digitalmars-d wrote:
> On Sat, 06 Dec 2014 07:54:32 +0000
> Paulo Pinto via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>
>> On Saturday, 6 December 2014 at 01:31:59 UTC, deadalnix wrote:
>> > On Friday, 5 December 2014 at 20:43:03 UTC, paulo pinto wrote:
>> >> On Friday, 5 December 2014 at 20:25:49 UTC, Walter Bright wrote:
>> >>> On 12/5/2014 1:27 AM, Paulo Pinto wrote:
>> >>>> Just because code has tests, doesn't mean the tests are testing what they
>> >>>> should. But if they reach the magical percentage number then everyone is happy.
>> >>>
>> >>> I write unit tests with the goal of exercising every line of code. While one can argue that that doesn't really test what the code is supposed to be doing, my experience is that high coverage percentages strongly correlate with few problems down the road.
>> >>
>> >> I imagine you haven't seen unit tests written by off-shore contractors....
>> >>
>> >> For example, you can have coverage without asserts.
>> >
>> > Code review my friend. Nothing gets in without review, and as
>> > won't usually don't enjoy the prospect of having to fix the shit
>> > of a coworker, one ensure that coworker wrote proper tests.
>> 
>> Good luck making that work in companies.
>> 
>> Code review is something for open source projects and agile conferences.
> hm. i should tell my mates that our company with 100+ employers from
> several countries is doing something wrong, as no code can be commited
> here without review...

I can count with one hand the companies I have witness doing it.

--
Paulo
December 06, 2014
On Saturday, 6 December 2014 at 08:26:23 UTC, Brad Roberts via Digitalmars-d wrote:
> On 12/5/2014 11:54 PM, Paulo Pinto via Digitalmars-d wrote:
>> On Saturday, 6 December 2014 at 01:31:59 UTC, deadalnix wrote:
>>> Code review my friend. Nothing gets in without review, and as
>>> won't usually don't enjoy the prospect of having to fix the shit
>>> of a coworker, one ensure that coworker wrote proper tests.
>>
>> Good luck making that work in companies.
>>
>> Code review is something for open source projects and agile conferences.
>
> I've worked at several companies, both large and gigantic, and it's worked very well at all of them.  Code reviews are an important part of healthy and quality code development processes.

Maybe I have worked at wrong companies then.

In 20 years of career I can count with one hand those that did it, and most developers hated it. Never lasted more than a few meetings.

--
Paulo