home recent topics recent posts search faq  

Pretty Objects Visual T# Forum



register | lost password   open id sign in with Twitter
Messages in this topic - RSS

Home » T# Visual Studio Integration » Using Resource files, best practices for QA/Prod

Conversations on the Integration of T# into Visual Studio
3/14/2011 11:41:23 AM

LRomano
LRomano
Posts: 4
Hi,
I'm just getting started using this product but from what I see it looks great. I'm not a big Unit Testing person so anything that can make it easier is great. You really need to touch base with MS to show them what you are doing and have them help you get this project really going. Anyways I digress...
I want to use resource files to store some basic information but when I add them, and set their build Tool to the ResX compiler, the T# complier goes nuts. I'm trying to build a set of test cases that can be run against QA and our Production. The differences are basic login information and web service URL end points. Is there a better way to set this up so I can have the same test cases but just "toggle" or switch between which environment I run against?
Any insights would be great.
Thanks,
Leo
0 permalink
3/14/2011 12:59:18 PM

Ludovic Dubois
Ludovic Dubois
Administrator
Posts: 159
Hi.


I already thought about showing our product to MS, but I think I do not have the right contacts to do so... Do you know some people at MS that would be interested? smile


For resources, do not change Custom Tool, but instead, set Build Action to 'Embedded Resource'. Just like when you add a new resource to a T# project!


We will add soon support for config files. However, you can already use ConfigurationManager class to do that. One would be configured for Production, the other for QA.
0 permalink
3/15/2011 11:46:03 AM

LRomano
LRomano
Posts: 4
Hi Ludovic,
Thanks for getting back to. I don't know anyone at MS personally, but there is a great Can Dev blog by MS Evangelist's at: http://blogs.msdn.com/b/cdndevs/ I sure if you contact one of them, they can get your stuff out to the right people.
Moving on, I added a Resource File to my T# project, see the VTResourceWindow image for detals. This is the default when you add a resource file to the project. I built the code and then changed my code to use this resource. The VTCodeSample is an image of the code. The code doesn't compile as the ResourceQAB doesn't seem to produce a code behind file and thus the reason why I tried to change the "Custom Tool" parameter in my first message.
Any idea's?
Thanks,
Leo
0 permalink
3/15/2011 11:50:00 AM

LRomano
LRomano
Posts: 4
The images didn't seem to make it so here is an link on skydrive:
http://cid-c4526be82886d48f.photos.live.com/self.aspx/Public/VTResourceWindow.PNG http://cid-c4526be82886d48f.office.live.com/self.aspx/Public/VTCodeSample.PNG
0 permalink
3/15/2011 5:36:55 PM

Ludovic Dubois
Ludovic Dubois
Administrator
Posts: 159
Hi Leo.


I know see what you mean smile
Unfortunately, I can not do anything right now. What you can do is enter a requested feature in our Bugs Tracking Server to be sure I do not forget to add such possibilities soon.


For now, you can generate a satellite DLL in C# (or generate it with C# and drag&drop it to your T# project. You can leave .cs extension if you want Cool )
Do not forget to change the name of the resource for your DLL name.


But if you want to edit your resource, you have to complete it manually! upset for now smile


Thanks for your feedback.
Ludovic.
0 permalink
3/16/2011 11:49:51 AM

LRomano
LRomano
Posts: 4
Thanks Ludovic.
Below is the basic code for how I set this up but I removed the specific and some test cases but I'm sure you'll get the point. The "WSHelper" is the static class I created and I'm trying to unit test with Visual T#.
It has methods called InitSecurityService(), InitDeliverService(), etc. In these specific tests, I'm just trying to see if the objects are initialized correctly given the URL's i pass into them. The tests
can be more complex but I just wanted to show a simple example of how to get started. From here I can add test cases once and they will be run for each of the environments.

Hopefully, this will help other people out there and maybe save them some time watching all the video's and reading the doc's (which are all great by the way and I don't speack French Big Grin), here is what i did:
1. created private variables in the TestClase but before the TestContext, that will be used in any and all tests.
2. create a "testcontext" and set the variables to the specific values for your given environment ie. QA, Test, Prod, etc.
3. After you set the variables call "runtest".
4. Copy and paste the code and change the variables for your next environment.
Basically, for each "runtest" in Visual T#'s "testcontext", it will run your full set of tests in that TestClass. So in the example below, Visual T# will run through the tests twice, once for the QA environment and once for the Production environment. Again this is just the specific case I was trying to mimic.
namespace WebServices.Test
{
testclass QAB_PRODTester for WSHelper
{
//Items used to run tests
private string token; //security token used to make API calls
private string clientID;
private string clientPWD;
private string WebServices_DeliveryProfiles_URL;
private string WebServices_DeliveryServices_URL;
private string WebServices_ProvisioningProfiles_URL;
private string WebServices_ProvisioningServices_URL;
private string WebServices_SAPApplicationServices_URL;
private string WebServices_SecurityServices_URL;
private string WebServices_WebID;
private string WebServices_WebPW;
testcontext
{
#region QAB Tests
token = "";
clientID = "XXXXXXX";
clientPWD = "xXXXXX";
WebServices_DeliveryProfiles_URL = "http://XXXXXX";
WebServices_DeliveryServices_URL = "http://XXXXXX";
WebServices_ProvisioningProfiles_URL = "http://XXXXXX";
WebServices_ProvisioningServices_URL = "http://XXXXXX";
WebServices_SAPApplicationServices_URL = "http://XXXXXX";
WebServices_SecurityServices_URL = "http://XXXXXX";
WebServices_WebID = "XXXX";
WebServices_WebPW = "XXXXX";
runtest;
#endregion
#region PROD Tests
token = "";
clientID = "XXXXXXX";
clientPWD = "xXXXXX";
WebServices_DeliveryProfiles_URL = "http://XXXXXX";
WebServices_DeliveryServices_URL = "http://XXXXXX";
WebServices_ProvisioningProfiles_URL = "http://XXXXXX";
WebServices_ProvisioningServices_URL = "http://XXXXXX";
WebServices_SAPApplicationServices_URL = "http://XXXXXX";
WebServices_SecurityServices_URL = "http://XXXXXX";
WebServices_WebID = "XXXX";
WebServices_WebPW = "XXXXX";
runtest;
#endregion
}
#region Test Init of Services
test InitSecurityService( string url )
{
runtest SecurityServices.SecurityService service = WSHelper.InitSecurityService( WebServices_SecurityServices_URL );
assert service.Url == WebServices_SecurityServices_URL;
}
test InitDeliveryService( string url )
{
runtest DeliveryServices.DeliveryServicesService service = WSHelper.InitDeliveryService( WebServices_DeliveryServices_URL );
assert service.Url == WebServices_DeliveryServices_URL;
}
....

}
}
Hope this helps,
Leo
0 permalink

Home » T# Visual Studio Integration » Using Resource files, best practices for QA/Prod





Powered by Jitbit Forum 7.2.14.1 © 2006-2011 Jitbit Software