function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SalesRedSalesRed 

Can a Test Force.Com Site be instantiated for Test Classes?

Hello,

 

I was wondering if it is possible to create a test Force.com site within a test class.   On looking at the following

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites.htm  there does not seem to be any set/add/put methods in which I could for example set the Site address (e.g. Site newSiteTest = new Site('http://www.thisisatest.com');"

 

Can this be done?  I'm not sure otherwise how to test the following function Site.getCurrentSiteUrl().

 

Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
admintrmpadmintrmp
We don't for our Force.com Site. We just assume the site URL instead.