Commerce Server General - CS 2007 Unit Testing

This is Interesting: Free IT Magazines  
Home > Archive > Commerce Server General > September 2006 > CS 2007 Unit Testing





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author CS 2007 Unit Testing
Mark

2006-08-31, 7:36 pm

We're interested in creating unit tests for Commerce Server 2007. I would
assume the theory would be similar in 2002. We're having trouble finding
resources on the web to address the lack of a valid Context object while
unit testing. The first thread below suggests a modification to the
web.config file, and suggests "See for the "Configuration Services" section
in the product documentation on
how to do this." I couldn't find it. Could someone point me to this
resource online and/or provide suggestions on how to address this? The only
relevant threads I could find were below.

Thanks in advance.
Mark

http://tinyurl.com/kror9 --> The most optimistic thread

http://tinyurl.com/zbmox

http://tinyurl.com/km99f


Wendell

2006-09-01, 1:33 am

Mark,

If you're performing unit tests on a server which has the commerce
server installed correctly, you might considering using the site agent
to create contexts in the set-up condition of the unit tests.

For example, you can create a catalog context as follows on a CS site
called "site" as follows:

CatalogSiteAgent ctlgAgent = new CatalogSiteAgent();
CtlgAgent.SiteName = "site";

CatalogContext context = CatalogContext.Create(ctlgAgent);

Joe

Mark wrote:
> We're interested in creating unit tests for Commerce Server 2007. I would
> assume the theory would be similar in 2002. We're having trouble finding
> resources on the web to address the lack of a valid Context object while
> unit testing. The first thread below suggests a modification to the
> web.config file, and suggests "See for the "Configuration Services" section
> in the product documentation on
> how to do this." I couldn't find it. Could someone point me to this
> resource online and/or provide suggestions on how to address this? The only
> relevant threads I could find were below.
>
> Thanks in advance.
> Mark
>
> http://tinyurl.com/kror9 --> The most optimistic thread
>
> http://tinyurl.com/zbmox
>
> http://tinyurl.com/km99f


Mark

2006-09-01, 7:40 pm

Perfect. This appears to work great for the CatalogContext.

We're also interested in unit testing against OrderForms and Baskets that
appear to be part of the CommerceContext. The CommerceContext class does
not have a Create or similar method. Suggestions on accessing the
CommerceContext from a unit test?

Thanks again.

Mark

"Wendell" <joe8t88@hotmail.com> wrote in message
news:1157075985.434231.172630@p79g2000cwp.googlegroups.com...
> Mark,
>
> If you're performing unit tests on a server which has the commerce
> server installed correctly, you might considering using the site agent
> to create contexts in the set-up condition of the unit tests.
>
> For example, you can create a catalog context as follows on a CS site
> called "site" as follows:
>
> CatalogSiteAgent ctlgAgent = new CatalogSiteAgent();
> CtlgAgent.SiteName = "site";
>
> CatalogContext context = CatalogContext.Create(ctlgAgent);
>
> Joe
>
> Mark wrote:
>



Wendell

2006-09-01, 7:40 pm

Mark,

Baskets and PurchaseOrders are actually a part of the OrderContext
object, and you can use the same agent pattern to create one of these
context objects as follows:

OrderSiteAgent ordAgent = new OrderSiteAgent();
ordAgent.SiteName = "Site";

OrderContext context = OrderContext.Create(ordAgent);

There is no way that I know of to create a CommerceContext object
directly (as it lacks a create method as you mentioned), but I don't
know what object you'd be instantiating through CommerceContext, as the
methods exposed are based entirely on the current user logged in, so
that's not really applicable for unit testing anyway.

Mark wrote:[vbcol=seagreen]
> Perfect. This appears to work great for the CatalogContext.
>
> We're also interested in unit testing against OrderForms and Baskets that
> appear to be part of the CommerceContext. The CommerceContext class does
> not have a Create or similar method. Suggestions on accessing the
> CommerceContext from a unit test?
>
> Thanks again.
>
> Mark
>
> "Wendell" <joe8t88@hotmail.com> wrote in message
> news:1157075985.434231.172630@p79g2000cwp.googlegroups.com...

Mark

2006-09-02, 1:24 am

Excellent. THanks again. I googled a bit on this and found the link below
that I thought I should paste for others to find in the future. The first
blog post includes a download vs 2005 project with sample unit tests. It
looks pipeline centric on the surface, but it really shows a number of
interesting unit test examples for commerce server. Thanks again Wendell.

http://blogs.msdn.com/nihitk/archiv...ConsoleApp.aspx

Mark

"Wendell" <joe8t88@hotmail.com> wrote in message
news:1157130696.606824.58780@m79g2000cwm.googlegroups.com...
> Mark,
>
> Baskets and PurchaseOrders are actually a part of the OrderContext
> object, and you can use the same agent pattern to create one of these
> context objects as follows:
>
> OrderSiteAgent ordAgent = new OrderSiteAgent();
> ordAgent.SiteName = "Site";
>
> OrderContext context = OrderContext.Create(ordAgent);
>
> There is no way that I know of to create a CommerceContext object
> directly (as it lacks a create method as you mentioned), but I don't
> know what object you'd be instantiating through CommerceContext, as the
> methods exposed are based entirely on the current user logged in, so
> that's not really applicable for unit testing anyway.
>
> Mark wrote:
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com