How to delete a Test Class WITHOUT using eclipse

You can do this with only the software that comes installed with Windows/Linux/Mac. These instructions will be for Windows.

Create a Folder

Make a folder on your desktop. You'll want this so you can keep your files in order.

Create package.xml

Open Notepad (Start > Accessories > Notepad). Copy the following text into the text editor:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <version>30.0</version>
</Package>

Save this file as package.xml within the folder you created. NOTE: You have to change "Save as type" to "All files (*.*)", or Notepad will "helpfully" add a ".txt" extension that we don't want.

Create destructiveChanges.xml

Create a new file in Notepad (File > New). Copy the following text into your text editor:

<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>SomeTestClass</members>
        <name>ApexClass</name>
    </types>
    <version>30.0</version>
</Package>

Change SomeTestClass to the class you want to delete.

Save this file in the folder you created as destructiveChanges.xml (note the capital C in "changes"). Again, make sure that you saved it as "All files (*.*)".

At this point, you have two files in your folder. Open the folder, select both XML files, right-click, and choose "Send To > Compressed Folder". The default name is fine.

You're all set up at this point. Now, you just need to deploy the file.

Go to http://workbench.developerforce.com/, login using your production credentials, then choose "Migration > Deploy", upload your file, and confirm the process.

See this article (not mine: http://carvingintheclouds.blogspot.com/2013/12/deploying-destructive-changes-using.html) for some pictures and nice cloud-like palettes.


Based on this post on tooling API:

http://intmist.wordpress.com/2014/03/09/force-com-tooling-api-create-apex-class-apex-trigger-dynamically-and-updatedelete-apex-trigger-apex-class-using-tooling-api-with-rest-api/

I tried deleting a class from my developer account and I was able to do it using workbench by just providing the class Id and using delete( Sys admin profile)

I am not sure if this would apply for your PRD org. Would be worth giving this a try.

enter image description here

Deleting a Apex Class:

// [Status=No Content, StatusCode=204] public void deleteApexClass() { HttpRequest req = createHttpRequest(endpoint+'/ApexClass/'+oid,'DELETE'); String responseJson = getResponse(req); // Store the result to do something }