# Infrastructure Automation
Automating Infrastructure Management Services results in reducing the FTE as well as cumulatively getting better ROI using multiple tools, orchestrators, orchestration Engine , scripts and easy UI
# Simple script for black-box integration test of console applications
This is a simple example on how you can automate tests for a console application that interact with standard input and standard output.
The tested application read and sum every new line and will provide the result after a single white line is provided. The power shell script write "pass" when the output match.
$process = New-Object System.Diagnostics.Process
$process.StartInfo.FileName = ".\ConsoleApp1.exe"
$process.StartInfo.UseShellExecute = $false
$process.StartInfo.RedirectStandardOutput = $true
$process.StartInfo.RedirectStandardInput = $true
if ( $process.Start() ) {
# input
$process.StandardInput.WriteLine("1");
$process.StandardInput.WriteLine("2");
$process.StandardInput.WriteLine("3");
$process.StandardInput.WriteLine();
$process.StandardInput.WriteLine();
# output check
$output = $process.StandardOutput.ReadToEnd()
if ( $output ) {
if ( $output.Contains("sum 6") ) {
Write "pass"
}
else {
Write-Error $output
}
}
$process.WaitForExit()
}