Tuesday, September 29, 2009
WatIn
It really is a great tool, and I love it's ease of use for development (I use it to autocomplete forms instead of typing all that crap in over and over again), but as an automated testing suite on a Windows technology stack, I'm just not a huge fan.
So today, I downloaded WatIn and gave it a run. I had the automated nUnit side up and running in a matter of minutes - the tests ran fast and the API is intuitive and easy to use.
The test recorder is not as good as Selenium's, but it's decent enough, and there is a beta version out that is supposed to be a vast improvement. I did download and try the Beta version, but it wouldn't even run for me, so I guess it's REALLY in Beta. Anyway, I'm more interested in the CruiseControl automated side of testing than visual testing, so it's easy, understandable unit test code that I want to be able to produce - and for this WatIn wins hands down.
Friday, September 18, 2009
Running Selenium RC as a Windows Service
Selenium does off Selenium RC, which combined with nUnit allows for this in a variety of programming languages. The problem here, is that the server is a jar file, and I wanted it running as a windows service on our build server.
Anyway, I found a great article on tacktech.com that shows how to run just about anything as a windows service - and I successfully used that article to get Selenium RC running as windows service on our build server. Here are the steps:
- Install the latest Java runtime if you don't have it installed already
- Install the Selenium server (e.g. C:\Selenium\selenium-server-1.0.1
- Download srvany.exe and instsrv.exe (these are part of the Microsoft Windows Resource Kit - you will need to download the correct version for your OS) and copy these files to a location on your server (e.g. C:\reskit)
- Browse to this folder, and type: instsrv "Selenium RC" "C:\reskit\srvany.exe" - this will create the windows service named "Selenium RC", which will now be installed as a Windows service, although it won't start up yet
- Open up regedit, and browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Selenium RC
- Right-click "Selenium RC" in the tree, and click New - Key, and add a key called "Parameters"
- Open Parameters, and create a new string value called "Application"
- Add the following to the data value for the new string value: "C:\Program Files (x86)\Java\jre6\bin\java.exe" -jar "C:\Selenium\selenium-server-1.0.1\selenium-server.jar", substituting paths to the java exe and the selenium server jar file where appropriate
- Load up the windows services console (services.msc) and start the service
Thursday, September 10, 2009
SQL Server: Finding tables by column
SELECT distinct
c.table_name,
c.table_schema,
c.column_name
FROM
information_schema.columns c
INNER JOIN information_schema.tables t
ON c.table_name = t.table_name
WHERE
c.column_name LIKE '%my_column_name%'
AND t.table_type = 'BASE TABLE'
ORDER BY
c.table_name,
c.column_name
Thursday, August 27, 2009
Roll on ASP.4
I've never been a Microsoft fanboy, but you have to give it to them, they really seem to have listened to their users the last few years as they continue to change all the issues people have griped about. The first two posts indicate more good things to come - the web.config files have been cleaned up (at last!) and now it appears there are some great project templates coming. What I am really excited about though is the complete control of client IDs that's coming - the whole UniqueID/ClientID pain in the ass has always bothered me about ASP.NET, and it looks like that has finally been addressed in .NET 4. Flubba dubba.
Friday, August 21, 2009
SQL Server: Currently Executing Queries
-- Do not lock anything, and do not get held up by any locks.
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
-- What SQL Statements Are Currently Running?
SELECT [Spid] = session_Id
, ecid
, [Database] = DB_NAME(sp.dbid)
, [User] = nt_username
, [Status] = er.status
, [Wait] = wait_type
, [Individual Query] = SUBSTRING (qt.text,
er.statement_start_offset/2,
(CASE WHEN er.statement_end_offset = -1
THEN LEN(CONVERT(NVARCHAR(MAX), qt.text)) * 2
ELSE er.statement_end_offset END -
er.statement_start_offset)/2)
,[Parent Query] = qt.text
, Program = program_name
, Hostname
, nt_domain
, start_time
FROM sys.dm_exec_requests er
INNER JOIN sys.sysprocesses sp ON er.session_id = sp.spid
CROSS APPLY sys.dm_exec_sql_text(er.sql_handle)as qt
WHERE session_Id > 50 -- Ignore system spids.
AND session_Id NOT IN (@@SPID) -- Ignore this current statement.
ORDER BY 1, 2
Friday, August 14, 2009
SQL Server: Changing Object Schema
alter schema NewSchema transfer OldSchema.ObjectName
Thursday, August 13, 2009
SQL Server: Finding and Killing Database Connections
select spid, sp.cmd, sp.hostname, sp.loginame, sp.nt_domain, sp.nt_username, sp.program_name from master.dbo.sysprocesses sp where db_name(dbid) = 'mydatabase' and DBID <> 0 and spid <> @@spid
If I want to take the database offline I'll then kill these processes using the spid.
I also found a great post today that had a nice way of killing ALL active connections, by running the following sql:
alter database dbName set single_user with rollback immediate
This can then be reverted out with
alter database dbName set multi_user with rollback immediate