Recent

Author Topic: Testing driven development  (Read 7531 times)

ik

  • Jr. Member
  • **
  • Posts: 88
  • ik
    • LINESIP
Testing driven development
« on: March 10, 2011, 12:53:32 pm »
Many frameworks and IDE's today offer the ability to do test driven development, that is you first create a test and then a code that match it (please note that a unit test and tests at all does not indicate the lack of bugs but the lack of bugs in what we check in the way we check it).

Further more, many languages today have DSL and BDD based testing suites in additional to test units such as fpTest and fpTest2.

So the suggestion is to allow such "feature" in Lazarus, and to make it based on project management, so the test units and even DSL/BDD (when there will be some for Pascal/Lazarus) will be part of the project development and management.

What do you think on this idea, and what exactly is required from Lazarus in order to add such feature ?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8273
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Testing driven development
« Reply #1 on: March 10, 2011, 04:51:36 pm »
Quote
please note that a unit test and tests at all does not indicate the lack of bugs but the lack of bugs in what we check in the way we check it
And... what makes it different from the previous statement? In IT project management course I took, I was taught that way already. Tests are made before the construction begins and they're made by different persons from the coder. But it's not from programmer's point of view though.

ik

  • Jr. Member
  • **
  • Posts: 88
  • ik
    • LINESIP
Re: Testing driven development
« Reply #2 on: March 11, 2011, 11:07:58 am »
Quote
please note that a unit test and tests at all does not indicate the lack of bugs but the lack of bugs in what we check in the way we check it
And... what makes it different from the previous statement? In IT project management course I took, I was taught that way already. Tests are made before the construction begins and they're made by different persons from the coder. But it's not from programmer's point of view though.

Today at Lazarus unit tests are completely different project, and many does not use unit tests in their projects at all, or write them after they wrote the code of their application.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8273
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Testing driven development
« Reply #3 on: March 11, 2011, 12:35:57 pm »
Yes, of course. Because unit testing requires the tested unit already programmed.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6675
  • Debugger - SynEdit - and more
    • wiki
Re: Testing driven development
« Reply #4 on: March 11, 2011, 01:26:14 pm »
Yes, of course. Because unit testing requires the tested unit already programmed.

Not necessarily. It requires the interface to be finished (and empty method to be generated). Then unit tests should compile, and you one can start writing code, until te tests no longer fail.


Today at Lazarus unit tests are completely different project,
That is only a convenience matter.
And if you adapt other policies such as dividing business logic and representation, then it becomes even less of a matter.
All business logic should/could be implemented outside the application, in it's own package.
The package can be used by the tests, and since it is a package it can be open in the IDE while the test project is loaded. In fact it needs a project loaded, and since your app isn't written yet, the test is the prefect choice.

Splitting large projects over several packages also improves speed. Less time spent waiting for compilation to finish, since you always only need to work on one package.

Quote
and many does not use unit tests in their projects at all, or write them after they wrote the code of their application.
And you think they would do otherwise, if the IDE allowed them to have the test and the app open at the same time?

ik

  • Jr. Member
  • **
  • Posts: 88
  • ik
    • LINESIP
Re: Testing driven development
« Reply #5 on: March 11, 2011, 01:44:03 pm »
Quote from: Martin_fr
And you think they would do otherwise, if the IDE allowed them to have the test and the app open at the same time?

If you have test driven development as a project, that is creating the tests as part of the application, it can help for more people to create tests imho.

For example what if the tests will be created before the project itself and for every codetools/compiler problem of non existed code you will have the ability to add the structure and then write the code for both test and the actual code itself ?

 

TinyPortal © 2005-2018