Automatedtesting
Automatedtesting
This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing
process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools
and many iterations to get reader feedback, pivot until you have the right book and build
traction once you do.
Contact details:
Related Websites:
2
Every effort has been made to ensure that the information contained
in this book is accurate at the time of going to press, and the
publishers and author cannot accept any responsibility for any
errors or omissions, however, caused. No responsibility for loss or
damage occasioned by any person acting, or refraining from action,
as a result of the material in this publication can be accepted by the
editor, the publisher, or the author.
3
Table of Contents
Introduction. ............................................................................................................................... 5
Chapter 1. Theory of automated testing. ................................................................................... 10
Pyramids of automated testing. .......................................................................................................... 23
Understanding the testing pyramid is best in practice. ........................................................................ 27
Chapter 2. Automated testing strategies. .................................................................................. 32
1.1 Strategy «Let's try»........................................................................................................................ 32
1.2 Strategy «Here the target» ............................................................................................................ 34
1.3 Strategy «Operation Uranum» ....................................................................................................... 36
2. Parallelization of tasks. .................................................................................................................... 38
3. Create a test plan. ........................................................................................................................... 41
3.3 Testing strategy and planned types of testing on the project. ........................................................................ 42
3.5 Test completion criteria .................................................................................................................................... 43
4. The definition of a primary task......................................................................................................................... 43
5. Writing test cases for selected tasks. ................................................................................................................. 45
7. Selection of tests for automation. ..................................................................................................................... 48
4. Take into account the synchronization features of the browser and the application running the tests.
........................................................................................................................................................... 51
5. It is not necessary to prescribe hard values in the test case. ............................................... 52
6. Automated test cases should be independent. ............................................................................ 52
7. It is necessary to carefully study the documentation on the tools used. ...................................... 52
8. Preparation of test data. ............................................................................................................. 54
Development and maintenance of the testing automation process. .................................................... 56
1. Evaluation of the effectiveness of automation.................................................................................................. 56
9. Estimation of task execution time. .............................................................................................. 64
Features of test cases for automation. ....................................................................................... 67
Chapter 3. Organization of automated process on the project. .................................................. 73
Conclusion. ................................................................................................................................ 83
4
Introduction.
«Software testing has become a critical and an ever-growing part of
the development life-cycle. Initially, it relied on large teams
executing manual test cases. This has changed in recent years as
testing teams have found a way to facilitate a faster deployment
cycle: test automation. A cost-effective automation testing strategy
with a result-oriented approach is always a key to success in
automation testing. In this book let’s see how to build a good test
automation strategy. »
This book is based on more than 4+ years of experience in the field
of test automation. During this time, a huge collection of solved
questions has accumulated, and the problems and difficulties
characteristic of many beginners have become clearly visible. The
automated testing process was repeatedly created. It was obvious
and reasonable for me to summarize this material in the form of a
book that will help novice testers quickly build an automated testing
process on a project and avoid many annoying mistakes.
This book does not aim to fully disclose the entire subject area with
all its nuances, so do not take it as a textbook or Handbook — for
decades of development testing has accumulated such a volume of
data that its formal presentation is not enough and a dozen books.
Also, reading just this one book is not enough to become a "senior
automated testing engineer". Then why do we need this book?
5
First, this book is worth reading if you are determined to engage in
automated testing – it will be useful as a "very beginner" and have
some experience in automation.
Secondly, this book can and should be used as reference material.
Thirdly, this book — a kind of "map", which has links to many
external sources of information (which can be useful even
experienced automation engineer), as well as many examples with
explanations.
This book is not intended for people with high experience in test
automation. From time to time I use a learning approach and try to
“chew” all the approaches and build the stages step by step.
Summary:
We can safely say that this book is a kind of guide for beginners
in the field of automation software testing.
6
I have a huge knowledge of the field of test automation. I also have
quite a lot of experience building automation on a project from
scratch. I have repeatedly had to develop and implement the process
of testing automation on projects.
7
This book focuses on theory rather than a lot of additional libraries,
because once you have the basics, building a library and learning
how to use it becomes a matter of reading the documentation.
8
Acknowledgments.
9
Chapter 1. Theory of automated testing.
10
At the same time, 36 tests implemented in the framework of
smoke testing by automated scripts are performed in less than
five seconds and require only one action from the tester — to
run the script.
11
• Automation tools are able to collect, store, analyze, aggregate,
and present huge amounts of data in a human-readable form.
In our smoke-testing example of the "file Converter", the
amount of data obtained from the test is small — it can be
processed manually. But if you look at real-world design
situations, the logs of automated testing systems can take tens
of gigabytes for each iteration. It is logical that a person is not
able to manually analyze such amounts of data, but a properly
configured automation environment will do it itself, providing
accurate reports in 2-3 pages, convenient graphs, and tables, as
well as the ability to dive into details, moving from aggregated
data to details, if necessary.
12
So, with the use of automation, we are able to increase the test
coverage by:
13
First of all, you should realize that automation does not happen by
itself, there is no magic button that solves all problems. Moreover,
a series of serious drawbacks and risks are associated with test
automation:
• The need for highly qualified personnel due to the fact that
automation is a "project within a project" (with its own
requirements, plans, code, etc.). Even if we forget for a
moment about the "project within the project", the technical
qualification of employees involved in automation, as a rule,
should be significantly higher than that of their colleagues
involved in manual testing.
14
• Commercial automation tools are significantly expensive, and
the available free analogs do not always allow you to
effectively solve the tasks. And here again, we have to return
to the question of errors in planning: if initially a set of
technologies and automation tools was chosen incorrectly, it is
necessary not only to redo all the work but also to buy new
automation tools.
Testing makes our software more reliable and life easier. But not
always. After all, agree, it is better when we ourselves find and fix
the error before the release, than when an angry customer or user
tells us about the problem.
15
Firstly, we lose time to correct the defect, sometimes during
overtime or on weekends. And, secondly, we are losing business
reputation, which negatively affects the business.
Testing is especially useful when developing large applications in a
large team when you can accidentally break some function that the
other person did, and which you did not know. Or, when it is
necessary to finalize a previously written complex project.
In large companies, there may be a separate group of people who
are engaged only in testing. Usually, they are called the testing
Department, or Department QA (quality assurance) in this book, I
immediately want to separate the concepts of testing and QA.
Testing — the process of product quality assessment, and QA-is the
formation of processes that provide high-quality software
(including development processes, Analytics, documentation).
16
If we talk about testing, it is not easy to classify tasks. In some
(usually small) companies, the tester is provided with a workplace,
access to the Assembly of the product, leaving the organization of
work at his discretion.
In the companies, using more formal processes, there are clearly
defined roles of test designers (the designers of the tests), test
engineers (implementers of these tests), test automation
(developers), etc. Each of these roles requires its own unique skills
and abilities.
17
But regardless of the role, testers every day stand guard over the
quality of the software, a lot and often use their product, come up
with ways to "break" it, and all this goes to the product for the
benefit.
The software can and should be tested at different levels:
Unit testing — these are white-box tests that test individual pieces
of code, such as functions, methods, and classes. In other words, it
is testing one code module (usually one function or one class in the
case of OOP code) in an isolated environment. This means that if
the code uses some third-party classes, then instead of the” slip "
classes-stubs (Mocks and stabs), the code should not work with the
network (and external servers), files, database (otherwise we test
not the function or class, but also the disk, database, etc.)
Stubs — these are stub classes, which instead of performing an
action return some data (that is, in fact, the function consists of a
single return). For example, the stub class works with the database
instead of the real database is accessed to return that the request
completed successfully. And when you try to read something from
it returns a pre-prepared array with data.
Mocks — these are stub classes that are used to verify that a
particular function has been called (I don't think they are needed
very often).
Typically, a unit test passes different inputs to a function and
verifies that it will return the expected result. For example, if we
have a function to check the correctness of the phone number, we
give it pre-prepared numbers and check that it will determine them
correctly.
18
If we have a function to solve a square equation, we check that it
returns the correct roots (for this we make a list of equations with
answers in advance).
Unit tests well-tested code like this, which contains some logic. If
the code has little logic, but mainly contains references to other
classes, it can be difficult to write unit tests (since it is necessary to
make a replacement for other classes and it is not very clear what to
check?)
Integration tests – these are black-box tests, they test some
component of the system, usually consisting of many modules
(classes or functions). For example, for a blog, we can test that when
the function of saving a post in the database is called, this post
appears, it is true that it is tagged, the number of comments is zero.
And when you add a comment, it increases by one.
At the same time, you can test, for example, that a post with an
empty name is not saved. The product under test must be in the
active phase and deployed to the test environment. Tests of the
service often are just testing of the integration level.
In order to avoid errors and not depend on external conditions,
integration testing is performed in a controlled environment. For
example, before each test, a temporary database is created with pre-
prepared records (for example, blog users), folders for storing
temporary files are cleared, and instead of requests to external
services, a stub is used that returns pre-prepared answers. If this is
not done, we may receive errors, for example, due to the fact that
we are trying to insert into the user database with the email already
in use, due to the lack of any file or due to an external service error.
19
Tests will fall more often, and we will spend time figuring out the
reasons. Also, a test site is often deployed on a separate server or
virtual host.
In order to speed up the execution of tests, usually use a database
that stores data in memory, not on disk.
If we draw analogies, for example, with the testing of an aircraft
engine, the unit tests are testing of individual parts, valves, dampers,
and integration testing is the launch of the assembled engine on the
stand.
You can't test any code. If, for example, the code hardcoded
parameters of connection to the database or the path to the folders
without the ability to change them, it is unlikely to use a temporary
database (Database) for tests.
The same is true if the classes in the code are strongly related and
dependency injection is not used, but global variables or static
methods are used everywhere. In General, to summarize we need to
say the following Code you need to write efficiently.
API (Application Programming Interface) - a set of predefined
classes, procedures, functions, structures, and constants provided
by an application (library, service) for use in external software
products. In other words, it is a set of functions that can be called to
get some data. Well, for example, Google-maps. This service has its
own geolocation API, which is available to all users. By sending a
request to it with a geographical address, in response we get the
coordinates of the point (and Vice versa), and the Central Bank has
its own API that returns the official exchange rate on a given day.
If your application or portal has an API, you can test it by sending
pre-prepared requests and comparing the response with the
expected response.
20
They can be considered as multi-step integration tests. Tests for
the web interface are often end-to-end tests.
UI scripts (user interface) — that test the black box, that is, what
the user sees on the screen. This is perhaps the most difficult thing
to test, if we are talking, for example, about checking the operation
of the site, then we have to somehow emulate the work of the
browser, which is quite difficult to arrange, to analyze the
information that is displayed on the page. But this kind of testing is
very important because it interacts with the application as well as
the user.
UI tests are also called End-to-End (E2E) or acceptance tests. They
can be considered as multi-step integration tests. Tests for the web
interface are often end-to-end tests.
21
To test a web application (site or portal), you need to simulate the
browser. There are different approaches to this. There are simple
tools that only know how to send HTTP requests to the server and
analyze the resulting HTML code, and more advanced ones that
either uses a real "browser" engine in "headless" mode (that is,
without displaying a window with a page on the screen), and the
most advanced ones provide drivers with which you can control a
real browser.
Simple HTML browsers are good because they work much faster,
but they don't interpret CSS and JS code and can't check, for
example, the visibility of a button or scripts. Important – take
note.
1) Automation scripts should be repeatable. For example, you
cannot get the original data from the random number generator,
because in this case, we will not be able to repeat the scripts.
3) The automation scripts should not use the same algorithm as the
code being tested (since in this case the same error can be made and
the results will be the same).
22
5) When performing tests, it is necessary to monitor (automated)
the errors that occur. If you just get a message when an error occurs
(which the robot does not read) and the program continues to run,
this is a pretty useless automation script.
6) Automation scripts should be easy to run, ideally with a single
command. If you need to run it to perform a lot of actions, people
will be too lazy to do it. Companies usually set up a CI server that
downloads updates to their repository, runs tests, and sends error
messages to developers.
I think among you a huge number of people who have heard about
the pyramid of automatic testing. Why the pyramid? Just because
each level has a different number of tests. In fact, in the world of
automation, there are a huge number of pyramids. Below we look
at the 3 main pyramids, which are very common:
The ideal testing pyramid is shown in figure 1.
A little user interfaces automated testing. The average number of
integration tests. And a large number of unit tests.
23
Figure 1. The pyramid of testing from unit
24
Figure 2. The inverted pyramid test from the user interface.
25
The two triangular testing pyramid is shown in figure 4.
26
Understanding the testing pyramid is best in practice.
27
I remind you that the correct testing pyramid consists of UI,
integration, and unit and all these are automatic tests. Stop now
from reading for one minute and give yourself an answer to the
question.
28
And so, on the unit layer, the developer will write automatic tests,
which will cover the basic functionality of our product.
On the integration layer, we can ask the developer to write
documentation about the integration of our product. We have a
tester who will use this documentation and with the help of test
design will create "correct tests".
And we have an automation engineer who will be able to view the
tests that our tester has written and automate them quickly. It is also
likely to interact with the developer.
On the UI test layer, our tester will create "correct tests" with test
design, and the automation engineer will create UI automated tests.
And it turns out that in our product all three layers we can create.
We won't have any layer of our automated tests not present in the
pyramid.
29
On the part of integration tests due to the fact that code coverage on
the side of unit tests is very high, we can describe some top-level
integration tests in order to make sure that this functionality works
correctly. Also, at this level, we can go a little "left" or "right" to
make sure that some minor functionality can take advantage of our
UI functions without errors.
Finally, from the UI side, we can describe in such a way that we
will have very few UI tests and maintain the test design at the proper
level. Because in our product we have already checked from the
side of unit and integration that the data that come to us is correct
and, accordingly, on the UI side, we just check that they are
displayed correctly.
30
31
Chapter 2. Automated testing strategies.
32
Description of strategy:
33
1.2 Strategy «Here the target»
34
Description of strategy:
• Progressive strategy, somewhat reminiscent of Agile
development methodology. Moving forward in stages.
Coverage with automations scripts module by module, until
the full implementation of the meta task type (80% for six
months).
• At each stage, a new goal is set (most likely continuing with
the last completed goal, but not necessarily), and tools are
selected to implement this goal.
• Deep focus on a specific goal, writing test cases, automation
scripts, not for the whole project, but only for a specific task.
35
1.3 Strategy «Operation Uranum»
36
Description of strategy:
Summary:
It is necessary to consider the General logic and strategy of
automation, but I would suggest the following option: at the
beginning for 1 month (3-4 weeks) to use the strategy "Let's try", to
prepare the base for further work, not particularly deeply immersed
in writing code, the automation scripts and deep specifics of the
modules. Upon completion of this stage, we will have a ready basis
for further work. And then you need to choose how it will be
convenient to work on-roughly speaking, waterfall or agile. And
continue to act in accordance with the chosen strategy.
37
2. Parallelization of tasks.
Roles
Architecture
• Tool selection
• Choice of approaches
Development
Test design
• Test selection
• Test design
• Designing test data
38
Management
• Planning
• The collection of metrics
• Training
Testing
• Error localization
• Error institution
• Preparing test data
39
The logic is as follows.
1. There is a clear test Manager for this project, who plans,
determines the timing, and is responsible in case of non-
compliance.
2. There are two common types of testers — manual testers and
automated testers. In this case, the tasks of the roles "Test
design" and "Testing" are equally relevant for both types.
Accordingly, all testers write and design tests that can be used
in “manual” testing and automation.
3. Further, manual testers on the created test plans and test cases
conduct manual testing, automated testers also choose and
modify the necessary tests a suitable for automation.
40
3. Create a test plan.
Test plan should be for any relatively large project, which employs
testers. I describe a less formalized test plan than the option that is
usually used in large projects yet for internal use the formalities is
not necessary.
41
editing module, the file upload module was affected and the
function of sending notifications in the client was completely
redesigned").
42
3.5 Test completion criteria
Summary:
The most common types of tasks that are set before automation:
43
• Maximize the number of defects found. In this case, it is
necessary to select first those modules (or aspects of
functionality) of the system that are most often subject to
changes in the logic of work, and then select the most routine
tests (that is, tests where the same steps with small variations
are performed on a large amount of data).
• Minimization of the "human factor" in manual testing. Then
we select, again, the most routine tests that require the most
attention from the tester (at the same time, easily automated).
For example, testing the user interface (for example, checking
the names of 60 columns in a table), checking the content of a
combo box with 123 elements, checking the export of a table
on a web page to Excel, etc.
• Finding the most crash the system. Here you can apply
"random" tests.
44
The main criterion of smoke tests should be their relative simplicity
and at the same time mandatory verification of critical functionality
of the project.
Summary:
Make a list of primary tasks to automation testing logically will be
the primarily automate smoke-tests. In the future, they can be
included in the project and run at each build. Because of their
limited number, these tests should not slow down the build much,
but each time you can know for sure whether the critical functions
are still running.
45
Scenario testing implies that the time has was spent and on the
functionality of the project created test scenarios that cover the
largest possible amount of it.
Three options for further use of test cases, except for the obvious:
46
I will not describe in detail the principles of describing test cases,
there are a lot of materials on this topic on the web, I will describe
briefly.
For easy storage of test cases, there are many solutions, but of
those that I used, a very good application showed itself Test link,
and the best-the system sitechco.ru. convenient free system for
creating/storing and tracking test cases.
Summary:
For further automation of testing, it is necessary to write test cases
on the tasks set in item 4. They will serve as both the beginning of
normal regression testing and serve as a basis for further
automation scripts.
47
As a recommendation to the tester who plans to write test cases, I
recommend reading about the technique of pairwise, equivalence
classes and test design techniques. Having studied at least
superficially these topics to write good and useful test cases will be
much easier.
So, by the current stage, we have formed a test plan and described
part of the functionality of the modules as test cases. The next task
will be to select the necessary tests from the available variety of
test cases. Right now, you have only test cases prepared for
smoke-testing, but after a few iterations of test case development
in the project it will become much more, and not all of them make
sense to automate.
48
3. Checks related to ajax scripts (different applications have their
own solutions, but in General ajax is much more difficult to
automate).
49
The simplicity of the tests.
And the last important criterion for the selection of test cases for
automation is the relative simplicity of the tests. The more diverse
the steps in the test – the worse the test case, the more difficult it
will be to automate and the more difficult it will be to find a defect
in the event of the fall of this automation script at startup.
50
1. The expected result in automated test cases should be
described very clearly and concretely.
Let's say you click a link in a test and then take the next step of an
action on a new page. In this case, the page can be loaded for a
long time, and the application, without waiting for the download
of the desired item to run, will fall out with an error. Often this can
be easily solved by setting the parameter waiting for the item to be
loaded.
• Bad: click on the "Forms" link in the top menu. Confirm the
changes.
• OK: click on the "Forms" link in the top menu. Wait for the
form to appear with the text " Do you want to save changes?".
Click on the " OK " button.
51
5. It is not necessary to prescribe hard values in the test case.
This way you can avoid the situation when the test case
becomes false positive due to the wrong command, i.e., it
successfully passes in the situation when the application is
not working correctly.
52
Summary:
A correctly written test case designed for automation will be
much more similar to a miniature technical task for the
development of a small program than a description of the
correct behavior of the application under test, understandable
to a person.
53
8. Preparation of test data.
In this context, test data refers to the state of the application at the
time the tests start. Given that the values and parameters used in
automation scripts are almost always "hard-code", and are very
rarely flexible, the logical conclusion would be to assume that
they are unlikely to be executed in any state of the application. For
example, it is unlikely that you will run an automation script that
checks the editing of common articles in the production system,
where these articles are seen by customers, or in a completely
clean system, where there are no articles to edit.
In the first case, the automation script can mess up the excess, in
the second — just cannot run.
Accordingly, for the proper use of automation script are requested
to bring the application in these tests the appropriate condition.
There are no special rules here, everything is intuitively clear, if we
proceed from the tests, the only remark — usually, automation
scripts are run by isolated sets of independent tests. In this case,
tests of one set are often run-in random order. Accordingly, when
writing automation scripts, try to write them so that any other test
in the Suite can still run when one test completes.
54
An error occurs.
55
Development and maintenance of the testing
automation process.
56
2. Estimate the time required for testers to develop test cases and
checklists that will be used in testing this functionality — it
will be TMan.
3. Calculate (or estimate if the functions have not been developed
yet) the time that will be spent on one — time testing of
functions manually-it will be TManRun.
4. Estimate the time that will be spent on the alteration of auto
tests in the case of changes in functions — it will be
TAutoRun.
5. Calculate the time that will be spent on the analysis of the
results of the automation scripts — it will be TAutoMull.
6. Very tentatively, the planned number of iterations in the
product will be calculated until it is completed (if there is
accurate data on the number of development cycles — of
course, use this data) -it will be N.
7. Approximately estimate the number of builds of the product
demanding re-testing within the same release. Take the
average for R.
57
Now, we derive the following formula:
58
Here in this place, you need to stop and evaluate (communicating
with the developers), what is the probability of further changes in
the logic of the module functionality in the near future. What will
change and what is not planned yet?
2. Duplication of work.
At first, when automation scripts is still a little bit, they are exe-
cuted quickly enough with each build, but with the increase in the
numbers, the time for each test build is increasing. In case of find-
59
ing errors or the appearance of broken tests on the new functional-
ity, you have to restart the test Assembly again and again, each
time waiting for its completion.
• Critical
• Major
• Minor
• Trivial
60
The model described above is used to manage test sets.
• Module 1
• Module 2
• Module 3
• ...
Need to run:
• Run
• Not start
61
Sometimes we know for sure that this automation script will
not work properly (the function has been changed, but the
script has not been rewritten, scripts do not work correctly),
or we know for sure about the error that this script catches,
but we do not plan to fix it soon. In this case, the script
falling at each run may be inconvenient for us. To do this,
you can embed a label in the script, if you specify it in CI, the
script will not run. After fixing the problem, you can run the
script again.
Start time:
62
Summary:
63
9. Estimation of task execution time.
10. Research.
Research tests are those tasks for which it is very difficult for
us to estimate the execution time. This can be due to various
reasons: the introduction and research of a new tool for
automation, a new type of tests not used previously in the
project, the beginning of automation on the project or the
evaluation of the time of an inexperienced in automation
person.
64
• What is the best tool to use for automation? You may need a
new tool and need to devote time to its development, or old
enough, but you will have to look for workarounds to use it —
which will also take time.
11. Replicated.
If we can collect statistics on the implementation of similar to
the tasks set before us-then the tasks are replicated. Typically,
these tasks include creating automation scripts without using
new script types, extending coverage, and regular tasks to
support scripts and infrastructure.
65
Such tasks are quite simple to evaluate, because similar to
them have already been performed and we know the
approximate time of their execution. Help us:
Summary:
The wider the coverage of automation scripts functions of the
project, the more accurate will be your estimates of the time planned
for automation.
66
Features of test cases for automation.
Often (and in some projects and "as a rule") automation is subjected
to test cases, originally written in simple human language (and, in
principle, suitable for manual execution) — i.e., the usual classic
test cases.
And yet there are several important points that should be taken into
account when developing (or refining) test cases intended for
further automation. The main problem is that the computer is not a
human being, and the corresponding test cases cannot operate with
"intuitive descriptions", and automation specialists quite rightly do
not want to spend time to Supplement such test cases with the
technical details necessary to perform automation - they have
enough of their own tasks. It follows a list of recommendations for
the preparation of test cases for the automation:
67
• Since the test case can be automated using various tools, it is
necessary to describe it, avoiding solutions specific to a
particular tool.
Bad Good
1. Click on the "Search “link. 1. Click on the "Search “link.
2. Wait for the page to load.
2. Use clickAndWait to synchronize
timing.
Bad Good
1. Send a WM_ CLICK message to 1. Pass the input focus to any of the
the application in any of the visible non-minimized Windows of the
Windows. application (if not — expand any of
the Windows).
68
• One of the unexpected problems is still synchronization of the
automation tool and the tested application by time: in cases
when the situation is clear for a person, the test automation tool
can react incorrectly, "without waiting" for a certain state of
the tested application. This leads to the failure of test cases on
a correctly running application.
Bad Good
1. Click on the link "Expand data". 1. Click on the link "Expand data".
2. Select " Unknown "from the list 2. Wait until the data is loaded into
that appears. the Extended data list (select
id="extended_ data"): the list will
enter the enabled state.
Bad Good
Open http://application/. Open the main page of the
application.
69
• If possible, use the most versatile ways to interact with the
application under test. This will significantly reduce the time
to support test cases if the set of technologies used to
implement the application changes.
Bad Good
To pass into the "Search" a set of Emulate the input of the "Search"
events WM_KEY_DOWN, field value from the keyboard
WM_KEY_UP, resulting in a field (inserting a value from the buffer or
must be entered search query. assigning a value directly is not
appropriate).
Bad Good
From the file created by the previous 1. Set the "Use stream buffer file"
test checkbox to the checked state.
2. Activate the data transfer process
(click on the "Start “button).
3. From the file buffering to read.
70
• It is worth remembering that the automated test case is a
program, and it is necessary to take into account good
programming practices at least at the level of absence of
"magic values", "hardcoding" and the like.
Bad Good
if (dateValue == ‘2015.06.18’) if (dateValue == date(‘Y.m.d’))
71
Since for many novice testers, the first educational tool for test
automation is Selenium IDE, I will give an example of its use. For
example, in some steps of the test case, it was necessary to check
that the checkbox with id=cb is selected (checked). For some
reason, the tester chose the wrong command, and now at this step,
it is checked that the checkbox allows you to change its state
(enabled, editable), and not that it is selected.
And finally, consider the error that for some mystical reason makes
a good half of novice automation engineers — is the replacement
of verification by action and Vice versa. For example, instead of
checking the value of a field, they change the value. Or, instead of
changing the state of the checkbox, check its state. There will be no
examples of "good/ bad", because there is no good option — this
simply should not be, because it is — a gross mistake.
72
Chapter 3. Organization of automated process on
the project.
73
For example, consider some situation:
Imagine a Popup that appears on the web page and for front-end
automation tester will be great if he learns how this Popup is created
by the developer.
And at the same time, for example, he can learn from the developer
that he created as many as 3 different Popup.
And automation engineer then it will be clear that it is not necessary
to bind to one popup provided that it will automate another popup,
as there may be another business function, another location,
elements, and locators. Similarly, with the backend automation
engineer if he starts working with the development team, he learns
how developers create integrations, what methods they have, what
they throw, what are the pitfalls it is from the backend. Thus, by
separating automation engineers we can guarantee that we will be
able to create the right testing pyramid and maintain it.
74
75
The process is as follows, a business analyst who communicates
with the tester, a disgruntled customer and a Product Owner who
stands and looks and does not understand what is happening. The
development manager is in charge of everything, the backend
developer and the front-end developer are arguing over how and
what and can't find a compromise. In General, a complete mess.
We put 2 developers and one automation engineer at the beginning
of the project. Accordingly, developers and automation engineers
can start writing automation scripts together. Developers write unit
tests. And automation engineers write integration and user interface
tests.
76
Provided that automation starts at the beginning of the project,
developers and automation engineers can divide the creation of
automated tests among themselves, agreeing on the division of
responsibility.
77
If the automation process is created in the middle of the
project.
78
1) Regression.
79
At some iteration, it turns out that everything that is included in the
regression and automation scripts takes some part and if you
compare, it becomes clear that automation scripts take a smaller
part than the new functionality. Because the new functional tests are
written more than written automation scripts. Accordingly, it turns
out that there are more new tests written for new functionality than
automation scripts. It becomes clear automation engine will not
have time to cover all regression tests. You should try to create
automation scripts more than you create tests for new functionality,
which later will go into automation.
80
2) New functionality.
Let's say we have a testing team that writes test scripts and
immediately passes them to automation. The automation engineer
begins writing automation scripts. There's only one question left.
Who will do regression testing? Accordingly, if regression testing
is not covered by automation, it will increase more and more. Here
will help rule if we create on a new functional test less, than on
automation, then our automation engineer can have time, as write
automation scripts on new functionality, so and on the old, and quite
possibly they reach moreover, that automation scripts will be
created in parallel designing.
81
To understand where to start testing automation with
new functionality or regression. It is necessary to answer
the question. Where you find more defects in new
functionality or in regression?
82
Conclusion.
I hope that if you have read this book to the end, you have an
understanding of the basics of test automation. In this Chapter, I
offer you books and websites that you can visit to continue your
education.
I recommend reading Java books that I have personally read and
refer to them very often:
"Effective Java" By Joshua Bloch
"Implementation patterns", Kent Beck
"Growing object-oriented software driven by testing" Steve
Freeman and Nat Price
"Core Java: Volume 1-Basics" Kay. Horstman and Gary Cornell
"Covert Java: techniques for decompiling, putting and reverse
engineering" Alexey Kalinovskiy
"Competition Java in practice" by Brian Goetz
"Mastering regular expressions" Jeffrey Fridley to justify my
choices.
"Design Patterns: Elements of Reusable Object-Oriented Software"
Erich Gamma, John Vlissides, Richard Helm, Ralph Johnson
83
For General Java news and modern video conferencing, I
recommend the following web page:
https://www.infoq.com/java/
Let me remind you that I have a website http://test-engineer.site,
and I plan to add more information there, and links to other
resources over time. I will also add more exercises and examples on
this site.
84