Software Project Health Check: Best Practices and Techniques for Your Product...
Testing Without a GUI Using TestComplete
1. Place image here
(10” x 3.5”)
TESTING WITHOUT A GUI USING
TESTCOMPLETE
• STEVEN HOLLOWAY
• DevOps Lead
2. Who am I?
• I&T Engineer for Harris – 14 years
• Automated Testing – 17 years
• Past programs
– Automated new and existing programs
– Successful use of DevOps (CI/CD)
• Current Program
– DevOps Leads
• Customer has mandated the use of automation
• Passionate about helping people be successful
– Married 36 years, 3 kids, 6 grandkids
– Love playing Racquetball
3. The Need for Automation in a DevOps Pipeline
• Testing on a non-GUI application
• Required to log into Linux servers to do multiple things:
– Start or stop databases
– Load or delete databases
– Start or stop services
– Startup simulators
– Look at log and more!
• 70% of all my test required me to do some type of
interaction with those servers to do proper testing.
It was too much manual effort.
4. Scaling My Automation Efforts
• PuTTY is a terminal emulator which allow me to log into
Linux systems and can be used for any console
– Free
– Industry standard
• TestComplete can run PuTTY and get information from
the system to exercise distributed testing
– Have multiple PuTTY windows for each server
– Follow the flow of data on multiple systems and even control
different simulators or services simultaneously
6. Ensuring Accuracy with TestComplete and PuTTy
• Why PuTTy?
– Allows me to extract text to validate with 100% accuracy
– Allows me to send a command and validate a result
• The key for using TestComplete on PuTTY is to develop a
common library which is design similar to how Linux
works.
80% accuracy was not good enough.
7. Core of getting text out of PuTTY
#Create PuTTY object
w = Sys.Process("PuTTY").Window("PuTTY", <PuTTY name>, 1)
w.Restore()
w.Activate()
#Capture data to clipboard
w.SystemMenu.Click("Copy All to Clipboard")
sScreen = Sys.Clipboard
Log.Message(sScreen)
#Put contents into an array
aScreen = sScreen.splitlines()
#Clean up array and remove blank lines
aScreen = [s and s.strip() for s in aScreen]
aScreen = list(filter(None, aScreen))
#Clear Clipboard
w.SystemMenu.Click("Clear Scrollback")
return aScreen
#Create an object
Getting all the text in the PuTTY
windows. Even the text which has
scrolled off the screen. NOTE: be sure to
make sure your scroll back size is large
enough, so you do not lose any info.
Putting the all the text in the log file for
evidence.
Putting the text into an array so you can
search
Cleaning up the array and removing any
blank lines
Clearing the contents of the scroll back
and returning the array of information.
Return contents as an array
8. PuTTY Library examples
• PuTTY_launch: Opens a PuTTY Terminal
• cmd: Send a linux command to the PuTTY screen
• command: The command function will execute any command and wait for
the command prompt to come back
• prompt: turns prompt from terminal screen
• linux_path: Check to see if "/" is last character in path string and adds "/"
to end of path if necessary
• clear_cmd: Clears screen and scrollback in PuTTY
• cd_cmd: Executes cd command in terminal
• lsl_cmd: Execute the ls -l command while allowing to pass in additional
switches and pipe in commands like grep and returns the listing as an
array.
• tail_cmd: Execute the tail command passing in additional switches and
pipe in commands like grep and returns results as an array.
9. PuTTY Library examples
• diff_cmd: Executes diff command and returns an array of the results
• kill_cmd: Kills any process you pass in with be killed
• file_properties: Uses regular expression to find file or name or dir
• verify_file_dir_type: Executes ls -ltr command in unix terminal verifies if
directory or file exist in listing
• find_dir_or_file: Finds a directory or file using regular expression as part
of name. Look at time as a factor in picking the correct dir or file. If
ntimediff = 0 then do not use creation time for dir or fil
• vi_find_cmd: finds and value inside a file using vi
• vi_find_replace_cmd: Finds and replaces a word using the vi editor
• vi_find_delete_line_cmd: Finds and Deletes a line using the vi editor
• PuTTY_date_time_array: Returns the UTC Date and Time as an Array from
PuTTY terminal using the date -u command
• PuTTY_dir_file_time_array: Returns the Date and Time as an Array from a
File or Directory property passed in from a PuTTY terminal
10. Key to Success is a Strong Test Framework
• One language throughout your test automation
• A standard startup script
• A common library designed similar to how Linux works
• Logs with complete details in the logs
• TestComplete test suites with different test types for
DevOps
11. Looking Back
• Time savings: Used to take me 3 days to test system now
1.5 days
• Scale with accuracy/Compliance: Found an scalable
solution that allowed me to accurately test in a non-GUI
environment with 100% of confidence
• Faster resolution because detail logs tells why the failure
for troubleshooting
• Common library allowed 6 months worth of work to be
completed in 2 weeks
12. DevOps Testing Types
Fast Slow
Simple
Complex
Unit/Component
Testing
(white box testing)
Functional Testing
(verify
requirements)
System Testing
(Smoke Test -
completesystem)
Integration Testing
(grey box testing)
Performance/DITL
Testing
Build
ExecuteUnit
Test Suite
Deploy to
Environment
Execute
Functional
TestSuite
ReportResults
< 15minutes
13. Takeaways
• Scale testing with automation in non-GUI environments
• Ensure accuracy with terminal emulators like PuTTy
• Leverage logs and reports for analysis
• Deploy test suites on to Jenkins for a DevOps pipeline