forked from PyAr/pyafipws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Powershell Tests for VBS scripts
Signed-off-by: SONIABHISHEK121 <[email protected]>
- Loading branch information
1 parent
90ef00f
commit 4bc7c2b
Showing
5 changed files
with
157 additions
and
0 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
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,49 @@ | ||
# test_factura_electronica.ps1 | ||
|
||
$ErrorActionPreference = "Stop" | ||
|
||
# Run the VBS script and capture its output | ||
$output = cscript //nologo ejemplos\factura_electronica.vbs | ||
|
||
# Check if the script executed successfully | ||
if ($LASTEXITCODE -ne 0) { | ||
Write-Error "factura_electronica.vbs failed to execute" | ||
exit 1 | ||
} | ||
|
||
# Test for expected output | ||
$expectedOutputs = @( | ||
"InstallDir", | ||
"Token", | ||
"Sign", | ||
"Ultimo comprobante:", | ||
"Resultado", | ||
"CAE", | ||
"Numero de comprobante:", | ||
"ErrMsg", | ||
"Obs", | ||
"Reprocesar:", | ||
"Reproceso:", | ||
"EmisionTipo:" | ||
) | ||
|
||
foreach ($expected in $expectedOutputs) { | ||
if ($output -notmatch $expected) { | ||
Write-Error "Expected output not found: $expected" | ||
exit 1 | ||
} | ||
} | ||
|
||
# Check for successful CAE solicitation | ||
if ($output -notmatch "CAE: \d+") { | ||
Write-Error "CAE not obtained successfully" | ||
exit 1 | ||
} | ||
|
||
# Check for successful result | ||
if ($output -notmatch "Resultado: A") { | ||
Write-Error "Invoice authorization not successful" | ||
exit 1 | ||
} | ||
|
||
Write-Host "All tests for factura_electronica.vbs passed successfully" |
Empty file.
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,40 @@ | ||
# test_pyqr.ps1 | ||
|
||
$ErrorActionPreference = "Stop" | ||
|
||
# Run the VBS script and capture its output | ||
$output = cscript //nologo ejemplos\pyqr\pyqr.vbs | ||
|
||
# Check if the script executed successfully | ||
if ($LASTEXITCODE -ne 0) { | ||
Write-Error "pyqr.vbs failed to execute" | ||
exit 1 | ||
} | ||
|
||
# Test for expected output | ||
if ($output -notmatch "CrearArchivo") { | ||
Write-Error "CrearArchivo output not found" | ||
exit 1 | ||
} | ||
|
||
if ($output -notmatch "GenerarImagen") { | ||
Write-Error "GenerarImagen output not found" | ||
exit 1 | ||
} | ||
|
||
# Extract the file paths from the output | ||
$createdFile = ($output -split "`n" | Select-String "CrearArchivo").ToString().Trim() | ||
$generatedImage = ($output -split "`n" | Select-String "GenerarImagen").ToString().Trim() | ||
|
||
# Check if the files were created | ||
if (-not (Test-Path $createdFile)) { | ||
Write-Error "Created file does not exist: $createdFile" | ||
exit 1 | ||
} | ||
|
||
if (-not (Test-Path $generatedImage)) { | ||
Write-Error "Generated image does not exist: $generatedImage" | ||
exit 1 | ||
} | ||
|
||
Write-Host "All tests for pyqr.vbs passed successfully" |
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,56 @@ | ||
# test_remito_electronico_carnico.ps1 | ||
|
||
$ErrorActionPreference = "Stop" | ||
|
||
# Run the VBS script and capture its output | ||
$output = cscript //nologo ejemplos\remito_electronico_carnico.vbs | ||
|
||
# Check if the script executed successfully | ||
if ($LASTEXITCODE -ne 0) { | ||
Write-Error "remito_electronico_carnico.vbs failed to execute" | ||
exit 1 | ||
} | ||
|
||
# Test for expected output | ||
$expectedOutputs = @( | ||
"InstallDir", | ||
"Token", | ||
"Sign", | ||
"Ultimo comprobante:", | ||
"Resultado:", | ||
"Cod Remito:", | ||
"Numero Remito:", | ||
"Cod Autorizacion:", | ||
"Fecha Emision", | ||
"Fecha Vencimiento", | ||
"Observaciones:", | ||
"Errores:", | ||
"Evento:" | ||
) | ||
|
||
foreach ($expected in $expectedOutputs) { | ||
if ($output -notmatch $expected) { | ||
Write-Error "Expected output not found: $expected" | ||
exit 1 | ||
} | ||
} | ||
|
||
# Check for successful remito generation | ||
if ($output -notmatch "Resultado: A") { | ||
Write-Error "Remito generation not successful" | ||
exit 1 | ||
} | ||
|
||
# Check for Cod Remito | ||
if ($output -notmatch "Cod Remito: \d+") { | ||
Write-Error "Cod Remito not obtained successfully" | ||
exit 1 | ||
} | ||
|
||
# Check if QR file was created | ||
if (-not (Test-Path "qr.png")) { | ||
Write-Error "QR code image file was not created" | ||
exit 1 | ||
} | ||
|
||
Write-Host "All tests for remito_electronico_carnico.vbs passed successfully" |