473,508 Members | 2,247 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web services testing nunit help plz

Could anyone give me a guide or example of how to test the web service
Here is my web service but i don't know how to write the test for it
public class Service{
private string m_ERR_NO_LISTING= "No data found";
private static readonly ILog log = LogManager.GetLogger(typeof(Service));

[WebMethod]
public com.xignite.www.Category [] GetCategoriesAndTopics()
{
com.xignite.www.Category[] ArrayOfCategory= null;
try
{
ArrayOfCategory = Service.GetCategoriesAndTopics();
}
catch(Exception e) {
log.Error("Invoke GetCategoriesAndTopics operation failed", e);
throw new SoapException(e.Message, SoapException.ServerFaultCode);
}

if (ArrayOfCategory!=null && ArrayOfCategory.Length>0 &&
ArrayOfCategory[0]!=null)
{
if (IsOutcomeResultFailed(ArrayOfCategory[0]))
{
throw new SoapException(ArrayOfCategory[0].Message,
SoapException.ServerFaultCode);
}
}

if(ArrayOfCategory==null ||ArrayOfCategory.Length==0 ||
ArrayOfCategory[0]==null)
{
throw new SoapException(m_ERR_NO_LISTING,
SoapException.ServerFaultCode);
}

return ArrayOfCategory;
}

private bool IsOutcomeResultFailed(com.xignite.www.Common common)
{
return common!=null && common.Outcome!
=com.xignite.www.OutcomeTypes.Success;
}
}
Nov 21 '05 #1
2 4704
You've two options:

1) Open up Explorer, and point to the Web Service URL. You'll see a complete
list of all available methods, and if you click on one it will generate a
form to enter any parameters [if there are any parameters, that is ], or
execute the method.

2) Create a new Project on VS [ perhaps a console app. ], go to references,
right-click add web refererence. There, it will ask you for a URL for the
service, gibe it you service url, and it'll generate a procy class that you
can use to talk to your web service programmatically. Use that, and call
whatever methods you've defined [the genrated class amtches all the Web
Methods in your service ]

Angel
O:]
"Popoxinhxan" <Po*********@discussions.microsoft.com> wrote in message
news:14**********************************@microsof t.com...
Could anyone give me a guide or example of how to test the web service
Here is my web service but i don't know how to write the test for it
public class Service{
private string m_ERR_NO_LISTING= "No data found";
private static readonly ILog log = LogManager.GetLogger(typeof(Service));

[WebMethod]
public com.xignite.www.Category [] GetCategoriesAndTopics()
{
com.xignite.www.Category[] ArrayOfCategory= null;
try
{
ArrayOfCategory = Service.GetCategoriesAndTopics();
}
catch(Exception e) {
log.Error("Invoke GetCategoriesAndTopics operation failed", e);
throw new SoapException(e.Message, SoapException.ServerFaultCode);
}

if (ArrayOfCategory!=null && ArrayOfCategory.Length>0 &&
ArrayOfCategory[0]!=null)
{
if (IsOutcomeResultFailed(ArrayOfCategory[0]))
{
throw new SoapException(ArrayOfCategory[0].Message,
SoapException.ServerFaultCode);
}
}

if(ArrayOfCategory==null ||ArrayOfCategory.Length==0 ||
ArrayOfCategory[0]==null)
{
throw new SoapException(m_ERR_NO_LISTING,
SoapException.ServerFaultCode);
}

return ArrayOfCategory;
}

private bool IsOutcomeResultFailed(com.xignite.www.Common common)
{
return common!=null && common.Outcome!
=com.xignite.www.OutcomeTypes.Success;
}
}

Nov 21 '05 #2
I knew it already , what i am asking is how to write the unit test and
functional test specifically for web service using nunit.
Thank you

"Angelos Karantzalis" wrote:
You've two options:

1) Open up Explorer, and point to the Web Service URL. You'll see a complete
list of all available methods, and if you click on one it will generate a
form to enter any parameters [if there are any parameters, that is ], or
execute the method.

2) Create a new Project on VS [ perhaps a console app. ], go to references,
right-click add web refererence. There, it will ask you for a URL for the
service, gibe it you service url, and it'll generate a procy class that you
can use to talk to your web service programmatically. Use that, and call
whatever methods you've defined [the genrated class amtches all the Web
Methods in your service ]

Angel
O:]
"Popoxinhxan" <Po*********@discussions.microsoft.com> wrote in message
news:14**********************************@microsof t.com...
Could anyone give me a guide or example of how to test the web service
Here is my web service but i don't know how to write the test for it
public class Service{
private string m_ERR_NO_LISTING= "No data found";
private static readonly ILog log = LogManager.GetLogger(typeof(Service));

[WebMethod]
public com.xignite.www.Category [] GetCategoriesAndTopics()
{
com.xignite.www.Category[] ArrayOfCategory= null;
try
{
ArrayOfCategory = Service.GetCategoriesAndTopics();
}
catch(Exception e) {
log.Error("Invoke GetCategoriesAndTopics operation failed", e);
throw new SoapException(e.Message, SoapException.ServerFaultCode);
}

if (ArrayOfCategory!=null && ArrayOfCategory.Length>0 &&
ArrayOfCategory[0]!=null)
{
if (IsOutcomeResultFailed(ArrayOfCategory[0]))
{
throw new SoapException(ArrayOfCategory[0].Message,
SoapException.ServerFaultCode);
}
}

if(ArrayOfCategory==null ||ArrayOfCategory.Length==0 ||
ArrayOfCategory[0]==null)
{
throw new SoapException(m_ERR_NO_LISTING,
SoapException.ServerFaultCode);
}

return ArrayOfCategory;
}

private bool IsOutcomeResultFailed(com.xignite.www.Common common)
{
return common!=null && common.Outcome!
=com.xignite.www.OutcomeTypes.Success;
}
}


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2538
by: serge | last post by:
I've started researching on Unit Testing and I must admit I had never heard of Unit Testing until a couple of months ago. Obviously I am interested in Unit Testing Stored Procedures. I read the...
14
2709
by: | last post by:
Hi! I'm looking for unit-testing tools for .NET. Somthing like Java has --> http://www.junit.org regards, gicio
3
3197
by: Ole Hanson | last post by:
Hi I am trying to engineer a way of testing that my logging framework is capable of writing to my eventlog. I want to include this test in my already existing NUnit tests - but I'm a little low...
2
9730
by: Curtis Justus | last post by:
Hi, I've been searching for solutions to two issues that are undoubtedly common to everybody. The first is how do my team and I adequately perform unit testing. The second is how can I measure...
1
2857
by: Amos Soma | last post by:
Can anyone suggest automated regression testing tools they use for the .Net apps? We would like to begin nightly automated testing of our apps. If it matters, we use Infragistics for our...
3
1806
by: JJ | last post by:
Hi, In Nunit testing with asp.net are you guys creating a separate Test assembly for testing or integrating right in class themselves? Is anyone using a third party Unit Test addon for Nunit to...
4
2142
by: Peter Rilling | last post by:
Does VS.NET 2005 Professional support integrated unit testing, or is that only with the team system?
5
1717
by: Jessica Weiner | last post by:
I have a local IIS server and a SQL server 2000 setup on my home computer. I am going to create a database and some tables along with stored precudures. Is that all I need to start building and...
5
1481
by: Mike Hofer | last post by:
I need some advice, folks, and I'm hoping you can provide it. First off, a few disclaimers: 1.) I am an ardant advocate of code quality. Especially, my own. 2.) I am maintaining a massive...
2
2232
by: Mark Elliott | last post by:
Hi All, I'm just playing with asp.net mvc and link-to-sql for the first time. I'm using visual web developer 2008. I create the project fine, choose nunit as my test framework in the wizard. ...
0
7229
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7129
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7333
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7398
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5637
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3194
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.