Project:Node Hierarchy
Version:6.x-1.x-dev
Component:Drupal/PHP Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:simpletests

Issue Summary

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) ?

Comments

#1

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

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

Status:active» needs work

#4

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

AttachmentSize
nodehierarchy.test 4.11 KB

#5

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

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

Thanks
andreiashu

#7

Component:Code» Drupal/PHP Code

Copy & Pasted: This issue pertains to the 6.x-1.x branch which is now legacy and is over two years old. If this issue is not applicable anymore, please consider closing it. Otherwise, please update this issue appropriately. Will be closed in two weeks if no response.

nobody click here