Quantcast
Channel: All Quality Center / ALM Practitioners Forum posts
Viewing all articles
Browse latest Browse all 14708

Re: call test report folder wise from Test plan

$
0
0

Hi ,

 

Can you use this macro?

 

  • Function EmportTestCases()
  • OnErrorResumeNext
  • Dim QCConnection
  • Dim sUserName, sPassword
  • Dim sDomain, sProject
  • Dim TstFactory, TestList
  • Dim TestCase
  • 'Create QC Connection Object to connect to QC
  • Set QCConnection = CreateObject("TDApiOle80.TDConnection")
  • sUserName = "your user id"
  • sPassword = "your password"
  • QCConnection.InitConnectionEx "your QC URL/qcbin"
  • 'Authenticate your user ID and Password
  • QCConnection.Login sUserName, sPassword
  • 'Quit if QC Authentication fails
  • If (QCConnection.LoggedIn <> True) Then
  • MsgBox "QC User Authentication Failed"
  • End
  • EndIf
  • sDomain = "your domain name"
  • sProject = "your project name"
  • 'Login to your Domain and Project
  • QCConnection.Connect sDomain, sProject
  • 'Quit if login fails to specified Domain and Project
  • If (QCConnection.AuthenticationToken = "") Then
  • MsgBox "QC Project Failed to Connect to "& sProject
  • QCConnection.Disconnect
  • End
  • EndIf
  • 'Now successful connection is made to QC
  • 'Get the test factory
  • Set TstFactory = QCConnection.TestFactory
  • ' Your QC Project Path for which you want to download
  • ' the test cases.
  • fpath = "your project folder"
  • Set myfilter = TstFactory.Filter()
  • myfilter.Filter("TS_SUBJECT") ="^"& fpath & "^"
  • 'Get a list of all test cases for your specified path
  • Set TestList = myfilter.NewList()
  • 'Format the header before downloading the test cases
  • With ActiveSheet
  • .Range("B5").Select
  • With .Range("B4:F4")
  • .Font.Name = "Arial"
  • .Font.FontStyle = "Bold"
  • .Font.Size = 10
  • .Font.Bold = True
  • .HorizontalAlignment = xlCenter
  • .VerticalAlignment = xlCenter
  • .Interior.ColorIndex = 15
  • EndWith
  • .Cells(4, 2) = "Subject (Folder Name)"
  • .Cells(4, 3) = "Test Name (Manual Test Plan Name)"
  • .Cells(4, 4) = "Description"
  • .Cells(4, 5) = "Status"
  • Dim Row
  • Row = 5 '- set the data row from 5
  • 'loop through all the test cases.
  • ForEach TestCase In TestList
  • .Cells(Row, 2).Value = TestCase.Field("TS_SUBJECT").Path
  • .Cells(Row, 3).Value = TestCase.Field("TS_NAME")
  • 'QC stores description in html format. So before storing it
  • 'in to excel, StripHTML() will remove all HTML tags and put
  • 'texts only. Also new line tag is replaced with new line
  • 'character chr(10) in excel so that all the new line texts appears properly
  • .Cells(Row, 4).Value = StripHTML(Replace(TestCase.Field("TS_DESCRIPTION"), _
  • "<br>", Chr(10)))
  • .Cells(Row, 5).Value = TestCase.Field("TS_EXEC_STATUS")
  • Row = Row + 1
  • Next' Next test case
  • EndWith
  • 'Release the object
  • Set DesignStepFactory = Nothing
  • Set DesignStep = Nothing
  • Set DesignStepList = Nothing
  • Set TstFactory = Nothing
  • Set TestList = Nothing
  • Set TestCase = Nothing
  • QCConnection.Disconnect
  • MsgBox ("All Test cases are downloaded without Test Steps")
  • EndFunction
  • Function StripHTML(sInput AsString) AsString
  • Dim RegEx AsObject
  • Set RegEx = CreateObject("vbscript.regexp")
  • Dim sInput AsString
  • Dim sOut AsString
  • sInput = cell.Text
  • With RegEx
  • .Global = True
  • .IgnoreCase = True
  • .MultiLine = True
  • .Pattern = "<[^>]+>"'Regular Expression for HTML Tags.
  • EndWith
  • sOut = RegEx.Replace(sInput, "")
  • StripHTML = sOut
  • Set RegEx = Nothing
  • EndFunction

Viewing all articles
Browse latest Browse all 14708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>