Test Case status change to '1-Design' when copy pasted
Requirement is, if any tester copy paste test case, then the newly created Test Case design status should be set to '1-Design'
I am using below code in ActionExecuted function under common script
if ActionName = "TestPlanTree.Paste" and ActiveModule = "Test Plan" then
'test case if which is copied and pasted
oldTestId = Test_Fields("TS_TEST_ID").Value
Set tdc = TDConnection
Set testfact = tdc.TestFactory
Set tfilter = testfact.Filter
tfilter.Filter("TS_NAME") = testfact.Item(oldTestId).Name & "*"
Set tlist = testfact.NewList(tfilter.Text)
if tlist.Count > 0 then
msgbox "total tests with the same name=" & tlist.Count
Set pastedtest = tlist.Item(tlist.Count)
pastedtest.Field("TS_STATUS") = "1-Design"
Set pastedtest = nothing
Set tlist = nothing
Set tfilter = nothing
Set testfact = nothing
Set tdc= nothing
I am getting filter text as testcasename* which is correct
but when trying to get the list count, I am getting a very high value as 1830 like.
But it should be around 4 only as only 4 test cases are similar to that name.
Can you please let me know if there is anything wrong with this code.
Any help would be highly appreciated.
Try using tfilter.Filter("TS_NAME") = "'" & testfact.Item(oldTestId).Name & "*'" instead.