I've created a simple database describing a video rental business. I am trying to test a simple T-SQL function that returns a movie's title under a specified id that the function accepts as an argument.
In Visual Studio, I created a new SQL Server Database project, set its target platform to SQL Server 2008 in the properties and imported the database scheme. That went well and all the tables appeared as well as my function. Then, I proceeded to right-click the function itself and chose the "Create unit tests..." option which opened a wizard where you choose the language (VB or C#) and how the generated files are to be named. It asks me to choose a database yet again which I do and it generated all of the needed files.
But, when I try actually running the generated test, it throws an error saying I should configure something using the SQL Test Configuration form which I do but it never saves! I suppose it should generate configuration options in the app.config file which simply remains empty!
Error - http://ift.tt/1EylRz9
SQL Test Configuration selected options - http://ift.tt/1SCVG5b (it doesn't save absolutely anything when I click OK)
App.config (there ought to be something in here, I guess):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
</configuration>
The function itself:
CREATE FUNCTION GetMovieById (@id BIGINT)
RETURNS NVARCHAR(50)
AS
BEGIN
DECLARE @title NVARCHAR(50)
SET @title = (SELECT title FROM Movie WHERE id = @id)
RETURN @title
END
What could be the problem? Should I use a different approach to SQL Server unit testing altogether? Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire