You need to sign in to do that
Don't have an account?

Trigger : Test Coverage results
I created a test method for a trigger. After I run this method, under Code Coverage Results, it says
DepartmentTrigger (ApexTrigger) - 1 lines not tested, 94% covered
TestDepartmentTrigger (ApexClass) - 0 lines not tested, 100% covered.
What does the above mean. Did I write my test method correctly or not? Please let me know, quick help would be appreciated.
thanks,
kathyani
DepartmentTrigger (ApexTrigger) - 1 lines not tested, 94% covered
TestDepartmentTrigger (ApexClass) - 0 lines not tested, 100% covered.
What does the above mean. Did I write my test method correctly or not? Please let me know, quick help would be appreciated.
thanks,
kathyani
This example is very clear, thanks for sending the link. So in the below test method we have the select query. This select query can only be matched using the id field because id is unique
In my test method I was trying to query on a name field (where condition in the query) and this was returning me back two rows and was giving me an exception. So I cannot use such queries in my test method? Does it have to be only using the id field just like in the below example.
Below is the example which you had sent:
Below is a line in the department trigger.
company = [select Id from Department__c where Company__c = true];
So in my test data if I say dept.Company__c it would return more than one because there is already a row with Company__c = true.
Or is it better to delete data from database when testing a trigger using the test method.
dept.Company__c = true