Solution to "this test is locked by another quality center user"
There are a lot of instances while working with Quality center that you might have noticed this message "this test is locked by another quality center user”
Sometimes you may have imposed a self lock on it.. J This happens mostly when the user kills the QTP process when the script is still open(from QC).
If you have forgotten the machine where you have imposed a self lock then don’t worry as here is the soln to get rid of the same:
Copy the following code and run it from the machine were qc is instantiated.
On Error Resume Next
desc = "Please provide the network id for the user, and please make sure" &_
"this user is logged out prior to removing locks"
UName = InputBox(desc,"Provide network id")
If(UName <> "") Then
Set cmd = TDConnection.Command
cmd.CommandText = "DELETE FROM Locks WHERE LK_USER = '" & UName & "'"
cmd.Execute
MsgBox "All locks for user id: " & UName & " were removed", _
vbNotify+vbOKOnly,"Compelted"
Else
MsgBox "No locks were changed", vbNotify+vbOKOnly, "No Info"
End If
On Error Goto 0
desc = "Please provide the network id for the user, and please make sure" &_
"this user is logged out prior to removing locks"
UName = InputBox(desc,"Provide network id")
If(UName <> "") Then
Set cmd = TDConnection.Command
cmd.CommandText = "DELETE FROM Locks WHERE LK_USER = '" & UName & "'"
cmd.Execute
MsgBox "All locks for user id: " & UName & " were removed", _
vbNotify+vbOKOnly,"Compelted"
Else
MsgBox "No locks were changed", vbNotify+vbOKOnly, "No Info"
End If
On Error Goto 0
Provide your userid when prompted and wallah , the magic is done J
You can now go ahead and edit your scripts.
Happy Testing!
Hi, i tried this and didn´t work. Do QTP or QC need to be opened or something?
ReplyDeleteThanks, this problem has been haunting me since forever...
Make sure that qtp is closed and all instances of the qtp processes are killed and make sure you get the message ""All locks for user id: x were removed" .
ReplyDeleteDo i have to run this on the client PC? How does this script know how to connect to the DB?
ReplyDeleteI finally accessed QC as an admin and ran the SQL query to delete myself, but i can´t give everybody access to the DB, so this script would simplify things.
Thanks!!
This is seen when we directly Kill the QTP process, The best way is to close QTP instance then again open it, Now test still open in Readonly mode. Now disconnect from QC and close QTP. Now when you will open QTP you can see your test in edit mode
ReplyDeletehow can i run the code?
ReplyDelete@ Anonymous - Copy the code to a text file and save it as a .vbs file.
ReplyDelete@Hernan - Glad that worked for you!
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteAwesome.. it worked. :) Thanks Aditya. Thats the simple thing for which we are looking for.
ReplyDeleteGlad it did :)
DeleteGood job dude. code works excellent
ReplyDeleteThanks Jina!
DeleteNot working for me :(
ReplyDeleteThanks alot man.......
ReplyDeleteMore than happy when it works for someone :)
DeleteHi Tried above code but it not worked for me
ReplyDeletei am getting this message ""All locks for user id: x were removed" when i open script it show locked .:(
palm angels
ReplyDeletegoyard tote bag
supreme clothing
hermes outlet
goyard