Skip to content

Commit

Permalink
Changed: All function names renamed to start with capital letter.
Browse files Browse the repository at this point in the history
  • Loading branch information
sven.seyfert committed Feb 14, 2022
1 parent 4c3acf3 commit be1e403
Show file tree
Hide file tree
Showing 10 changed files with 215 additions and 207 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Go to [legend](#legend---types-of-changes) for further information about the types of changes.

## [1.5.0] - 2022-02-14

### Changed

- All function names renamed to start with capital letter.
- Version bump.

## [1.4.0] - 2022-02-10

### Added
Expand Down Expand Up @@ -57,6 +64,7 @@ Go to [legend](#legend---types-of-changes) for further information about the typ

- AutoIt Code formatting to the common notation without additional spaces after opened brackets and before closed brackets.

[1.5.0]: https://github.com/Sven-Seyfert/Au3LogFramework/compare/v1.4.0...v1.5.0
[1.4.0]: https://github.com/Sven-Seyfert/Au3LogFramework/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/Sven-Seyfert/Au3LogFramework/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/Sven-Seyfert/Au3LogFramework/compare/v1.1.0...v1.2.0
Expand Down
Binary file modified build/Au3LogFramework.exe
Binary file not shown.
88 changes: 44 additions & 44 deletions examples/AutoIt/Example.au3
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
; compiler information for AutoIt
#pragma compile(CompanyName, © SOLVE SMART)
#pragma compile(FileVersion, 1.4.0)
#pragma compile(FileVersion, 1.5.0)
#pragma compile(LegalCopyright, © Sven Seyfert)
#pragma compile(ProductName, Example)
#pragma compile(ProductVersion, 1.4.0 - 2022-02-10)
#pragma compile(ProductVersion, 1.5.0 - 2022-02-14)

#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
#AutoIt3Wrapper_Icon=..\media\favicon.ico
#AutoIt3Wrapper_Icon=..\..\media\favicon.ico
#AutoIt3Wrapper_Outfile_x64=Example.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=y
Expand Down Expand Up @@ -47,7 +47,7 @@ Global $sFileCurrentReport


; functions --------------------------------------------------------------------
Func _callAu3LogFramework($iAu3LogFrameworkAction, $sTestObject = '', $sTestScenario = '', $sTestScenarioState = '', $sTestScenarioStepType = '', $sTestScenarioStepDescription = '', $sTestScenarioAdditionalInfo = '', $sSystemUnderTestTitle = '')
Func _CallAu3LogFramework($iAu3LogFrameworkAction, $sTestObject = '', $sTestScenario = '', $sTestScenarioState = '', $sTestScenarioStepType = '', $sTestScenarioStepDescription = '', $sTestScenarioAdditionalInfo = '', $sSystemUnderTestTitle = '')
Local $sArguments = _
'"' & $iAu3LogFrameworkAction & '" ' & _
'"' & $sTestObject & '" ' & _
Expand All @@ -63,52 +63,52 @@ Func _callAu3LogFramework($iAu3LogFrameworkAction, $sTestObject = '', $sTestScen

ShellExecuteWait(@ComSpec, ' /C cd "' & $sAu3LogFrameworkPath & '" && ' & $sAu3LogFrameworkExe & ' ' & $sArguments, '', '', @SW_HIDE)

_randomSleep()
_RandomSleep()
EndFunc

Func _getCurrentCreatedReport()
Func _GetCurrentCreatedReport()
Local $aFileList = _FileListToArray($sAu3LogFrameworkReportPath, '*.html', 1, True)
Local $iFileCount = $aFileList[0]

Return $aFileList[$iFileCount]
EndFunc

Func _writeFile($sFolderReport, $sText)
Func _WriteFile($sFolderReport, $sText)
Local $hFile = FileOpen($sFolderReport, $iFileOpenMode)
FileWrite($hFile, $sText)
FileClose($hFile)
EndFunc

Func _getJustFileName($sFilePath)
Func _GetJustFileName($sFilePath)
Return StringRegExpReplace($sFilePath, '(.+?)\\', '', 0)
EndFunc

Func _createAdditionalInfosFile($sFile, $sText)
Local $sFolderReport = StringReplace(_getJustFileName($sFile), '.html', '\')
Func _CreateAdditionalInfosFile($sFile, $sText)
Local $sFolderReport = StringReplace(_GetJustFileName($sFile), '.html', '\')
Local $sTimestamp = @YEAR & '-' & @MON & '-' & @MDAY & ' ' & @HOUR & '''' & @MIN & '''' & @SEC & '''' & @MSEC
Local $sFileAdditionalInfos = $sAu3LogFrameworkOutputPath & $sFolderReport & $sTimestamp & '.txt'

ConsoleWrite($sFileAdditionalInfos & @CRLF)

_writeFile($sFileAdditionalInfos, $sText)
_WriteFile($sFileAdditionalInfos, $sText)

Return $sFileAdditionalInfos
EndFunc

Func _getHtmlATagWithAdditionalInfosFileLink($sFile)
Func _GetHtmlATagWithAdditionalInfosFileLink($sFile)
Local $sHtmlHref = StringReplace($sFile, '\', '/')
$sHtmlHref = StringReplace($sHtmlHref, '../../', '../')
Local $sHtmlATag = '"<a href="' & $sHtmlHref & '" title="Additional infos" style="color: #DC3912;" target="_blank"><i class="fa fa-info-circle"></i></a>'

Return StringReplace($sHtmlATag, '"', '""')
EndFunc

Func _getAdditionalInfoHtmlATag()
Local $sFileAdditionalInfos = _createAdditionalInfosFile($sFileCurrentReport, 'FailureMessage:' & @CRLF & _randomWords() & @CRLF & @CRLF & 'StackTrace:' & @CRLF & _randomWords())
Return _getHtmlATagWithAdditionalInfosFileLink($sFileAdditionalInfos)
Func _GetAdditionalInfoHtmlATag()
Local $sFileAdditionalInfos = _CreateAdditionalInfosFile($sFileCurrentReport, 'FailureMessage:' & @CRLF & _RandomWords() & @CRLF & @CRLF & 'StackTrace:' & @CRLF & _RandomWords())
Return _GetHtmlATagWithAdditionalInfosFileLink($sFileAdditionalInfos)
EndFunc

Func _randomWords($iWords = 30)
Func _RandomWords($iWords = 30)
Local $sText = ''

For $i = 1 To $iWords Step 1
Expand All @@ -128,46 +128,46 @@ Func _randomWords($iWords = 30)
Return $sText
EndFunc

Func _randomSleep()
Func _RandomSleep()
Sleep(Random(500, 1250, 1))
EndFunc



; processing -------------------------------------------------------------------
_callAu3LogFramework('start', $sTestObjectName)
_CallAu3LogFramework('start', $sTestObjectName)

Global $sFileCurrentReport = _getCurrentCreatedReport()
Global $sFileCurrentReport = _GetCurrentCreatedReport()

_callAu3LogFramework('test', $sTestObjectName, 'First test name', 'Ok', 'Given', 'Test with status Ok')
_callAu3LogFramework('test', $sTestObjectName, 'First test name', 'Screenshot', 'When', 'Test with status Screenshot', '', $sScreenshotWindow)
_callAu3LogFramework('test', $sTestObjectName, 'First test name', 'Ok', 'Then', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'First test name', 'Ok', 'Given', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'First test name', 'Screenshot', 'When', 'Test with status Screenshot', '', $sScreenshotWindow)
_CallAu3LogFramework('test', $sTestObjectName, 'First test name', 'Ok', 'Then', 'Test with status Ok')

_callAu3LogFramework('test', $sTestObjectName, 'Second test name', 'Ok', 'Given', 'Test with status Ok')
_callAu3LogFramework('test', $sTestObjectName, 'Second test name', 'Ok', 'When', 'Test with status Ok')
_callAu3LogFramework('test', $sTestObjectName, 'Second test name', 'Ok', 'When', 'Test with status Ok')
_callAu3LogFramework('test', $sTestObjectName, 'Second test name', 'Screenshot', 'When', 'Test with status Screenshot', '', $sScreenshotWindow)
_callAu3LogFramework('test', $sTestObjectName, 'Second test name', 'Warn', 'Then', 'Test with status Warn', _getAdditionalInfoHtmlATag(), $sScreenshotWindow)
_CallAu3LogFramework('test', $sTestObjectName, 'Second test name', 'Ok', 'Given', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'Second test name', 'Ok', 'When', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'Second test name', 'Ok', 'When', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'Second test name', 'Screenshot', 'When', 'Test with status Screenshot', '', $sScreenshotWindow)
_CallAu3LogFramework('test', $sTestObjectName, 'Second test name', 'Warn', 'Then', 'Test with status Warn', _GetAdditionalInfoHtmlATag(), $sScreenshotWindow)

_callAu3LogFramework('test', $sTestObjectName, 'Third test name', 'Ok', 'Given', 'Test with status Ok')
_callAu3LogFramework('test', $sTestObjectName, 'Third test name', 'Ok', 'When', 'Test with status Ok')
_callAu3LogFramework('test', $sTestObjectName, 'Third test name', 'Warn', 'Then', 'Test with status Warn', _getAdditionalInfoHtmlATag(), $sScreenshotWindow)
_callAu3LogFramework('test', $sTestObjectName, 'Third test name', 'Screenshot', 'When', 'Test with status Screenshot', '', $sScreenshotWindow)
_callAu3LogFramework('test', $sTestObjectName, 'Third test name', 'Error', 'Then', 'Test with status Error', _getAdditionalInfoHtmlATag(), $sScreenshotWindow)
_CallAu3LogFramework('test', $sTestObjectName, 'Third test name', 'Ok', 'Given', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'Third test name', 'Ok', 'When', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'Third test name', 'Warn', 'Then', 'Test with status Warn', _GetAdditionalInfoHtmlATag(), $sScreenshotWindow)
_CallAu3LogFramework('test', $sTestObjectName, 'Third test name', 'Screenshot', 'When', 'Test with status Screenshot', '', $sScreenshotWindow)
_CallAu3LogFramework('test', $sTestObjectName, 'Third test name', 'Error', 'Then', 'Test with status Error', _GetAdditionalInfoHtmlATag(), $sScreenshotWindow)

_callAu3LogFramework('test', $sTestObjectName, 'Fourth test name', 'Warn', 'Given', 'Test with status Warn', '', $sScreenshotWindow)
_callAu3LogFramework('test', $sTestObjectName, 'Fourth test name', 'Ok', 'When', 'Test with status Ok')
_callAu3LogFramework('test', $sTestObjectName, 'Fourth test name', 'Ok', 'Then', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'Fourth test name', 'Warn', 'Given', 'Test with status Warn', '', $sScreenshotWindow)
_CallAu3LogFramework('test', $sTestObjectName, 'Fourth test name', 'Ok', 'When', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'Fourth test name', 'Ok', 'Then', 'Test with status Ok')

_callAu3LogFramework('test', $sTestObjectName, 'Sixth test name', 'Warn', 'Given', 'Test with status Warn', _getAdditionalInfoHtmlATag(), $sScreenshotWindow)
_callAu3LogFramework('test', $sTestObjectName, 'Sixth test name', 'Error', 'Then', 'Test with status Error', _getAdditionalInfoHtmlATag(), $sScreenshotWindow)
_CallAu3LogFramework('test', $sTestObjectName, 'Sixth test name', 'Warn', 'Given', 'Test with status Warn', _GetAdditionalInfoHtmlATag(), $sScreenshotWindow)
_CallAu3LogFramework('test', $sTestObjectName, 'Sixth test name', 'Error', 'Then', 'Test with status Error', _GetAdditionalInfoHtmlATag(), $sScreenshotWindow)

_callAu3LogFramework('test', $sTestObjectName, 'Seventh test name', 'Ok', 'Given', 'Test with status Ok')
_callAu3LogFramework('test', $sTestObjectName, 'Seventh test name', 'Ok', 'When', 'Test with status Ok')
_callAu3LogFramework('test', $sTestObjectName, 'Seventh test name', 'Ok', 'Then', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'Seventh test name', 'Ok', 'Given', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'Seventh test name', 'Ok', 'When', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'Seventh test name', 'Ok', 'Then', 'Test with status Ok')

_callAu3LogFramework('test', $sTestObjectName, 'Eighth test name', 'Ok', 'Given', 'Test with status Ok')
_callAu3LogFramework('test', $sTestObjectName, 'Eighth test name', 'Ok', 'When', 'Test with status Ok')
_callAu3LogFramework('test', $sTestObjectName, 'Eighth test name', 'Ok', 'Then', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'Eighth test name', 'Ok', 'Given', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'Eighth test name', 'Ok', 'When', 'Test with status Ok')
_CallAu3LogFramework('test', $sTestObjectName, 'Eighth test name', 'Ok', 'Then', 'Test with status Ok')

_callAu3LogFramework('stop')
_CallAu3LogFramework('stop')
Binary file modified examples/AutoIt/Example.exe
Binary file not shown.
22 changes: 11 additions & 11 deletions src/Au3LogFramework.au3
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
; compiler information for AutoIt
#pragma compile(CompanyName, © SOLVE SMART)
#pragma compile(FileVersion, 1.4.0)
#pragma compile(FileVersion, 1.5.0)
#pragma compile(LegalCopyright, © Sven Seyfert)
#pragma compile(ProductName, Au3LogFramework)
#pragma compile(ProductVersion, 1.4.0 - 2022-02-10)
#pragma compile(ProductVersion, 1.5.0 - 2022-02-14)

#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
#AutoIt3Wrapper_Icon=..\media\favicon.ico
Expand Down Expand Up @@ -43,36 +43,36 @@ If $aInst[0][0] > 1 Then Exit
Switch $aCmdArg[$eAu3LogFrameworkAction]
Case 'start'
If StringLower($bShouldDisplayResolutionBeAdjusted) == 'true' Then
_setDisplayResolution()
_SetDisplayResolution()
Sleep(1500)
EndIf

_createReportStructure()
_CreateReportStructure()

Case 'test'
Switch $aCmdArg[$eTestScenarioState]
Case 'ok', 'screenshot'
_createTestScenarioOrScenarioStep($aColor[$eOk], $aCmdArg[$eTestScenarioState])
_CreateTestScenarioOrScenarioStep($aColor[$eOk], $aCmdArg[$eTestScenarioState])

Case 'warn'
_createTestScenarioOrScenarioStep($aColor[$eWarn], $aCmdArg[$eTestScenarioState])
_CreateTestScenarioOrScenarioStep($aColor[$eWarn], $aCmdArg[$eTestScenarioState])

Case 'error'
_createTestScenarioOrScenarioStep($aColor[$eError], $aCmdArg[$eTestScenarioState])
_CreateTestScenarioOrScenarioStep($aColor[$eError], $aCmdArg[$eTestScenarioState])
EndSwitch

Case 'stop'
$aIni[$eReportFile] = _readIniValue('ReportFile')
_setTestScenarioExecutionTime($aIni[$eReportFile])
$aIni[$eReportFile] = _ReadIniValue('ReportFile')
_SetTestScenarioExecutionTime($aIni[$eReportFile])

If StringLower($bSilentModeWithoutMsgBoxes) == 'false' Then
If MsgBox($iMsgBoxQuestionIcon, 'Question', 'Processing done.' & @CRLF & 'Open log report in default browser?', 30) == 6 Then
ShellExecute($aIni[$eReportFile])
EndIf
EndIf

_setMaxDirectories($aPath[$eOutput], $iAmountOfLastReportsToStore)
_setMaxFiles($aPath[$eReports], $iAmountOfLastReportsToStore)
_SetMaxDirectories($aPath[$eOutput], $iAmountOfLastReportsToStore)
_SetMaxFiles($aPath[$eReports], $iAmountOfLastReportsToStore)

Exit
EndSwitch
24 changes: 12 additions & 12 deletions src/BasicFunctions.au3
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Func _showErrorMessage($sText)
Func _ShowErrorMessage($sText)
If StringLower($bSilentModeWithoutMsgBoxes) == 'false' Then
MsgBox($iMsgBoxErrorIcon, 'Error', $sText, 30)
EndIf
EndFunc

Func _setMaxDirectories($sPath, $i = 20)
Func _SetMaxDirectories($sPath, $i = 20)
Local $aDirectories = _FileListToArray($sPath, '*', 2, True)
If IsArray($aDirectories) Then
Local $iDirectoriesCount = $aDirectories[0]
Expand All @@ -16,7 +16,7 @@ Func _setMaxDirectories($sPath, $i = 20)
EndIf
EndFunc

Func _setMaxFiles($sPath, $i = 20)
Func _SetMaxFiles($sPath, $i = 20)
Local $aFiles = _FileListToArray($sPath, '*.html', 1, True)
If IsArray($aFiles) Then
Local $iFilesCount = $aFiles[0]
Expand All @@ -28,14 +28,14 @@ Func _setMaxFiles($sPath, $i = 20)
EndIf
EndFunc

Func _writeFile($sFile, $sText)
Func _WriteFile($sFile, $sText)
Local $hFile = FileOpen($sFile, $iFileOpenMode)
FileWrite($hFile, $sText)
FileClose($hFile)
EndFunc

Func _writeToFileLine($sFilePath, $iLine, $sText, $bOverWrite = True)
If StringLower($bDebug) == 'true' Then _debug($sFilePath, $iLine, $sText, $bOverWrite)
Func _WriteToFileLine($sFilePath, $iLine, $sText, $bOverWrite = True)
If StringLower($bDebug) == 'true' Then _Debug($sFilePath, $iLine, $sText, $bOverWrite)

Local $aFileContent = FileReadToArray($sFilePath)
Local $iLineCount = UBound($aFileContent) - 1
Expand All @@ -60,7 +60,7 @@ Func _writeToFileLine($sFilePath, $iLine, $sText, $bOverWrite = True)
FileClose($hFile)
EndFunc

Func _getFileLineNumberForLastSearchMatch($sFilePath, $sText)
Func _GetFileLineNumberForLastSearchMatch($sFilePath, $sText)
Local $aFileContent = FileReadToArray($sFilePath)
Local $iLineCount = UBound($aFileContent) - 1

Expand All @@ -69,11 +69,11 @@ Func _getFileLineNumberForLastSearchMatch($sFilePath, $sText)
Next
EndFunc

Func _getDiffTime($sFrom, $sTo)
Return _secondsToMinutes(_DateDiff('s', $sFrom, $sTo))
Func _GetDiffTime($sFrom, $sTo)
Return _SecondsToMinutes(_DateDiff('s', $sFrom, $sTo))
EndFunc

Func _secondsToMinutes($iGivenSeconds)
Func _SecondsToMinutes($iGivenSeconds)
Local $iHours = Int($iGivenSeconds / 3600)
Local $iMinutes = Int(Mod($iGivenSeconds, 3600) / 60)
Local $iSeconds = Mod($iGivenSeconds, 60)
Expand All @@ -83,7 +83,7 @@ Func _secondsToMinutes($iGivenSeconds)
If $iSeconds <= 59 Then Return StringFormat('%02d', $iSeconds) & ' seconds'
EndFunc

Func _setDisplayResolution()
Func _SetDisplayResolution()
Local Const $CDS_TEST = 0x00000002
Local Const $CDS_UPDATEREGISTRY = 0x00000001
Local Const $DM_BITSPERPEL = 0x00040000
Expand Down Expand Up @@ -122,6 +122,6 @@ Func _setDisplayResolution()
$tDEVMODE = ''
EndFunc

Func _spaces($iAmountOfSpaces)
Func _Spaces($iAmountOfSpaces)
Return _StringRepeat(' ', $iAmountOfSpaces)
EndFunc
2 changes: 1 addition & 1 deletion src/Declaration.au3
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Switch $iArgumentCount
$aCmdArg[$eSystemUnderTestTitle] = $CmdLine[8]

Case Else
_showErrorMessage('Wrong count of arguments is used while calling ' & $sProgramName & '. Please read the documentation (README.md).')
_ShowErrorMessage('Wrong count of arguments is used while calling ' & $sProgramName & '. Please read the documentation (README.md).')

Exit -1
EndSwitch
Loading

0 comments on commit be1e403

Please sign in to comment.