I am trying to create test class using force.com IDE. I cannot find the picklist of selecting type of apex class- test class.I created that class in my org and fetched it on eclipse. but I also not getting option to run test. (Previously I was getting it.) Can anyone tell me what should I do? I have also upgraded force.com IDE to spring 16.Thanks in advance for help.
I think you are using Latest version of Eclipse (Mars), In this version some options have been changed for test class
For create a test class: Create an apex class and put @isTest on the top Now write your test class code/methods.
How to run : Select test class from Package explorer| Right click | Run As | Run Configurations.. In the pop up select your project , class and test method then click on Run
Now you will be able to check code coverage/Errors
Thanks
-
The thing is not in Eclipse but in Force.com plugin. Other information is valid. – Andrii Muzychuk Mar 16 '16 at 10:01
I suggest you to check An Introduction to Apex Code Test Methods, Add a Test Class and Testing Best Practices.
In short. There is no special type Test Class. You just create a Class. One thing you can do, is to select a test template, while creating a class. Test Class must be annotated as @isTest as each test method.
@isTest
private class MyTest {
@isTest
static void myTest() {
// Add test method logic using System.assert(), System.assertEquals()
// and System.assertNotEquals() here.
}
}
You might want to check Force.com IDE for new features of Force.com plugin.