Skip to content
This repository was archived by the owner on Feb 19, 2023. It is now read-only.

Commit 550e3b6

Browse files
committed
feat: save report file
1 parent f97c2dd commit 550e3b6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

frmMain.vb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Option Strict Off
22
Option Explicit On
33

4+
Imports System.IO
5+
Imports System.Text.RegularExpressions
46
Imports System.Threading
57

68
Friend Class frmMain
@@ -2082,6 +2084,18 @@ LocalErrorHandler:
20822084

20832085
'Update the report block with the entire contents
20842086
rtbReport.Text = msEntireReportBlock
2087+
2088+
' Calc the name of the log file
2089+
Dim dirName As String = "C:\TestExecLogs\" & Regex.Match(TestExecSL1.Testplan.Path, "[^\\]+(?=\.tpa)").Value
2090+
Dim fileName As String = Date.Now.ToString("yyyy-MM-dd HH mm ss ") & txtSerialNumber.Text & ".txt"
2091+
Dim filePath As String = dirName & "\" & fileName
2092+
2093+
' Save to file
2094+
My.Computer.FileSystem.CreateDirectory(dirName)
2095+
Using sw As New StreamWriter(File.Open(filePath, FileMode.OpenOrCreate))
2096+
sw.WriteLine(msEntireReportBlock)
2097+
End Using
2098+
20852099
If gbTxSLTestplanTimeEnabled Then
20862100
gdtTestplanStopTime = TimeOfDay
20872101
rtbReport.Text = rtbReport.Text & "Total test time: " & VB6.Format(System.DateTime.FromOADate(gdtTestplanStopTime.ToOADate - gdtTestplanStartTime.ToOADate), "h:mm:ss")

0 commit comments

Comments
 (0)