Wednesday, August 12, 2009

Change in PC name, stops Reporting Service 2005

I deployed few reports on my Test Machine with TestMachine. As we wanted to implement a format of PC names, we happened to change the name of the Machine to e.g CompanyTestMachine
Before the rename happened, our system as well as the reports were working properly. Once the name was changed, we started getting error Report Server database not found.
Then I thought to redo the settings of Reporting service so as to change the required settings. On following the steps, I came across a error
User CompanyTestMachine\ASPNet not found
I then tried repairing the Microsoft Framework which didnt help. I ran the aspnet_regiis.exe /i command which also didn't help. I read many blogs but couldn't find a way out so I ended up renaming the machine to its original name.
I am still searching for a solution to this problem, if someone reading this has one I would appreciate if you could share it with me.

Wednesday, July 22, 2009

Unit Tests : Not Runnable - VSTS 2008 SP1




I am sure most of us are facing this issue. After adding ordered unit tests to our project and creating a test list for these whenever we open the project the Tests are indicated as Not-Runnable.


This can be sorted by pressing the Refresh button in the Test View as below


Read this for more details

Wednesday, May 27, 2009

Delete a Team Project

One of the new team members accidently created a team project (Remiss of the administrator for giving him full control).
Found out a way to delete the team project
Open a command line on your team foundation server and cd to
drive:/%program files%\Microsoft Visual Studio 9.0\Common7\IDE (For VSTS 2008)
tfsdeleteproject /q /force /server:<tfs server> "<project name>"

Monday, May 25, 2009

Restoring TFS 2008

I am sure everyone will be taking backup of their TFS on regular basis. Being new to TFS I thought to try and restore the TFS on a new machine, to avoid the risk of not taking backup of anything.

I had a spare PC in which I installed the trial of TFS. the environment of the new machine was now exactly the same as that of the old (or existing)machine.
The link which helped me for this was
http://msdn.microsoft.com/en-us/library/ms404869.aspx

Friday, May 22, 2009

Error 28002 : Unknown Error

This was the forth time I was installing TFS 2008 and I got this error for the first time. It has to do with the DNS. TFS is not able to resolve the Domain Name as a result of which it gives TFS3010 (if you see the Event log).
Resolution:
1. Open the web.config from the path below (TFS Root)
%systemdrive%/Program Files\Microsoft Visual Studio 2008 Team Foundation Server/Web Services/Web.config
Add the below key
<add key="<DomainFullyQualifiedPath>" value="dcHostName" />
And hit Retry on the Error message.

Wednesday, May 20, 2009

Error (rsAccessDenied) - 'NT AUTHORITY\NETWORK SERVICE' are insufficient

I did all the necessary settings to the reporting service so that my domain users can access the reporting service, but still I was getting rsAccessDenied error.

Then I read once solution in one of the forums in which there were few steps mentioned which solved my problem
1. Open http://localhost/reports
2. Go to Home Properties
3. Add a BUILTIN\Users and gave it Browser permissions and the problem was solved.

TF30042: The database is full. Contact your Team Foundation Server administrator.

Since many days we were facing problems with Low disk space on our TFS machine. I noticed that the LoadTest database Log was around 19Gigs. Till then I was not aware that there is a setting for restricting growth of the Log file. I then moved my mdf and ldf files to a drive with ample space and then restricted the growth of Log not more than 20Gigs.
And subsequently I changed the settings of all the TFS database not to grow exponentially. But the next day I came and tried to start my VSTS, it started givine me the same error
TF30042: The database is full. Contact your Team Foundation Server administrator.
Reading few blogs, I decided to change the Recovery Model of all the database from full to simple. And I was able to use my TFS without any issues after that. Below are the steps
1. Go to properties of the database


2. In Options tab, change Recovery model from Full to Simple.

I read in couple of blogs that it is not advisable to use Full Recovery model for the database which is used for version control.


Thursday, May 14, 2009

Zoom and Draw during presentation

Seeing many presentations I was wondering how was it possible for a person to zoom at a particular area in the screen and draw while in that mode. Did a search and found a pretty slick tool. Have a look
http://technet.microsoft.com/en-au/sysinternals/bb897434.aspx

Wednesday, May 6, 2009

SharePoint Access rights management

For managing the sharepoint access rights for users of TFS follow the following steps.
1. In Team Explorer right click on the Team Project for which you want to give access rights and select Securiy menu item.


2. In the screen displayed click on the Windows Sharepoint Services Site Administration link.
Note: The credentials of the user doing this changes should have the administrator privilages for sharepoint.

3. Internet explorer will be displayed in which you will be able manage rights for groups and individuals. You also will be add/remove users from a group.

Tuesday, May 5, 2009

How to remove a Service

We are developing a application which is based on SOA. We are maintaing PowerShell scripts and batch files to Install/Uninstall and Start/Stop the services.
But in certain cases (especially when the Powershell script is updated and user doesn't run the previous script to uninstall service) the services still remains and doesn't get uninstalled.

For this there is a simple command.
1. Run Visual Studio Command Prompt (Run as administrator)
2. write the following code
sc delete <servicename>

Note : You can get the name of the service from the properties of the service

Thursday, April 23, 2009

Installation VSTS 2008, Team Explorer, SQL 2005

Installations required to be followed in sequence.
1. Install IIS.

2. Visual Studio Team System 2008
3. VSTS 2008 Team Explorer
4. VSTS 2008 SP1
5. SQL Server 2005 (or 2008) (Also if you are working with Service Packs of SQL you can subsequently install that too)
6. VSTS Power Tools (If required)



If you installed Team Explorer into Visual Studio after you applied Visual Studio 2008 Service Pack 1, you’ll need to re-apply the service pack. If you don’t, then you’ll be running an unsupported “mixed mode” installation, meaning the core Visual Studio components will be at the SP1 servicing level and TE will be at the RTM servicing level.

Struggling with LoadTest Reports

Been two days I was struggling with troubleshooting Loadtest reports. Still I am not able to access the inbuilt LoadTest report which comes with VSTS 2008.

Thanks to Shai, for giving me this wonderful link which solved my purpose of reports.

Tuesday, April 21, 2009

Use DataSource in Unit Test

I had a unit test in C#, written to test one of the functions of my service. Considering best practices of testing like Boundary Value testing, there were number of data input which I had to consider to completely test the function. For doing that one of the ways is, instead of writing different tests with different type of inputs, we can classify the test with respect to passing tests and failing tests.

I created a test for passing input values and another test in which the Test had an Expected Exception. In both the cases I had wide range of data input. For this I used a CSV file for getting the input data. So for in a particular test, all the data combinations mentioned in the CSV will be executed.
For using a Data Source in a test we will have to perform the following steps.


1. Go to the Properties of the Test (Press F4 after selecting the Test in TestView)


2. Select the Data Connection String button
3. Then select the type of input file suitable to you (CSV or XML) In my case I used CSV




4. First Row of the CSV is automatically considered as header. (This needs to be taken care of while preparing the CSV)



5. Select Yes/No in the next dialog box if you wish to select this CSV to be added in deployment item and also get added to the solution. If you select Yes, the CSV will be added to the current project and also it will be added in the list of Deployment files in the LocaltestConfig.TestConfig file.


6. The Test will now look like

[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "DataDirectory\\CSV.csv", "CSV#csv", DataAccessMethod.Sequential), DeploymentItem("Test\\QA\\UnitTestProjectName\\CSV.csv"), TestMethod]
public void TestUsingDataSource()
{
}
7. For using the data in the test you will have to write TestContext.DataRow["Name"]
Note: The name you mention here should be exact to the header name given in the CSV.
The retrieved data from CSV can be converted to string by
Convert.ToString(TestContext.DataRow["Name"]).Trim();
That’s it. The test will be using the CSV whenever it runs now. The important thing to remember is whenever you run the test once from the test view, it will have individual runs inside it which will depend on the number of rows of the CSV.

Monday, April 20, 2009

Add Check-in Policy

The Check-in policy can be added at Team Project level. Below are the steps.
1. Open the Team Explorer
2. Select the Team Project
3. Right Click -> Source Control


4. Click on Check-in Policy Tab
5. Click on Add button.
You will get the options as above if you have installed PowerTools, otherwise 4 options will be displayed
1. Builds
2. Code Analysis
3. Testing Policy
4. Work Items

Wednesday, April 15, 2009

Paired Testing - successful implementation of a complex functionality

Pair-Testing is the exercise where a pair of testers (or any other pair of people) perform tests together (using only one interface with the AUT), with the objective of complementing each other with their backgrounds, points-of-view, experience, knowledge, or even luck.

The logic behind doing this is an additional person that looks at what you are doing and thinks about additional or different operations. This is really very helpful when testers/devs are working on a very complex bit of functionality.

One of the developers in my team was working on a functionality few days back which was really complex. He finished the first chunk of delivery. I paired up with him (Paired testing – 1 dev & 1 tester) and we started implementing the functionality. There were few unique scenario’s which we both came up individually. Been developing/testing that functionality, the dev or the tester would have forgotten implementing/testing that.

The functionality took good shape. It took more time than it was estimated at that point in time. (Naturally we were two resources working on the same bit). The code was tested by another tester and to our surprise the most complex functionality had only one new bug in it. Then we could make out that development didn’t take more time than expected as we had only one bug to fix and retest.

According to me pairing two testers and two developers always works, but we should try and experiment mixing them both in each other’s work. I am sure it will be worth for sure.

Wednesday, March 25, 2009

Load Testing of SOA - Services

I've been searching for a method by which I can perform Load testing of the services of my application (SOA Based). I wrote few Unit tests which I used to run from the inbuilt Load Agent with VSTS 2008 and get the results.

I was searching for another way by which I can get the counters from the services itself. I figured out how that can be done.

In the app.config of the service we want to host, we can write the following



<configuration>
<system.serviceModel>
<diagnostics performanceCounters="All" />
</system.serviceModel>
<\configuration>


This exposes all the performance counters from the service. There is a good article of this in MSDN

http://msdn.microsoft.com/en-us/library/ms735098.aspx

The counters can be viewed in the performance monitor of the machine hosting the service.
For opening this write perfmon.exe in Run

Create a new Log Setting for the required counters. And start the log setting before you perform the Load Test. You have to give a path to the output of the log as per requirement. I did with .blg file and it gives a pretty slick graphical representation of the data for all the counters selected in the profile.

Tuesday, March 17, 2009

Add/Modify Area & Iteration

Atlast I found it!!


I was searching for a option to add Area or Iteration to my Project. I had one option in my WebAccess portal of my Team Project but that didnt reflect in my Creat New work item Classification block.


Searched many things but didnt get any help. (the option is obvious but didnt get any help)


It can be done as below.










Tuesday, March 10, 2009

Auto-Generated Unit Tests for WCF services

A really cool tool that was released by Microsoft enables you to take a WCF trace file and a WCF client proxy, or a WCF interface contract, and generates a unit test that replays the same sequence of calls found in the trace file. The code generated is easily modifiable so that data variation can be introduced for the purpose of doing performance testing. The tool generates code for both Visual Studio 2005 and Visual Studio 2008.

Click here to download the tool

Wednesday, March 4, 2009

VSTS 2008 : Unit Testing - Keyboard Shortcuts

Normally I try to use keyboard shortcuts as much as possible. I believe that it saves time.
Here are some handy unit testing keybaord shortcuts with Visual Studio:
Run Mode
1. Ctrl + R, A – Run all tests
2. Ctrl + R, T – Run tests in context (based on if cursor is in function, class, or namespace)
3. Ctrl + R, F – Runs all tests that are checked in Test Results
Debug Mode:
1. Ctrl + R, Ctrl + A – Run all tests in debug mode
2. Ctrl + R, Ctrl + T – Run all tests in context in debug mode
3. Ctrl + R, Ctrl + F – Run all checked tests in debug mode

Enjoy Testing

Monday, February 16, 2009

SQL 2005 - Error: 26 - Error Locating Server/Instance Specified)

One of my colleague added a database project for deploying the database before unit test is run. Whenever I tried to open the solution I got the error as below

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

To resolve the problem perform the following

Change the VSTS Options; From Tools -> Options -> Data base Tools -> Design Time - Validation Data base -> Connection Options -> SQL Serevr Instance Name = Blank.


How to remove Recent Projects from Visual Studio 2008 Start Page

Being a tester I had never worked on Visual Studio before. I used to work with VB 6.0in my early career days. Since then I got not chance to create any new projects.

Given responsibility to setup TFS, Continuous Integration and also white box testing I had to create projects every now and then, which resulted in a never ending list of projects in my start page. No matter how many I delete from my local RnD folder the list didn't clear.

Below list helped me do that

1. Close Visual Studio if it is running.
2. Start the Registry Editor (run regedit).
3. Navigate to this registry key: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\ProjectMRUList
4. Then delete the key that has the project you do not want to keep in the list.

The only catch in the last step is you need to keep the File names consecutive.
e.g. If you have File 1 to File 5. Now if you dont need File 3 to appear in the list and if you remove File 3, Files 4 & 5 wont appear either. You need to rename the File 4 and 5 to File 3 and 4 so that the numbering is consecutive.

This will be very easy with VS2010. Its all xaml at the end of the day.

Monday, February 9, 2009

Continuous Integration - Force a build to fail when unit tests fail and create work item



I had to setup continuous build on my TFS2008 machine which had to run a specific set of tests before it created a build (whenever anyone check’s in any code). I was pretty much successful doing that. The process was running smooth but whenever a test used to fail the build used to “Partially Fail” and also it didn’t create a “Bug” and assign it to the person who broke the build. A Bug was assigned to the person who broke the build only when the build used to “Fail”.
I did some RnD in this and figured out a way to force a build to fail whenever a test failed. I wrote the below line in the TFSBuild.proj file

< treattestfailureasbuildfailure > true < /treattestfailureasbuildfailure >
Adding this I thought, as I am forcing the test fail to be treated as a Build Failure, TFS will take care of raising a work item or Bug to the person but it didn’t.
Then I wrote a Target in the same file to create a work item on Test failure.



<UsingTask TaskName="Microsoft.TeamFounadtion.Build.Tasks.CreateNewWorkItem"

AssemblyFile="$(TeamBuildRefPath)\Microsoft.TeamFoundation.Build.Tasks.VersionControl.dll" />


<Target Name="AfterTest">

<!-- Refresh the build properties. -->

<GetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)"

BuildUri="$(BuildUri)"

Condition=" '$(IsDesktopBuild)' != 'true' ">

<Output TaskParameter="TestSuccess" PropertyName="TestSuccess" />

</GetBuildProperties>

<!-- Set CompilationStatus to Failed if TestSuccess is false. -->

<SetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)"

BuildUri="$(BuildUri)"

CompilationStatus="Failed"

Condition=" '$(IsDesktopBuild)' != 'true' and '$(TestSuccess)' != 'true' ">

</SetBuildProperties>

<CreateNewWorkItem

BuildNumber="$(BuildNumber)"

BuildURi="$(BuildURI)"

Description="The CreateNewWorkItem task created this bug."

TeamProject="$(TeamProject)"

TeamFoundationServerUrl="$(TeamFoundationServerUrl)"

Title="Unit Test Failure in $(BuildNumber)"

WorkItemFieldValues="$(WorkItemFieldValues)"

WorkItemType="$(WorkItemType)"

Condition=" '$(IsDesktopBuild)' != 'true' and '$(TestSuccess)' != 'true' ">

</CreateNewWorkItem>

</Target>

Monday, January 19, 2009

LoadTest Controller

I was in the process of exploring Controller and Agent for Load testing using VSTS 2008. I am facing an issue in the same

"Failed to connect to remote Controller on machine 'tfs_Server', port '6901': No connection could be made because the target machine actively refused it ."

In the process of troubleshooting the problem, I read in one of theblogs is to install Visual Studio 2008 SPI in all the machines involved. i.e Controller, Agent and Client

In my scenario my Controller and TFS Server was the same machine.
I installed it on all machine but after I installed it on my controller machine, I was then not able to connect to my TFS Server from any of my clients.
I got the error below on all my client machines

"TF31001: Team Foundation cannot retrieve the list of team projects from Team Foundation Server tfserver. The Team Foundation Server returned the following error: Team Foundation services are not available from the server.
Technical information (for administrator):
TF30059: Fatal error while initializing web service.
"

Then I unstalled the SPI from the machine and then was able to successfully connect to the TFS Server

One more problem I faced then was I was getting error as below when I run my Load test.

"No connection could be made because the target machine actively refused it "
On going to the Controller machine and checking the services, the service for the controller was stopped. I tried to start the service manually but then the service stopped by itself giving me a message.

"The Visual Studio Team Test Controller Service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service. "

Then I realised that the whole problem was caused because my controller was a 90 Day or 25 Test Run trial.

Tuesday, January 13, 2009

Reset Database after Unit Tests are run

I was doing RnD using VSTS 2008 for Unit tests. One of the issue I faced was the data used to get changed after my tests were passed. This scenario created one more need for me to find a method to rollback what ever changes my Unit tests used to make to my database.

I tried out MdbUnit, NUnit but I was still searching for something which is provided by Microsoft itself. Reading to few blogs I successfully made it work.

[TestInitialize]
public void Initialize()
{
ServiceConfig config = new ServiceConfig();
config.Transaction = TransactionOption.RequiresNew;
ServiceDomain.Enter(config);
}

[TestCleanup]
public void Cleanup()
{
if (ContextUtil.IsInTransaction)
{
ContextUtil.SetAbort();
}
ServiceDomain.Leave();
}

After I wrote this in my Test.cs file I faced another error
system.Data.Entity Exception: The underlying provider failed on Open. ---> System.Transactions.TransactionManagerCommunicationException: Network access for Distributed Transaction Manager (MSDTC) has been disabled.

The following link helped me

http://social.msdn.microsoft.com/Forums/en-US/windowstransactionsprogramming/thread/993b1b87-b9c0-4070-938b-8539fcb059f6/

Wallah my Unit test problem is solved!

Wednesday, January 7, 2009

.Net 2.0 Runtime error on Recording Webtest using VS 2008

I faced a issued as follows:

When I start recording a webtest using VS 2008, IE7 or IE6 (Itried both) and Win XP on my machine, IE used to crash. On investigating in the Event viewer it had the following log

".Net 2.0 Runtime error" for iexplore.exe

I tried many settings but it was in vain. I then disabled my McAfee 8.0i on access scan and it worked.