• Eleonora Peruffo
  • NEWBIE
  • 15 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi All,

I'm new to apex coding and I'm banging my head on the wall to write a test class and be able deploy my apex class but with no result yet. The aim is to display a list of accounts which respect certain criteria- being an active member and being a small organisation. I've used my class in a page and it seems to work fine in the sandbox.
I've looked at examples of test classes but none seems to work. Any good samaritan out there who can give me a hand?

This is my class:

public with sharing class Small_members {
List<Account> accounts;
public List<Account> getAccounts(){
accounts = [SELECT name, Phone, County__c, Website, Category_ID__c from account WHERE (OrgMembership_Status__c = 'Active' and Category_ID__c='Small Organisation') ORDER BY Name];
return accounts;
}
}

and this is my test class so far - not working :-(

@isTest
public class Testmallmembers { static testMethod void t1()
{ account a = new Account( name='accountmember1', Phone='045-555555', County__c='Countysoandso', Website='http://www.website.ie') ;
insert a;
Testmallmembers Small_members = new Small_members();
List<Contact> l = Small_members.getAccounts();
system.assert( l.size() > 0 ); }
public List<Account> 'accountmember1';
                           }

Any tips on how to proceed would be appreciated. Thank you.
Hi All,

I'm new to apex coding and I'm banging my head on the wall to write a test class and be able deploy my apex class but with no result yet. The aim is to display a list of accounts which respect certain criteria- being an active member and being a small organisation. I've used my class in a page and it seems to work fine in the sandbox.
I've looked at examples of test classes but none seems to work. Any good samaritan out there who can give me a hand?

This is my class:

public with sharing class Small_members {
List<Account> accounts;
public List<Account> getAccounts(){
accounts = [SELECT name, Phone, County__c, Website, Category_ID__c from account WHERE (OrgMembership_Status__c = 'Active' and Category_ID__c='Small Organisation') ORDER BY Name];
return accounts;
}
}

and this is my test class so far - not working :-(

@isTest
public class Testmallmembers { static testMethod void t1()
{ account a = new Account( name='accountmember1', Phone='045-555555', County__c='Countysoandso', Website='http://www.website.ie') ;
insert a;
Testmallmembers Small_members = new Small_members();
List<Contact> l = Small_members.getAccounts();
system.assert( l.size() > 0 ); }
public List<Account> 'accountmember1';
                           }

Any tips on how to proceed would be appreciated. Thank you.
Hi All,

I'm new to apex coding and I'm banging my head on the wall to write a test class and be able deploy my apex class but with no result yet. The aim is to display a list of accounts which respect certain criteria- being an active member and being a small organisation. I've used my class in a page and it seems to work fine in the sandbox.
I've looked at examples of test classes but none seems to work. Any good samaritan out there who can give me a hand?

This is my class:

public with sharing class Small_members {
List<Account> accounts;
public List<Account> getAccounts(){
accounts = [SELECT name, Phone, County__c, Website, Category_ID__c from account WHERE (OrgMembership_Status__c = 'Active' and Category_ID__c='Small Organisation') ORDER BY Name];
return accounts;
}
}

and this is my test class so far - not working :-(

@isTest
public class Testmallmembers { static testMethod void t1()
{ account a = new Account( name='accountmember1', Phone='045-555555', County__c='Countysoandso', Website='http://www.website.ie') ;
insert a;
Testmallmembers Small_members = new Small_members();
List<Contact> l = Small_members.getAccounts();
system.assert( l.size() > 0 ); }
public List<Account> 'accountmember1';
                           }

Any tips on how to proceed would be appreciated. Thank you.