Ñ¡ÔñSQL Server Unit Test,ÊäÈëÃû×Ö£¬µã»÷Add¡£
µã»÷New Connection¡£
ÊäÈëServer name,Ñ¡ÔñÎÒÃǸղŴ´½¨µÄÊý¾Ý¿âDBUTDemo,µã»÷Test Connection¡£Èç¹û³É¹¦»áµ¯³ö¶Ô»°¿ò¡£Á¬ÐøÁ½´Îµã»÷OK¡£Êý¾Ý¿âÅäÖþÍÍê³ÉÁË¡£
´´½¨Èý¸öActionsµã»÷Click here to createÀ´´´½¨TestAction,µã»÷Ö®ºó·¢ÏÖ¶àÁËÒ»¸öresxÎļþ¡£
ÊäÈëÏÂÃæµÄ²âÊÔ´úÂ룺
declare @return_value int, @name nvarchar(50) EXEC @return_value = [dbo].[GetBasicRevenueByName] @name = N'three zhang' SELECT 'Return Value' = @return_value½ÓÏÂÀ´´´½¨ÁíÍâÁ½¸öAction£º
·Ö±ðÊäÈëÈçÏ´úÂ룺
insert into EmployeeBasicInfo values(1,'three zhang', '16625344257') insert into EmployeeBasicInfo values(2,'four li', '16625344258') insert into EmployeeBasicInfo values(3,'simon', '16625344259') insert into EmployeeBasicInfo values(4,'jack', '16625344250') insert into EmployeeRevenue values(1 ,30000 ,500 ,20000) insert into EmployeeRevenue values(2 ,28000 ,500 ,19000) insert into EmployeeRevenue values(3 ,27000 ,500 ,10000) insert into EmployeeRevenue values(4 ,26000 ,500 ,20000) delete from EmployeeRevenue delete from EmployeeBasicInfo ×îºóÌí¼Ó²âÊÔÌõ¼þÎÒÃÇÌí¼ÓÁËÁ½¸ö²âÊÔÌõ¼þ£¬Öµ¿ÉÒÔÔÚÊôÐÔ½çÃæÖÐÐ޸ģº
µÚÒ»¸ö²âÊÔÌõ¼þÊÇÔÚ·µ»Ø½á¹û¼¯1ÖУ¬µÚÒ»ÐеڶþÁеÄÆÚÍûֵΪ30000£¬Ò²¾ÍÊÇthree zhangµÄ»ù±¾¹¤×ÊΪ30000¡£
µÚ¶þ¸ö²âÊÔÌõ¼þ²âÊÔ½á¹û¼¯1·Ç¿Õ¡£
±àÒë,ÔËÐбàÒë³É¹¦ºó£¬´ò¿ªTest Explorer,runÎÒÃǸղŴ´½¨µÄcase,²âÊÔͨ¹ý¡£
Ordered Test×îºó˵ÏÂÊý¾Ý¿â²âÊÔÓÃÀýÈç¹ûÐèÒª¹Ì¶¨µÄ˳Ðò¸ÃÔõô°ì£¬Î¢ÈíÌṩÁËÒ»ÖÖ²âÊÔÓÃÀýÀàÐͽÐ×öOrdered Test:
ÕâÖÖcaseÊǰѼ¸¸öcase¼¯ºÏ³ÉΪÁËÒ»¸ö£¬¿ÉÒÔ×Ô¼ºÑ¡ÔñÐèÒªÔËÐеÄÆÕͨµÄcase£¬×Ô¼ºÖ¸¶¨Ë³Ðò¡£ÒòΪ˳Ðò¹Ì¶¨ÁË£¬ÕâЩcasesÖÐʹÓõÄÊý¾Ý¾ÍÊǿɿصģ¬Òò´ËÔÚÒ»¸öordered caseÖеļ¸¸öcase¿ÉÒÔ¹²Í¬Ê¹ÓÃijЩÊý¾Ý£¬ÎÒÃÇ¿ÉÒÔ½«Êý¾Ý¸ôÀëµÄµ¥Î»Óɵ¥¸öcase±äΪ¼¸¸öcaseÉõÖÁÒ»¸öÀàÖеÄËùÓÐcases¡£
posted @
¡¡