From rukapedia
Jump to: navigation, search

Now grabbing PlazesPHP latest. 3:59 Should we add some software tests to it?

Peter Rukavina AIM 3:59 tests like?

Olle Jonsson AIM 3:59 I mean, to make sure we can KNOW it ain't broken at any point in time. 3:59 unit tests.

Peter Rukavina AIM 3:59 unfamiliar ground for me

Olle Jonsson AIM 3:59 The SimpleTest framework is very good. It's written about, too 4:00 The site is called lastcraft

Peter Rukavina AIM 4:00 Interesting.

Olle Jonsson AIM 4:00 Docs == better

Peter Rukavina AIM 4:00 Reading now.

Olle Jonsson AIM 4:00 Thought that our fiddling minds could do better when we have some certainty that the stuff is not breaking in mid-fiddle.

Peter Rukavina AIM 4:01 Let me get my head around this, but feel free to proceed.

Olle Jonsson AIM 4:01 Np, man. Just wanted to show the idea.

Peter Rukavina AIM 4:01 Also, I feel now that my rhel/debian/mac hack is a primitive way of handling the "different implementations of arp output different things" problem. 4:02 Can we make this more universal -- perhaps doing a test of the ARP output ourselves, seeing what it returns, and basing our actions on patterns we find?

Olle Jonsson AIM 4:02 I keep thinking of an array of options the user can set and send to the constructor.

Peter Rukavina AIM 4:02 In other words "figure it out automatically so the user doesn't have to configure anything". 4:02 We could eve say "your OS doesn't seem to have an 'arp' command" and the like.

Olle Jonsson AIM 4:02 Good. *And* override it all if there is a config array.

Peter Rukavina AIM 4:02 sort like a ./configure

Olle Jonsson AIM 4:02 +1 for that

Peter Rukavina AIM 4:03 Yes

Olle Jonsson AIM 4:03 Nice tutorial/hints list: 4:03 on files and PHP

Peter Rukavina AIM 4:04 I have found 4:04 Also 4:05 Can I assume that, when I do a "make test" when installing a new Perl module, it is "unit testing" that is happening?

Olle Jonsson AIM 4:05 Hm, perhaps. 4:05 I guess it is! 4:06 rake, make for ruby, makes the same thing possible. 4:06 rake can be a test-runner. 4:06 there are ample possibilities to run tests. 4:06 from web, commandline, and programs

Peter Rukavina AIM 4:08 So, specific to Plazes.php, let's say -- we have a Plazes class, that has various functions. Unit testing would apply tests to each function, with a know input and an expected output, that could be run so as to ensure that changes elsewhere, to other functions/properties didn't adversely affect the role of the tested function?

Olle Jonsson AIM 4:09 Yes, exactly. 4:09 When we break stuff out, we could also test smaller parts. 4:09 Making code testable is part of the good of OO.

Peter Rukavina AIM 4:09 Very interesting. 4:09 If you are not careful, you're going to make a programmer out of me!

Olle Jonsson AIM 4:10 Mock Objects, a powerful way of using SimpleTest makes the web conn not necessary, as well. 4:10 They _act as any object you want them to_. 4:10 Say a Buddies list. 4:10 Set up a Mock Buddies List, and perform ops on that. It IS a Buddies list, for all intents and purposes of our code.

Peter Rukavina AIM 4:11 Right.

Olle Jonsson AIM 4:11 It just gets set up like a "fixture", as the saying goes.

Peter Rukavina AIM 4:11 And, similarly, we could set up "mock arp" instances...

Olle Jonsson AIM 4:11 The API we work against is small enough.... arp: genius

Peter Rukavina AIM 4:11 that would mimic the output of various arp's

Olle Jonsson AIM 4:11 That's "fixture data" for us.

Peter Rukavina AIM 4:12 Thinking this through, I wonder if it might make sense to further object-inate the code, so that the "arp" part gets rolled into its own function. It's another meta-layer, but it would allow our ancestors to override the arp class with their own one.

Olle Jonsson AIM 4:12 And, it's a community outreach: "We'd like to support your box, too! Run these two commands, and send us the resulting text files! arp > test_linux486.txt 4:13 Our ancestors! Think of the millennia, man.

Peter Rukavina AIM 4:13 And, with that in mind, we would also be writing a general purpose, cross-OS implementation of arp. 4:13 That could be used elsewhere.

Olle Jonsson AIM 4:13 An arpForPhp wrapper class, perhaps. 4:14 That is, mangling text input, getting useful with it. 4:15 Could you paste this in "Talk" at the Rukapedia? 4:16 I think we could blog like this. 4:16 I.e. "log" like this.