Tests needed

andreiashu - February 8, 2009 - 18:30
Project:Node Hierarchy
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:simpletests
Description

I just started using this module and first i must say big thanks for creating it.
I saw that it does not have tests (simpletest) for it.
I think I can put some time and try to create some, but unfortunately i need some experience with this module. Can anyone give me some directions (like what should be tested) ?

#1

ronan - February 8, 2009 - 23:04

I'd appreciate any help you can give. I'm not sure what the best strategy for testing should be as I'm horribly bad at writing test myself. My instinct is to test every single function which leads to hours of coding and a very low percentage of test coverage.

Probably the major operations should be tested: setting parents, reordering children, creating menus, tokens.

Let me know if there's anything I can do to help
R

#2

andreiashu - February 11, 2009 - 14:50

I've made a stub. I'll put it here so maybe other can contribute. I'll add stuff to it when i have time.
You must put this .test file under directory tests in NH directory.
Also NH must implement hook_simpletest like this (sorry, didn't ahve time to make a patch):

/**
* Implementation of hook_simpletest().
*/
function nodehierarchy_simpletest() {
  $dir = drupal_get_path('module', 'nodehierarchy') .'/tests';
  $tests = file_scan_directory($dir, '\.test$');
  return array_keys($tests);
}

Beware, i'm no expert in simpletest either :)

AttachmentSize
nodehierarchy.test 3 KB

#3

andreiashu - February 11, 2009 - 14:54
Status:active» needs work

#4

andreiashu - February 11, 2009 - 15:11

Do we need to check for permissions too ? (siteoutline, add parent nodes, etc)

AttachmentSize
nodehierarchy.test 4.11 KB

#5

ronan - February 15, 2009 - 05:47
Status:needs work» active

Awesome! I've commited the stub. Thanks for getting the ball rolling.

I'm setting this back to active so we can work on fleshing out the tests.

Thanks again
Ronan

#6

andreiashu - February 15, 2009 - 16:58

Nice that you committed them. I will take a look over them again when i'll get some time.

Thanks
andreiashu

 
 

Drupal is a registered trademark of Dries Buytaert.