flat assembler
Message board for the users of flat assembler.

Index > Heap > Test driven development

Author
Thread Post new topic Reply to topic
malpolud



Joined: 18 Jul 2011
Posts: 344
Location: Broken hippocampus
malpolud
TDD is most common for HLL's like java, but it is possible to TDD even embedded (or not embedded) C with Unity and CppUTest harnesses. Using TDD requires that software specifications and design are very accurate. IMO it is the way to go with big projects - one just need a bit of experience using test harnesses and building tests.


Have you ever tried it? What are your thoughts about it? Maybe someone would consider building a Flat Assembler test harness? Wink

_________________
There's nothing special about it,
It's either there when you're born or not.
Post 30 Apr 2013, 07:26
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17271
Location: In your JS exploiting you and your system
revolution
What do you mean by "test harness"? I've always seen these as physical devices that plug in to something to monitor/test the system during production. Linky?
Post 30 Apr 2013, 07:48
View user's profile Send private message Visit poster's website Reply with quote
malpolud



Joined: 18 Jul 2011
Posts: 344
Location: Broken hippocampus
malpolud
Test harness is software that tests source code.

Let's consider TDD for embedded system and developing just one source file from the whole system. We have some functions and methods from the file that are supposed to be tested. The functions take some input parameters, modify some objects and return some parameters. Unit test harness runs these functions with given inputs parameters, checks if only objects that are supposed to be modified are modified in the desired way and checks if functions return desired parameters. The goal is to avoid unpredicted behavior and bugs like for example writing outside of a table. The functions could call other functions that are not included in developed files. These functions are 'mocked': we just define what these functions should do. The whole file while TDD is compiled with a regular native compiler like GCC - even if source is developed for other architecture. The idea is to build and test software pieces. TDD process is inverted to Develop and Debug approach - first you build a test, run it and it must fail. Later on you write as little code as possible to pass the test.

Links:
http://cpputest.org/
http://throwtheswitch.org/white-papers/unity-intro.html

Book I learn TDD from:
http://pragprog.com/book/jgade/test-driven-development-for-embedded-c
Post 01 May 2013, 20:11
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17271
Location: In your JS exploiting you and your system
revolution
I don't know why you call it a harness, it seems to be just normal testing modules to me.

I write test modules for all my code. There are also some rudimentary test modules included with the fasmarm source.
Post 01 May 2013, 23:28
View user's profile Send private message Visit poster's website Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
Generally, they're called "unit tests", I think. A "test harness" sounds like it's analogous to a unit test library.

FASM's macro capabilities would probably be better for writing a unit test library than assembly itself.

If you're interested in SE methodologies and similar stuff, it sounds like you'd like Extreme Programming or Agile SD. Check them out on Wikipedia.
Post 02 May 2013, 01:54
View user's profile Send private message Reply with quote
malpolud



Joined: 18 Jul 2011
Posts: 344
Location: Broken hippocampus
malpolud
While using the name "test harness" I follow the naming used in the book I linked to.

Well, I guess everybody writes some tests modules to test software, but TDD is something different. Instead of writing code, debugging it and later on testing, we got writing a test, failing it, writing code to pass the test. An important thing while TDD is not to write code when the test module is not ready.

Yes, these techniques like XP and Agile SD are quite interesting. I think that it is worth getting familiar with them to avoid some kind of mistakes.
Post 02 May 2013, 07:29
View user's profile Send private message Visit poster's website Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1409
Location: Toronto, Canada
AsmGuru62
It would be great if harness should not be re-build every time for every project.
It should be configurable in such a way that FASM functions are called by a harness, without
rebuilding a code for the harness.
Does anyone have idea how to do it?
Because all I see is that the physical call to tested functions must be done in code,
i.e. it must be recompiled every time new function is added to the test batch.
I want to test new code without re-building the harness.
Post 02 May 2013, 14:42
View user's profile Send private message Send e-mail Reply with quote
malpolud



Joined: 18 Jul 2011
Posts: 344
Location: Broken hippocampus
malpolud
Good point. I think, that some concerns here can lead to a nice design idea.
Post 03 May 2013, 07:15
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.