473,802 Members | 1,971 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_LISTIN G= "No data found";
private static readonly ILog log = LogManager.GetL ogger(typeof(Se rvice));

[WebMethod]
public com.xignite.www.Category [] GetCategoriesAn dTopics()
{
com.xignite.www.Category[] ArrayOfCategory = null;
try
{
ArrayOfCategory = Service.GetCate goriesAndTopics ();
}
catch(Exception e) {
log.Error("Invo ke GetCategoriesAn dTopics operation failed", e);
throw new SoapException(e .Message, SoapException.S erverFaultCode) ;
}

if (ArrayOfCategor y!=null && ArrayOfCategory .Length>0 &&
ArrayOfCategory[0]!=null)
{
if (IsOutcomeResul tFailed(ArrayOf Category[0]))
{
throw new SoapException(A rrayOfCategory[0].Message,
SoapException.S erverFaultCode) ;
}
}

if(ArrayOfCateg ory==null ||ArrayOfCatego ry.Length==0 ||
ArrayOfCategory[0]==null)
{
throw new SoapException(m _ERR_NO_LISTING ,
SoapException.S erverFaultCode) ;
}

return ArrayOfCategory ;
}

private bool IsOutcomeResult Failed(com.xign ite.www.Common common)
{
return common!=null && common.Outcome!
=com.xignite.www.OutcomeTypes.Success;
}
}
Nov 21 '05 #1
2 4723
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 programmaticall y. Use that, and call
whatever methods you've defined [the genrated class amtches all the Web
Methods in your service ]

Angel
O:]
"Popoxinhxa n" <Po*********@di scussions.micro soft.com> wrote in message
news:14******** *************** ***********@mic rosoft.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_LISTIN G= "No data found";
private static readonly ILog log = LogManager.GetL ogger(typeof(Se rvice));

[WebMethod]
public com.xignite.www.Category [] GetCategoriesAn dTopics()
{
com.xignite.www.Category[] ArrayOfCategory = null;
try
{
ArrayOfCategory = Service.GetCate goriesAndTopics ();
}
catch(Exception e) {
log.Error("Invo ke GetCategoriesAn dTopics operation failed", e);
throw new SoapException(e .Message, SoapException.S erverFaultCode) ;
}

if (ArrayOfCategor y!=null && ArrayOfCategory .Length>0 &&
ArrayOfCategory[0]!=null)
{
if (IsOutcomeResul tFailed(ArrayOf Category[0]))
{
throw new SoapException(A rrayOfCategory[0].Message,
SoapException.S erverFaultCode) ;
}
}

if(ArrayOfCateg ory==null ||ArrayOfCatego ry.Length==0 ||
ArrayOfCategory[0]==null)
{
throw new SoapException(m _ERR_NO_LISTING ,
SoapException.S erverFaultCode) ;
}

return ArrayOfCategory ;
}

private bool IsOutcomeResult Failed(com.xign ite.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 programmaticall y. Use that, and call
whatever methods you've defined [the genrated class amtches all the Web
Methods in your service ]

Angel
O:]
"Popoxinhxa n" <Po*********@di scussions.micro soft.com> wrote in message
news:14******** *************** ***********@mic rosoft.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_LISTIN G= "No data found";
private static readonly ILog log = LogManager.GetL ogger(typeof(Se rvice));

[WebMethod]
public com.xignite.www.Category [] GetCategoriesAn dTopics()
{
com.xignite.www.Category[] ArrayOfCategory = null;
try
{
ArrayOfCategory = Service.GetCate goriesAndTopics ();
}
catch(Exception e) {
log.Error("Invo ke GetCategoriesAn dTopics operation failed", e);
throw new SoapException(e .Message, SoapException.S erverFaultCode) ;
}

if (ArrayOfCategor y!=null && ArrayOfCategory .Length>0 &&
ArrayOfCategory[0]!=null)
{
if (IsOutcomeResul tFailed(ArrayOf Category[0]))
{
throw new SoapException(A rrayOfCategory[0].Message,
SoapException.S erverFaultCode) ;
}
}

if(ArrayOfCateg ory==null ||ArrayOfCatego ry.Length==0 ||
ArrayOfCategory[0]==null)
{
throw new SoapException(m _ERR_NO_LISTING ,
SoapException.S erverFaultCode) ;
}

return ArrayOfCategory ;
}

private bool IsOutcomeResult Failed(com.xign ite.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
2553
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 TSQLUnit documentation (not all of it) and i also ran into a newsgroup post saying TSQLUnit is very small compared to NUnit. The conclusion I am making out of this post is that I should rather spend time resarching/reading about NUnit than...
14
2759
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
3217
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 on ideas as how to assert that I actually did write to the eventlog successfully. Naturally I want this assertion without having to open my eventlog and visually verify the writing.
2
9745
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 a load on my application? In the past, we would write our class and then come up with some logic in a console or win app to test it. I have since found NUnit which seems to be pretty cool. BTW: if anybody has some XSLTs that provide...
1
2872
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 presentation layer. Thanks very much.
3
1821
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 test asp.net? What is it called, and how do you like what you are using? Any problems testing user controls with it? Any body have any real world examples of Nunit with asp.net that they can share. Just a skeleton layout would suffice. How many...
4
2165
by: Peter Rilling | last post by:
Does VS.NET 2005 Professional support integrated unit testing, or is that only with the team system?
5
1732
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 testing my websites? Thanks. Jess
5
1490
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 ASP.NET 1.1 code base that has no unit tests built for it with NUnit or any other testing framework. 3.) Moving to .NET 2.0 and VSTS is not an option.
2
2244
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. Everything is fine, compiles and the tests work fine on the basic application. However once I add some linq things to it, and specifically the line: WestoriaDataContext westoria = new WestoriaDataContext();
0
9699
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6838
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.