Saturday, February 1, 2014

How to create database in VSTS 2010

If you are using VSTS 2010 for your load testing project then, you got to create database for your testing.

Traditional load runner users like me knew that, once the scenario is ready, we just have to click on start button and give the path where we want to store the results. However, people developing VSTS thought that we must have some adventure while storing results. So in VSTS, mandatorily we will have to create SQL database and then link it with VSTS. We would have to give the path of the database instance to the VSTS and then the VSTS would store the results in that database. Ufff...

So now, we go and download SQL Server 2008 R2 version (Can somebody smell cross-selling?). Install the SQL Server. Here, restarting the machine may be optional, but since it is MS product, I suggest you restart your machine.

Fortunately, the script to create database and valid tables is given by the MS along with the VSTS installation. The file name which contains this script is by below name (note the extension): loadtestresultsrepository.sql

Path: <>\Microsoft Visual Studio 10.0\Common7\IDE

Open command prompt and navigate to the path where the sql script is stored. In command prompt window type below line and press Enter:

Cd c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE

After this, you can see that the cursor in command prompt points to the IDE folder. Now, we want to run the sql file from this IDE folder. Hence, now type below line and press Enter:

SQLCMD /S localhost\sqlexpress –i loadtestresultsrepository.sql

Here, the localhost implies the name of the computer like MYMACHINE001. Database schema by name LoadTest2010 would be created.

Some times, we may get error on executing SQLCMD line. In that case remove ‘sqlexpress’ word.

SQLCMD /S localhost –i loadtestresultsrepository.sql

This should work.

Now, go to VSTS 2010. Click on Test menu and select Manage Test Controller link. Another pop up should open. Beside the edit box for connection string, you can see small box with 3 dots on it. Click it. In next pop up, give server name as localhost i.e. MYMACHINE001 or localhost\sqlexpress (depending upon what worked for you). Click Refresh button. Use Windows Authentication. In connect to database dropdown, select LoadTest2010 option. (If the LoadTest2010 option does not come, repeat all the process again). Click on Test Connection button, you must get Success pop up.

If that too does not work, come till step of selecting LoadTest2010 option. There click on Advance button. In that pop up, you would get list of settings. In that, select redirection setting (last one). Make it false (if it was true).

Now, if that too does not work, go to load test settings. In Storage Results, select None. This would enable you to continue testing, however, you will have to save the results manually. In parallel, raise Microsoft ticket.

Note: All this information was collected from the MSDN forums and help files. This worked for us and in all probability, should work for you as well.

No comments:

Post a Comment