0% found this document useful (0 votes)
35 views33 pages

Test Automation - Basics

The document discusses test automation basics including why automate testing, the automation process phases, how it works, UI spy, PyCharm, TortoiseHg, repository structure, SmartTest, test runner, configuration file, common library, testing plans, conventions, reporting and tips.

Uploaded by

Longing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views33 pages

Test Automation - Basics

The document discusses test automation basics including why automate testing, the automation process phases, how it works, UI spy, PyCharm, TortoiseHg, repository structure, SmartTest, test runner, configuration file, common library, testing plans, conventions, reporting and tips.

Uploaded by

Longing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 33

TEST

AUTOMATION
– BASICS

First Steps

Internal
AGENDA

TEST WHAT WE HAVE REQUIRED PYTHON TEST DESIGN AND REPORTING & TIPS & TRICKS
AUTOMATION IN SCHNEIDER SOFTWARE AND EXECUTION ANALYSIS
PROCESS ELECTRIC TOOLS

Internal
WHY AUTOMATE TESTING?
• Optimization of speed, efficiency, quality and
the decrease of costs.
• Increase of test coverage.
• Advance a tester´s motivation and efficiency.

Internal
PHASES OF AUTOMATION
PROCESS
Decision taken by management
to initiate test automation
1. Decision

Analyse report and Select a suitable tool for


maintain scripts 6. Review 2. Tool
automation process

Automated
lifecycle
testing

Conduct automation test Prepare plan for automation


5. Execute 3. Planing
and develop reports testing process

4. Design
Design and develop automation test
process

Internal
HOW IT WORKS?
• Install target app
• UI Spy – Interact with UI
• Python – Programming language
• PyCharm – IDE for code creation and
maintenance
• TortoiseHg – GUI for Mercurial revision
control for working with code repositories.
• SmartTest – Automated tests execution

Internal
UI SPY
•The UISpy tool enables user to view and interact with the UI elements of an application.
• There is no installation process for UISpy
• Just start UISpy.exe

• The best UI Spy alternative:


- Window Detective,
- WinID,
- Winspector Spy and
-XWinspector.

Internal
Internal
Internal
Easy Extensible
FEATURES
Expressive Embeddable

Free and open source Interpreted

High level Large standard library

Portable GUI programing

Object oriented Dynamically typed

Internal
PYCHARM
• Download and install PyCharm
Community Edition
https://www.jetbrains.com/pycharm/
• Modern IDE with:
• Code inspections
• VCS support
• Debugger
• Quick navigations
• Refactoring

Internal
• Configure PyCharm: File >> Settings
• Configure project interpreter to
1. C:\Program Files\ADMS ContinuousIntegration\
Python\bin\python.exe
2. C:\Program Files\SmartTest\bin\ipy.exe

Internal
• In Project tree find path Libs >> python.
• Mark python directory as source root.
• Now PyCharm sees folder python
as specified folder with source code.

Internal
TORTOISEHG
• Download TortoiseHg (with Mercurial) http://tortoisehg.bitbucket.io/
• Check out repository (clone on Desktop or similar)
• Pull incoming changes.
• Code update / merge.
• Code commit.
• Push outgoing changes.

• Fact: hg is the symbol for the chemical element Mercury

Internal
Internal
REPOSITORY STRUCTURE

• Confs folder contains configuration JSON files.


• Libs folder contains libraries with methods which are often
used in automated tests.
• Plans folder contains test plans written in XML files.
• Repos folder contains XML files with structure of UI
applications.
• Tests folder contains automated tests.
• Logs folder contains logs of executed automated test.

Internal
SMARTTEST/TEST RUNNER

Internal
SMARTTEST/TEST RUNNER

Internal
TEST
Header section
• Info – a short test description.
• Author – author’s name and email .
• Feature – Team that owns the test.
• Require – Test dependencies.
• TestTimeout – Maximum execution time.

Internal
TEST
Import section
• To be able to use any package in your code (test),
make it accessible by importing.

Body section
• Every action has reaction.

Internal
METHOD

Use Python docstrings are the


string literals that appear right
after the definition of a function,
method, class, or module

Internal
CONFIGURATION FILE

• Typically contain constants


• Same test can be used for different target app, different
projects
• Default.json is mandatory and it is used to set
constants for test execution (e.g. milestone, branch,
different configuration paths)

Internal
COMMON LIBRARY

•Libs folder contains common functions


and classes which are often
used in automated tests.
•Advantages
• Code reusability
• Simpler and more readable tests
• Easier maintenance
•Every folder that contains libs must
have __init__.py to be treated
as Python package

Internal
TESTING PLANS
• Sanity Check Test plan
• Regression
• EnterpriseRegression
• UUC
• Unknown number of local team’s plans

Internal
CONVENTIONS
•Conventions are used to standardize the structure and coding style of an application to:
• Enable everyone to easily read and understand the code.
• Facilitate changing and maintaining the code.
• Create a consistent look to the code, so
that readers can focus on content, not layout.

Internal
REPORTING
• Test Plan Summary
• On demand using Automated Test Runner.
• Typically opened by browser.
• All tests logs systematized in one report.
• QA Dashboard
• Link on landing page.
• Typically CI results in real time.
• Regular daily cycles.
• Including results of Automated Tests

Internal
REPORTING

Internal
THINGS TO BEAR IN MIND
•Functionalities invisible for Test runner (content of Network view: colors, section)
• Element must be on center of view

Test is sometimes too fast for DMS software


• Must wait for button to be enabled (invoke_when_enabled or is_enabled)

wait_for(lambda: filter_toggle_button.is_enabled, 5, "Button must be enabled!")

•No indication when action is finished


• Use method wait with providing seconds as parameter

wait_for(lambda: control_window_1.is_open(), 60, "'Control Window' is not available!")

Internal
USEFUL TIPS
• Use recommended resolution Full HD (1920x1080) for automated tests that are testing
functionalities on network view.
• NOTE: No application or folder should be run or opened on the machine during execution of
automated tests.

Internal
HOW TO ANALYZE AT LOGS?
• Logs are stored in Logs folder
• Log is stored in folder name same as test name which is executed
• Log contains Debug, Info, Warn and Error messages and screenshots that are made
during test execution
• In the test log you can follow time stamps to see what action and when is executed.
• When test is failed, a few last actions should indicate what is the reason for failing
the test.

Internal
AUTOMATED TEST FAILED – EXAMPLE

Internal
• There are 5 different levels of logging:
LEVELS OF LOGGING
1. Log.info('Regular')

• This is a regular comment, usually used in various situations.

2. Log.debug('Debugging’)

This type of comment is used for debugging purpose, usually during development. It can be used to emphasize some problematic spot in test code.

3. Log.warning('Warning')

• This type of comment is used when we have an error that can be overcome, but it needs to be pointed out in a log.

4. Log.error('Errors')

• This type of comment is used for unexpected situations. All errors found during test execution are logged in this manner.

5. Log.screenshot('Screenshot is captured')

• Screenshot is used when it is needed to log screen shot of current situation on screen.

• It is vital not to use it too often because log can quickly become too large.

Internal
When adding a new test to central repository these steps should be followed:
1. Every automated test should be successfully executed on automated test developer
machine.
2. Code review must be done for every automated test.
3. Automated test should be successfully executed on QA machine.
4. Test on TFS must be marked as automated if automated test exists.
5. Automated test can now be pushed to central repository.
6. Business Analyst or a Product Owner decides which tests are SCT.
7. Adding test to test plan

Internal
DOCUMENTATION & LINKS
• More on python
• “Head First Python” – for elementary knowledge.
• Official python tutorial
https://docs.python.org/3/tutorial/index.html
Interactive python tutorial
http://www.learnpython.org/

Internal

You might also like