Unit Testing
Jun 20, 2005Well was wondering this weekend. How do you do unit testing with SSIS? Is anyone trying it?
View 9 RepliesWell was wondering this weekend. How do you do unit testing with SSIS? Is anyone trying it?
View 9 RepliesI've started researching on Unit Testing and I must admitI had never heard of Unit Testing until a couple of monthsago. Obviously I am interested in Unit Testing StoredProcedures.I read the TSQLUnit documentation (not all of it) and i also raninto a newsgroup post saying TSQLUnit is very small comparedto NUnit. The conclusion I am making out of this post is thatI should rather spend time resarching/reading about NUnit thanTSQLUnit. Is that a good assessment?I would like to you what you use and if you use actuallyUnit Testing or some other method? I ran into White Box/Black BoxQA testing. All these are new to me. Any good place to read about"Extreme Programming"? I ran into one link that I saved it at work.That's one place i will read more.Any links, documentation or books you would suggest?I searched Amazon and I didn't find anything interestingregarding SQL Server and Stored Procedures.Thank you
View 1 Replies View Related
Hello.
I want to test my custom component with unit tests and i thought i must only initilize the component to play around with it. But when i calling the ProviderComponentProperties method and there the RemoveAllInputsOutputsAndCustomProperties method a NullReference exception is thrown. After debugging the test i had seen that the ComponentMetaData of the component is null. Is there a way to initilize the ComponentMetaData?
The Code of the Component looks like this:
Code Block
[DtsPipelineComponent(
DisplayName = "TestSourceAdapter",
ComponentType = ComponentType.SourceAdapter,
IconResource = "TestSourceAdapter.TestSourceAdapter.ico"
)]
public class TestSourceAdapter: PipelineComponent
{
public override void ProvideComponentProperties()
{
RemoveAllInputsOutputsAndCustomProperties();
IDTSOutput90 output = ComponentMetaData.OutputCollection.New();
output.Name = "TestSourceAdapter";
ComponentMetaData.OutputCollection
["TestSourceAdapter"].ExternalMetadataColumnCollection.IsUsed = true;
ComponentMetaData.ValidateExternalMetadata = false;
ComponentMetaData.UsesDispositions = true;
ComponentMetaData.Name = "TestSourceAdapter";
ComponentMetaData.Description = "TestSourceAdapter";
ReinitializeMetaData();
}
...
}
And in test i call only this
Code Block
TestSourceAdapter testAdapter = new TestSourceAdapter();
_testAdapter.ProvideComponentProperties();
i hope anyone can help
regards
kai
Now that we have a good programming model in SSIS - the question is whether to write automated unit tests for your packages, and would it generally be a good idea for packages?
Also - if yes to write tests - then where to find more informations regarding How to accomplish that?
The following query returns a value of 0 for the unit percent when I do a count/subquery count. Is there a way to get the percent count using a subquery? Another section of the query using the sum() works.
Here is a test code snippet:
--Test Count/Count subquery
declare @Date datetime
set @date = '8/15/2007'
select
-- count returns unit data
Count(substring(m.PTNumber,3,3)) as PTCnt,
-- count returns total for all units
(select Count(substring(m1.PTNumber,3,3))
from tblVGD1_Master m1
left join tblVGD1_ClassIII v1 on m1.SlotNum_ID = v1.SlotNum_ID
Where left(m1.PTNumber,2) = 'PT' and m1.Denom_ID <> 9
and v1.Act = 1 and m1.Active = 1 and v1.MnyPlyd <> 0
and not (v1.MnyPlyd = v1.MnyWon and v1.ActWin = 0)
and v1.[Date] between DateAdd(dd,-90,@Date) and @Date) as TotalCnt,
-- attempting to calculate the percent by PTCnt/TotalCnt returns 0
(Count(substring(m.PTNumber,3,3)) /
(select Count(substring(m1.PTNumber,3,3))
from tblVGD1_Master m1
left join tblVGD1_ClassIII v1 on m1.SlotNum_ID = v1.SlotNum_ID
Where left(m1.PTNumber,2) = 'PT' and m1.Denom_ID <> 9
and v1.Act = 1 and m1.Active = 1 and v1.MnyPlyd <> 0
and not (v1.MnyPlyd = v1.MnyWon and v1.ActWin = 0)
and v1.[Date] between DateAdd(dd,-90,@Date) and @Date)) as AUPct
-- main select
from tblVGD1_Master m
left join tblVGD1_ClassIII v on m.SlotNum_ID = v.SlotNum_ID
Where left(m.PTNumber,2) = 'PT' and m.Denom_ID <> 9
and v.Act = 1 and m.Active = 1 and v.MnyPlyd <> 0
and not (v.MnyPlyd = v.MnyWon and v.ActWin = 0)
and v.[Date] between DateAdd(dd,-90,@Date) and @Date
group by substring(m.PTNumber, 3,3)
order by AUPct Desc
Thanks. Dan
I build a SSIS Package in Visual Studio 2005 , but i don't know how to test it automated?
View 7 Replies View RelatedI have three different columns, hour(s), min(s), sec(s)
I can add it up, but will like to convert it into. hrs, mins and sec.
this is how, i am adding it up into seconds.
SELECT ((TotalTimeSpentHrs*60*60)+(TotalTimeSpentMin*60)+(TotalTimeSpentSec))AS totaltime
FROM EST1
How can I convert the total seconds, so that i can input the result in a new column.
This is a question that has always intrigued me: what is the ideal File Allocation Unit Size for a disk holding only data or index pages on a server running SQL Server? It seems to me that 8,192 would be the ideal size as it would enable the system to gobble up an entire page in one go. Any ideas?
View 18 Replies View Relatedsaw my AS400 has this time stamp: 2007-05-02-11.29.56.811195
is SQL2005 able to have time stamp to this details?
I have a set of revenue records where there is a UNIT column and a REVCHARGE column. What I need to do is breakout the records into single records where the unit count is > 1 and calc the actual charge:
Ex:
Units REVCHG FIELD_A FIELD_B .....
3 3.00 ABCD EFGH
Needs to be converted to:
Units REVCHG FIELD_A FIELD_B .....
1 1.00 ABCD EFGH
1 1.00 ABCD EFGH
1 1.00 ABCD EFGH
The calc is obvious but how can I do this with a cursor but would like to do it without a cursor if possible? Anybody got an idea?
Thanks.
How to select the orderID, order date and the maximum-price unit of each order in the below tables in 2 ways:
1-using correlated sub-query
2-not using correlated sub-query
I only selected orderID, order date and the maximum price of each order but not the unit name.This is my query:
Code:
SELECT dbo.[Order Details].OrderID, Max(dbo.[Order Details].UnitPrice)as MaxUnitprice, dbo.Orders.OrderDate
FROM dbo.[Order Details] INNER JOIN
dbo.Products ON dbo.[Order Details].ProductID = dbo.Products.ProductID INNER JOIN
dbo.Orders ON dbo.[Order Details].OrderID = dbo.Orders.OrderID
GROUP BY dbo.[Order Details].OrderID, dbo.Orders.OrderDate
Hi,
I am developing automated .Net Unit Tests, and as a prerequisite of each test, I would like to clear the service broker queues of any messages. Executing the
RECEIVE * FROM statement appears to only return a message at a time, and not all as I expected. Any ideas on how to make this happen, besides not having to delete the queues and then having to rebuild them?
Thanks,Eugen
Hi friends,
Can anybody tell what all are required for the deployment of a package.
I read from some article that to deploy ur package SSIS runtime and .Net framework should be installed first
and 1)it is not necessary to install sql server 2005. if so Is it True .?
2)whether the ssis runtime is freely available as independent installation package like .Net framework
Since a couple days, we are getting this message the errorlog of one of our SQL2012 server
LogEntry: Error [36, 17, 145] occurred while attempting to drop allocation unit ID 451879652360192 belonging to worktable with partition ID 451879652360192.
(version Microsoft SQL Server 2012 - 11.0.5058.0 (X64))
I am wondering what is the best way trying to troubleshoot this issues? I do not know from which of out database this is coming.
We were asked to create an SQL function to return a unit price based on various criteria. The function works fine except for the tiered pricing (use of BillingPriceTable) calculation. What we need to do is break up the total quantity passed to the function and return the total of prices found. In our example, we passed a quantity of 9,721 units and need to return a total price of 231.92 using the table below.
Low Qty    High Qty    Fee       Actual Qty       Price
0Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 7500Â Â Â Â Â Â Â 0.025Â Â Â Â Â Â Â Â Â Â Â 7500Â Â Â Â Â Â Â Â Â Â 187.50
7501Â Â Â Â Â Â Â Â Â Â Â 15000Â Â Â Â Â Â Â 0.020Â Â Â Â Â Â Â Â Â Â Â 2221Â Â Â Â Â Â Â Â Â 44.42
Below is the table definition that we have to work with (ugghh).
CREATE TABLE [dbo].[BillingPriceTable](
[PriceTableID] [int] IDENTITY(1,1) NOT NULL,
[entity] [varchar](4) NULL,
[PriceTableCode] [varchar](10) NULL,
[PriceTableName] [varchar](40) NULL,
[Code] ....
What we have so far is shown below. The columns that start with bdxx are the "High Qty" values and the columns that start with prxx are the price for that quantity range. So, the current SELECT is shown below and it returns the price based on the entire qty of 9,721 and returns a unit price of 0.020 and should return 0.023857628
The current SELECT is shown below and is returning 0.020 which is the fee for the total rather than calculating the fee twice, once for the 0-7500 and again for the 7501-15000 (actually 7501-9721). Two things came to mind, one was a WHILE loop and the other was possibly a ranking function of some sort.Â
ALTER FUNCTION [dbo].[fn_GetPrice]
(
@plincdvarchar(3),
@pgrpcodevarchar(4),
@pitmcodevarchar(4),
@qtydecimal(10,1) = 1,
@corpnbrvarchar(9)
)
[Code] ....
What is the unit of the numbers you get in the Time Statistics-part when running a query in Microsoft SQL Server Management Studio with Client Statistics turned on?
Currently I get mostly 0´s, but if I try and *** up a query on purpose I can get
it up to around 30... Is it milliseconds or som made up number based on clockcycles or... ?
I would also like to know if it´s possible to change the precision.
- Nikolaj
I have a website and database in Access, how do i set it up so i can test it in IIS using SQL server?
View 5 Replies View RelatedI am using SqlServer 2005 Express Edition. I have written a stored procedure that has a transaction to make sure that it rolls back in case of failure. Is there a way to test that the transaction works. I don't now how to cause an error that would cause the transaction to roll back and raise the error with the details of the exception.
Thanks,
laura
hello everyone i was hoping to get some help.
i have sql server2000 and iis5.1 running and im using vbscript through asp.
i have a table that has two keys so that together they make a unique key.
so i am trying to test my table in asp so that if there is a duplicate unique key inserted then show an
error...
Can anyone help me?
I want to run remote procs from a local - central proc, but don't want to crash my proc if the remote NT Server or SQL Server is not available.
So, I want to test for NT and SQL availability first.
Here's my code.
====================
DECLARE
@DBName varchar(22),
@QueryString NVARCHAR(130),
@Resultsint,
@ResultsTxtvarchar(31)
/* I find the server-dbasename name in a lookup table, and then build dynamic script */
SELECT @DBName = "<SRVRNAME~DBASENAME>"
SELECT @QueryString = N'master..xp_cmdshell "ECHO >'
+ SUBSTRING(@DBName, 1,6)
+ 'pipesqlquery", no_output'
EXEC @Results = sp_executesql @QueryString
SELECT @Results /* <-- testing here.... */
=====================
If the NT / SQL is running, "@Results" should = 0 (success on the ECHO to the PIPE)
If the NT / SQL is NOT running, "@Results" should = 1 (error on the ECHO to the PIPE)
If I test in QA, I get the expected "@Results" values.
If I run the proc, I get "@Results" = 0 for both events, and them my proc fails on the remote proc call if the NT / SQL is NOT running.
I don't know how to write DMO in TSQL to try that.
I have also tried using 'odbcping' too.
HINTS? Better way to test remote NT / SQL is NOT running?
Thanks in advance.
Hi,
Is there anyway to test the loadtesting/Stress testing on SQLSERVER. I wanted to executes a Store procedure with concurrent users.
Thanks
JK
Anyone have a tool or script to run to test a SQL server under heavy stress?
View 1 Replies View RelatedHi,
I need help to test person's skills for
knowledge of SQL stored procedures
and DTS
Could someone point on good resources.
Thank you
Alex
i have performed all the steps for the replication there are two problems i encounytring
(i) how to check whether the replication is working or not
(ii) can replication on the subscribing server automatically create the table which publishing server is publshing
(iii)please tell me someother forums for sql server
what my knowledge says that in replication if i modify the data at one place it should automatically be modified in the subscribing server but this thing is also not happening (its not flashing any error message as such)
please tell me what all things i need to do to make sure that everything starts working
waiting for reply
ashish bhatnagar
Hi Guyz ,
I'm new to this forum and as well as new to OLAP testing . I would like to know OLAP testing and guidance for SQL server anlaysis services .
I have been trying install SQL server 2000 in my system but it not going through, Can anybody send information how to install SQL server and how to play with sample database.
Has anyone ever heard of using Response.Write to test sql queries in the query designer? Here is the actual suggestion I was given recently:
Response.write your sql query. Copy the query to your db query tool and run the query. Adjust the query as necessary to return the recordset you desire. When you have the proper query, adjust your asp code.
The query editor/designer doesn't like certain symbols and extraneous code. So how exactly can you use Response.Write with a sql query without getting errors in designer?
I've begun some testing with the June beta of SQL 2005. One problemI've hit is with scalar-valued functions. The error I often get whenexecuting functions is "Select statements included within a functioncannot return data to a client.". These same functions are workingfine under SQL 2000.Has anybody seen this behavior or know what the deal is?
View 7 Replies View RelatedI am running windows xp pro on my home computer and would like to test andatabase driven ASP .NET web application. I need to be able to create an SQLdatabase which will be assessed by the web application. I already have alocal IIS Server up and running.At work, I use SQL Enterprise Manager. I wanted to download it on my homecomputer but cannot find it anywhere on the net.How can I test my web applications at home on a person computer?Thanks.Jess
View 1 Replies View RelatedHi,How do I write a query where if a column, "value," is NULL I returnthe phrase "No value entered" but otherwise return the column's value,even if it is the empty string? I'm tried to modify this simple querySELECT value FROM meta_dataThanks, - Dave
View 2 Replies View Related
can any one guide me how should i do performance testing on database size for sql server.
I dont know how to read the execution plan, though i have read many document but still i am not clear.
For are the reports which shows the performance has been down and its all accurate.
Is it possible to get a list of all the fixes and enhancements that are going into SP1 for SSIS? This will make it alot easier to test seeing as we will know what we are looking for.
Regards
-Jamie
Hello Everyone
I am new to replication but i am into a project to test Transactional replication process , do anyone have any experience in this
If possible plz let me know what section i need to test .
Thanks in advance
Karthik
How do I test failover to point to the mirrored database instead of the principal without having to stop the primary instance? I would like to just bring the mirrored database on the primary instance to an offline status and see that the same database on the mirrored instance getting activated as the primary. This does not happen if I try to put the database on the primary server "offline" as it complains that any database that is being mirrored cannot be taken offline.
View 1 Replies View Related