{"action":"opened","issue":{"url":"https://api.github.com/repos/PolarisProject/salesforceStyleGuide/issues/2","labels_url":"https://api.github.com/repos/PolarisProject/salesforceStyleGuide/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/PolarisProject/salesforceStyleGuide/issues/2/comments","events_url":"https://api.github.com/repos/PolarisProject/salesforceStyleGuide/issues/2/events","html_url":"https://github.com/PolarisProject/salesforceStyleGuide/issues/2","id":91069790,"number":2,"title":"Naming of Test Classes","user":{"login":"brianmfear","id":7635797,"avatar_url":"https://avatars.githubusercontent.com/u/7635797?v=3","gravatar_id":"","url":"https://api.github.com/users/brianmfear","html_url":"https://github.com/brianmfear","followers_url":"https://api.github.com/users/brianmfear/followers","following_url":"https://api.github.com/users/brianmfear/following{/other_user}","gists_url":"https://api.github.com/users/brianmfear/gists{/gist_id}","starred_url":"https://api.github.com/users/brianmfear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianmfear/subscriptions","organizations_url":"https://api.github.com/users/brianmfear/orgs","repos_url":"https://api.github.com/users/brianmfear/repos","events_url":"https://api.github.com/users/brianmfear/events{/privacy}","received_events_url":"https://api.github.com/users/brianmfear/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-25T20:38:30Z","updated_at":"2015-06-25T20:38:30Z","closed_at":null,"body":"While I definitely agree that test classes should mimic the name of the class it tests, I disagree that the name should start with TEST_. There is a simple reason for this: You cannot easily find a test for a particular class in *any* system you want to use.\r\n\r\nIn Salesforce, Setup > Develop > Apex Classes lets you use list views, including the Rolodex feature. Let's say I have the classes: AccountController, LeadController, TEST_AccountController, and TEST_LeadController. To find my unit tests, I can now press \"T\", which is pretty cool, but to find AccountController or LeadController, I now have to use different letters. Also, in the Force.com IDE, you can select a file by typing. So, to find the TEST_AccountController, I need to type \"TEST_A\" (at minimum) to find the class I'm looking for.\r\n\r\nConversely, let's rename the classes: AccountController, AccountControllerTest, LeadController, LeadControllerTest. Now, when I press \"A\", I get *just* the account controller and its unit tests, and when I press \"L\", I get just the lead controller and its unit tests. Once you have about 200 live classes, you'll come to appreciate not having scroll through pages of TEST_X classes. In the Force.com IDE, I only need to type Acc (probably), and scroll down exactly twice to find my controller's test.\r\n\r\nHowever, I would allow for a single exception: classes that test entire functional units (crossing multiple classes, triggers, etc). Those should all be lumped together to make them easy to find, so starting with a *prefix* completely makes sense in that scenario (if you use it at all). I'd probably avoid using \"TEST\" for this prefix, though, because T is fairly common letter. I'd probably recommend they start with a more obscure letter, like X: \"XTEST_ClassName\". Some naming convention that developers can know they need to visit for a certain class of tests."}}