← Back to team overview

elementary-dev-community team mailing list archive

Re: Testing

 

I love this topic.
David Gomes, you said that writing tests is boring, probably you are right
but that's because you tried to write them in the "second approach"
explained earlier by Dane Henson.

The problem with that is that the code that you wrote before MAYBE is not
testable, which makes your life horrible and boring.

While if we (developers) use the first approach, which is called TDD is
much better. We write the test first so we define how our app should behave
and how our code is structured already (so all the thinking of the code
structure you do it in the tests)  which is really great.

We can also do BDD , if there's no framework for this we can probably
create something, for more infos you can check cucumber for Ruby.
Bdd let's you write the tests in PLAIN english, so who does the mockups
could write the tests as well. that would be great.

I used to hate testing but Since I started doing a bit of TDD my code looks
much better.

I will try the tools suggested above and see if I can use something.

Goncalo


On Thu, Apr 4, 2013 at 2:38 PM, Dane Henson <dane@xxxxxxxxxxxxxxxx> wrote:

> David,
> I understand where you're coming from and I have worried about that in the
> past.  There are two approaches for Unit Testing.
>
> The strong approach is to figure out what you want the app to do (i.e.
> design the framework), describe that app's functions and libraries using
> tests, then write your code around it.  If at some point the requirements
> change, you can modify the Unit Tests.  It's boring, but provides a very
> stable foundation for apps.
>
> The second approach (and what we would have to do for all existing
> projects) is to write the tests around the app.  This approach is like
> trying to build a bucket around the water, but it can be done and any
> development going forward is more likely to not break the core
> functionality of the app.
>
> Would it be feasible to create a Unit Test team on launchpad with the sole
> purpose of specializing in adding testing to projects and writing the tests
> required to kill regression bugs before they kill us?
>
> Also, Adam (at Yorba) and I came up with the conclusion that rolling a new
> Unit Test framework might be the best option.  Here's a quote from Adam at
> Yorba: "You might also want to consider rolling your own simple unit
> testing framework in Vala without even using Glib.Test - sometimes I think
> that might be the easiest path forward here."
>
> So, this could be a really big project, but I see a lot of merit to it.
>
>
> On Thu, Apr 4, 2013 at 8:25 AM, David Gomes <david@xxxxxxxxxxxxxxxx>wrote:
>
>> Unit testing is boring to write so if we just said "Everybody. Write unit
>> tests. All Projects. Now." it would really take on. On companies and when
>> developers are paid to work, they can write and put tests everywhere, but
>> it's harder for us.
>>
>> For now what we just do is we test the interface, the new features and
>> some old features too to see if they remain unaffected.
>>
>>
>> On Thu, Apr 4, 2013 at 1:51 PM, Craig <weberc2@xxxxxxxxx> wrote:
>>
>>> Hello everyone,
>>>
>>> I'm curious what you devs do for testing? I'm not particularly familiar
>>> with Vala, but I'm learning a lot about testing at work and I'm trying to
>>> develop myself to that end in my free time. I'm sending this email because
>>> I'd like to get a pulse on what you Elementary devs think about testing and
>>> what you actually do to test your code. Also, please feel encouraged to
>>> talk about what you've done in the past, what has/hasn't worked for you,
>>> and generally what your philosophy is about testing (or whether you have no
>>> philosophy). Individual comments and comments on behalf of elementary as a
>>> whole are both welcome.
>>>
>>> Sound off!
>>>
>>> Thanks,
>>> Craig
>>>
>>> --
>>> Mailing list: https://launchpad.net/~elementary-dev-community
>>> Post to     : elementary-dev-community@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~elementary-dev-community
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>> --
>> Mailing list: https://launchpad.net/~elementary-dev-community
>> Post to     : elementary-dev-community@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~elementary-dev-community
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
> --
> Mailing list: https://launchpad.net/~elementary-dev-community
> Post to     : elementary-dev-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~elementary-dev-community
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References