You did not mention what is the operation for these criteria and/or
If its or
(|(objectCategory=group)(ou=david test*))
It will try to find all the object either with objectcategory group or an organizational unit starting with 'david test' from the root.
If its and
(&(objectCategory=group)(ou=david test*))
It won't find anything because an organizational unit object category wont be a group.
Instead what you can do is, set the base dn as ou=david test,...
and just search for 'objectCategory=group'.
If you dont know the organizational unit dn, do a first search with the filter (ou=david test*) and get the dn and set it as base dn for the next search and now search for 'objectCategory=group'