tags:

views:

235

answers:

3

Hi guys I am new to Sharepoint. Is it a good practice to query the content database tables through the SQL Server Management studio?

Which things need to be considered for Sharepoint testing? As of now I have considered Authorizations and Performance of Sharepoint portal.

Still there are lot of things need to be considered but since I am new to Sharepoint can anyone please guide me on how we do Sharepoint testing and things to be considered for Sharepoint testing?

Any help really appreciated. Thanks in advance.

+4  A: 

Annop, I can answer your first question. The best practice is to use the Sharepoint API to access the database. The Sharepoint database is proprietary to Sharepoint, and Microsoft recommends that it not be accessed directly (or at least never written to directly). The database contains field names like StringField1, StringField2, NumericField1, etc. so composing a meaningful SQL query would be difficult.

Robert Harvey
Thanks for the reply Robert...But still we can execute this query to find out the total no of users in portal areaselect webs.FullUrl, Webs.Title, COUNT(WebMembers.UserId) As 'Total User'from Webs INNER JOIN WebMembers ON Webs.Id = WebMembers.WebIdWhere fullurl NOT like '%sites%' AND fullUrl <> 'MySite' AND fullUrl <> 'personal'Group BY webs.FullUrl, Webs.TitleOrder By 'Total User' desc
Anoop
If it's a simple query and it's read-only, you shouldn't have any problems, but since I didn't write the API I can't guarantee that you won't encounter some undefined behavior.
Robert Harvey
The only real downside is that Microsoft can change the database schema and break your query, although admittedly this is unlikely.
Robert Harvey
Thanks for the Reply Robert....i just wanted to use content database for testing purpose only(read only) ..still i can take content database backup and restore it on the other server and i can do testing on that database isn't it ?
Anoop
Yes, but there are Sharepoint-specific procedures for backing up and restoring a SharePoint database, especially if you are using a farm.
Robert Harvey
If you really have to run SQL queries against the SP databases, make sure you use NOLOCK in your SELECT statement.
Alex Angas
+2  A: 

Regarding your second question, the following link contains several resources to help you with Sharepoint testing:

http://jopx.blogspot.com/2009/03/sharepoint-unit-testing.html

Robert Harvey
+2  A: 

here is a link to help unit testing sharepoint with mocking http://www.typemock.com/sharepointpage.php

Hope it helps

Miau
Technically that product is for mocking SharePoint objects, not unit testing it.
Alex Angas
you are right Alex, thanks for the correction
Miau
Thanks for the help Alex
Anoop