Url configuration and controller routing

I have a controller TestController.php in the docroot/WebApp/protected/controllers/sub folder. When I try to access an action on it I get an error "The system is unable to find the requested action "test"."

URL: http:/localhost/WebApp/index.php?r=sub/test/index

If I move the TestController.php to docroot/WebApp/protected/controllers/admin with no code changes it works perfectly.

URL: http:/localhost/WebApp/index.php?r=admin/test/index

How can I configure my application function using the first URL?