-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added: First approach of a Test Explorer program, called "TestExecuto…
…r", as GUI.
- Loading branch information
sven.seyfert
committed
Oct 22, 2021
1 parent
35c40c7
commit 9ed2b59
Showing
20 changed files
with
915 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
Func _stringProperWithSpaces($sString) | ||
Local $sCharacter = '' | ||
Local $sProperString = '' | ||
Local $iCharactersCount = StringLen($sString) | ||
|
||
For $i = 1 To $iCharactersCount Step 1 | ||
$sCharacter = StringMid($sString, $i, 1) | ||
|
||
If StringIsUpper($sCharacter) Then | ||
$sProperString &= ' ' & $sCharacter | ||
Else | ||
$sProperString &= $sCharacter | ||
EndIf | ||
Next | ||
|
||
Return StringTrimLeft($sProperString, 1) | ||
EndFunc | ||
|
||
Func _getJustFileName($sFilePath) | ||
Return StringRegExpReplace($sFilePath, '(.+?)\\', '', 0) | ||
EndFunc | ||
|
||
Func _getCount($aList) | ||
Return UBound($aList) - 1 | ||
EndFunc | ||
|
||
Func _getFileContentAsList($sFileContent) | ||
Return StringSplit(_getFileContent($sFileContent), @LF, 1) | ||
EndFunc | ||
|
||
Func _getFileContent($sFile) | ||
Local Const $iUtf8WithoutBomMode = 256 | ||
|
||
Local $hFile = FileOpen($sFile, $iUtf8WithoutBomMode) | ||
Local $sFileContent = FileRead($hFile) | ||
FileClose($hFile) | ||
|
||
Return $sFileContent | ||
EndFunc | ||
|
||
Func _writeFile($sFile, $sText) | ||
Local Const $iUtf8WithoutBomAndOverwriteCreationMode = 256 + 2 + 8 | ||
|
||
Local $hFile = FileOpen($sFile, $iUtf8WithoutBomAndOverwriteCreationMode) | ||
FileWrite($hFile, $sText) | ||
FileClose($hFile) | ||
EndFunc | ||
|
||
Func _appendToFile($sFile, $sText) | ||
Local Const $iUtf8WithoutBomAndAppendMode = 256 + 1 | ||
|
||
Local $hFile = FileOpen($sFile, $iUtf8WithoutBomAndAppendMode) | ||
FileWrite($hFile, $sText) | ||
FileClose($hFile) | ||
EndFunc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
Global $sCheckboxLevelFeatureName = 'Feature' | ||
Global $sCheckboxLevelScenarioName = 'Scenario' | ||
Global $sIncludeFileOfScenarioSteps = 'IncludeFileOfScenarioSteps.au3' | ||
|
||
Global $iCount = 0 | ||
Global $iSuccessCounter = 0 | ||
Global $iFailureCounter = 0 | ||
Global $iNoExecutionCounter = 0 | ||
|
||
Global $aTableOfCheckboxesData[0][5] | ||
|
||
Global $aGui[$iMaxEnumIndex] | ||
$aGui[$eHandle] = Null | ||
$aGui[$eTitle] = 'TestExecutor' | ||
$aGui[$eXPosition] = Default | ||
$aGui[$eYPosition] = Default | ||
$aGui[$eWidth] = 800 | ||
$aGui[$eHeight] = 600 | ||
$aGui[$eStyle] = BitOR($GUI_SS_DEFAULT_GUI, $WS_HSCROLL, $WS_VSCROLL) | ||
$aGui[$eFont] = 'Consolas' | ||
|
||
Global $aCustomButtonRun[$iMaxEnumIndex] | ||
$aCustomButtonRun[$eHandle] = Null | ||
$aCustomButtonRun[$eTitle] = '▷' | ||
$aCustomButtonRun[$eXPosition] = 15 | ||
$aCustomButtonRun[$eYPosition] = 9 | ||
$aCustomButtonRun[$eWidth] = Default | ||
$aCustomButtonRun[$eHeight] = Default | ||
|
||
Global $aCustomButtonSelectAll[$iMaxEnumIndex] | ||
$aCustomButtonSelectAll[$eHandle] = Null | ||
$aCustomButtonSelectAll[$eTitle] = '☑' | ||
$aCustomButtonSelectAll[$eXPosition] = 43 | ||
$aCustomButtonSelectAll[$eYPosition] = 12 | ||
$aCustomButtonSelectAll[$eWidth] = Default | ||
$aCustomButtonSelectAll[$eHeight] = Default | ||
|
||
Global $aCustomButtonUnselectAll[$iMaxEnumIndex] | ||
$aCustomButtonUnselectAll[$eHandle] = Null | ||
$aCustomButtonUnselectAll[$eTitle] = '□' | ||
$aCustomButtonUnselectAll[$eXPosition] = 62 | ||
$aCustomButtonUnselectAll[$eYPosition] = 1 | ||
$aCustomButtonUnselectAll[$eWidth] = 28 | ||
$aCustomButtonUnselectAll[$eHeight] = 28 | ||
|
||
Global $aCheckboxFeature[$iMaxEnumIndex] | ||
$aCheckboxFeature[$eHandle] = Null | ||
$aCheckboxFeature[$eTitle] = Null | ||
$aCheckboxFeature[$eXPosition] = 32 | ||
$aCheckboxFeature[$eYPosition] = Null | ||
$aCheckboxFeature[$eWidth] = $aGui[$eWidth] - 150 | ||
$aCheckboxFeature[$eHeight] = Default | ||
|
||
Global $aCheckboxScenario[$iMaxEnumIndex] | ||
$aCheckboxScenario[$eHandle] = Null | ||
$aCheckboxScenario[$eTitle] = Null | ||
$aCheckboxScenario[$eXPosition] = 49 | ||
$aCheckboxScenario[$eYPosition] = Null | ||
$aCheckboxScenario[$eWidth] = $aGui[$eWidth] - 150 | ||
$aCheckboxScenario[$eHeight] = Default | ||
|
||
Global $aColor[$iMaxEnumIndex] | ||
$aColor[$eGreen] = 0x8BB965 | ||
$aColor[$eRed] = 0xF03A17 | ||
$aColor[$eBlue] = 0x1BA1E2 | ||
$aColor[$eGray] = 0xCDCDCD | ||
|
||
Global $aIcon[$iMaxEnumIndex] | ||
$aIcon[$eSum] = '∑' | ||
$aIcon[$eSuccess] = '✔' | ||
$aIcon[$eFail] = '❌' | ||
$aIcon[$eNotExecuted] = '⚠' | ||
$aIcon[$eFolder] = '📂' | ||
$aIcon[$eClock] = '⏱' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Global Enum _ | ||
$eBlue, _ | ||
$eClock, _ | ||
$eFail, _ | ||
$eFolder, _ | ||
$eFont, _ | ||
$eGray, _ | ||
$eGreen, _ | ||
$eHandle, _ | ||
$eHeight, _ | ||
$eMessageNoScenarioChosen, _ | ||
$eMessageNoStepFiles, _ | ||
$eMessageTitleNoStepFiles, _ | ||
$eMessageTitleNothingChosen, _ | ||
$eNotExecuted, _ | ||
$eRed, _ | ||
$eStyle, _ | ||
$eSuccess, _ | ||
$eSum, _ | ||
$eTitle, _ | ||
$eWidth, _ | ||
$eXPosition, _ | ||
$eYPosition, _ | ||
$iMaxEnumIndex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Func _executeScenarios() | ||
$aTableOfCheckboxesData = _setCheckboxesState($aTableOfCheckboxesData) | ||
|
||
Local $aTableOfSelectedScenarios = _getSelectedScenarios($aTableOfCheckboxesData) | ||
|
||
If UBound($aTableOfSelectedScenarios) == 0 Then | ||
MsgBox(48, $aTexts[$eMessageTitleNothingChosen], $aTexts[$eMessageNoScenarioChosen]) | ||
|
||
Return | ||
EndIf | ||
|
||
_ArrayDisplay($aTableOfSelectedScenarios, 2) | ||
|
||
_includeStepFiles() | ||
|
||
;~ TODO | ||
EndFunc | ||
|
||
Func _includeStepFiles() | ||
Local $aStepFileList = _getListOfFiles('Steps', '*Steps.au3') | ||
|
||
If Not IsArray($aStepFileList) Then | ||
MsgBox(48, $aTexts[$eMessageTitleNoStepFiles], $aTexts[$eMessageNoStepFiles] & @CRLF & @CRLF & _ | ||
'Folder:' & @CRLF & '*\Specification\Steps\') | ||
|
||
Return | ||
EndIf | ||
|
||
_writeFile($sIncludeFileOfScenarioSteps, '') | ||
|
||
For $i = 1 To _getCount($aStepFileList) Step 1 | ||
_appendToFile($sIncludeFileOfScenarioSteps, '#include "' & $aStepFileList[$i] & '"' & @CRLF ) | ||
Next | ||
EndFunc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
Func _showTestExecutor() | ||
Local $aListOfFeatureFiles = _getListOfFiles('Features', '.feature') | ||
Local $aTableOfFeatureFilesAndTheirScenarios = _getTableOfFeatureFilesAndTheirScenarios($aListOfFeatureFiles) | ||
|
||
_writeFile($sIncludeFileOfScenarioSteps, '; temporary dummy text') | ||
|
||
_createGui() | ||
_createDynamicGuiContent($aTableOfFeatureFilesAndTheirScenarios) | ||
_createButtonBar() | ||
_initializeGuiScroll() | ||
_waitForGuiEvent() | ||
EndFunc | ||
|
||
Func _getListOfFiles($sFolder, $sFileExtension) | ||
If @Compiled Then | ||
Local $sFilePath = _PathFull('..\src\Specification\' & $sFolder & '\') | ||
EndIf | ||
|
||
If Not @Compiled Then | ||
Local $sFilePath = _PathFull('..\..\Specification\' & $sFolder & '\') | ||
EndIf | ||
|
||
Local Const $iOnlyFiles = 1 | ||
Local Const $iRecursive = 1 | ||
Local Const $iSortAsc = 1 | ||
Local Const $bAbsolutePath = 2 | ||
|
||
Return _FileListToArrayRec($sFilePath, '*' & $sFileExtension, $iOnlyFiles, $iRecursive, $iSortAsc, $bAbsolutePath) | ||
EndFunc | ||
|
||
Func _getTableOfFeatureFilesAndTheirScenarios($aList) | ||
Local $aTableOfFeatureFilesAndTheirScenarios[1][4] | ||
|
||
For $i = 1 To _getCount($aList) Step 1 | ||
Local $aFileContent = _getFileContentAsList($aList[$i]) | ||
|
||
$aTableOfFeatureFilesAndTheirScenarios = _createTableOfFeatureFilesAndTheirScenarios($aTableOfFeatureFilesAndTheirScenarios, $aFileContent, $aList[$i]) | ||
Next | ||
|
||
Return $aTableOfFeatureFilesAndTheirScenarios | ||
EndFunc | ||
|
||
Func _createTableOfFeatureFilesAndTheirScenarios($aTable, $aFileContent, $sFeatureFilePath) | ||
Local $sRegExPatternOfFeatureSubFolderPath = '(.+?)Features' | ||
Local $sRegExPatternOfScenarioTitle = 'Scenario:.+?$' | ||
|
||
For $j = 1 To _getCount($aFileContent) Step 1 | ||
If StringInStr($aFileContent[$j], 'Scenario:', 2) == 0 Then | ||
ContinueLoop | ||
EndIf | ||
|
||
Local $sFeature = _getJustFileName($sFeatureFilePath) | ||
Local $sFeatureFolderPath = StringTrimRight($sFeatureFilePath, StringLen($sFeature)) | ||
Local $sFeatureSubFolderPath = StringRegExpReplace($sFeatureFolderPath, $sRegExPatternOfFeatureSubFolderPath, '') | ||
Local $sFeatureFolderBreadcrumb = 'Features' & StringTrimRight(StringReplace($sFeatureSubFolderPath, '\', ' > '), 2) | ||
Local $sFeatureName = _stringProperWithSpaces(StringReplace($sFeature, '.feature', '')) | ||
Local $sScenario = StringRegExp($aFileContent[$j], $sRegExPatternOfScenarioTitle, 1)[0] | ||
Local $sScenarioName = StringReplace($sScenario, 'Scenario: ', '') | ||
|
||
_ArrayAdd($aTable, $sFeatureFolderBreadcrumb & '|' & $sFeatureName & '|' & $sScenarioName & '|' & $sFeatureFilePath) | ||
Next | ||
|
||
Return $aTable | ||
EndFunc |
Oops, something went wrong.