Professional Documents
Culture Documents
A Journey From Manual Testing To Automated Test Generation in An Industry Project
A Journey From Manual Testing To Automated Test Generation in An Industry Project
Authorized licensed use limited to: Volkswagen AG. Downloaded on January 08,2023 at 09:53:10 UTC from IEEE Xplore. Restrictions apply.
Phase 2: Automated Test Execution velopment activities mainly concerned maintenance and bug
The second phase is characterized by the development of au- fixing. The automated tests were run periodically to detect bugs
tomated tests for the GUI to fill the gap in regression testing. introduced by changes. A few new tests were written and occa-
We used TestFX that allows writing GUI tests with the estab- sionally adaptations of the test adapter were required, trigger-
lished JUnit framework. Furthermore, following the idea of the ing a re-generation of the GUI tests. The main testing activity
page object pattern [1], we implemented a test adapter for the was exploratory testing conducted before every commit.
virtual keyboard. It provides a programming interface to the + Automated regression tests are executed regularly. So far
keyboard’s GUI so that it can be accessed from high-level GUI they were able to detect one bug introduced by a change.
tests without the need to interact with individual GUI elements.
In addition our adapter also provides an internal state model – Executing the generated tests became a long-running task,
that keeps track of the keyboard’s state. It serves as test oracle first, because of the large number of tests, and second, because
and is used to check that transitions end in the expected states. of the time-consuming nature of GUI interactions. Thus, local
execution of the tests before every commit was not considered
+ A set of automated GUI tests were developed representing viable. Instead the tests were run on the build server once a day
important usage scenarios and known error cases. Writing and with the downside of long feedback cycles in case of failing
maintaining these GUI-level tests using JUnit and our adapter tests. This delay is particularly painful if tests are flaky.
was straightforward. Frequent execution of these tests lowered
the risk of critical regressions in ongoing development.
III. CONCLUSIONS AND LESSONS LEARNED
– Besides exploratory and unit testing for new user stories, (1) Don’t neglect automated GUI tests. The test automation
additional effort had to be put into developing the test adapter pyramid [4] proposed for agile development emphasizes unit
and GUI tests. And even when they were available, the need tests as the foundation of a solid test automation strategy and
for manual regression testing was not reduced much since the discourages automated GUI testing. For developing GUI-based
automated GUI tests covered only the common usage scenarios applications as in our case this advice should be taken with
without any interaction variations. caution. Many of the critical bugs were only found with auto-
mated GUI testing that cannot be replaced by unit tests or labo-
Phase 3: Automated Test Generation rious manual exploratory testing.
The objective of the third phase was to automatically generate
(2) No free lunch in automated test generation. Test genera-
GUI test cases to increase the variety of interactions in which
tion allows creating a large number of tests that can be execut-
automated testing exercises the GUI of the virtual keyboard.
ed automatically. However, for detecting bugs the tests require
We used the code-based test generator Randoop[2] that has
a test oracle that defines what the correct expected results are.
already been successfully applied in industrial projects before
Generated tests based on available checks of generic properties
[3]. The tool creates JUnit test cases for the virtual keyboard’s
did not detect bugs. Hence, considerable effort had to be in-
GUI in form of random sequences of method calls to the previ-
vested in implementing our own domain-specific checks.
ously implemented test adapter. When tests are generated,
Randoop actually runs the generated sequence of method calls, (3) The limit of test generation is analysis effort. Automated
executes the tested system, and checks the outcome for unex- test generation for GUI applications inherits challenges from
pected exceptions and violations of assertions in the code. In both, test generation and GUI testing. The resulting tests tend
case of a violation a failing JUnit test is produced that indicates to be long-running, hard to understand, flaky and brittle. Test
a likely bug, otherwise the generated JUnit test will pass and generation effortlessly produces tests in large quantities, but so
can be used as regression test for future versions. these problems multiply and the effort involved in handling the
tests explodes. The limit of test generation is defined by the
+ A large set of GUI tests covering a wide range of interaction
capacity available for analyzing test results. It is reached when
scenarios was generated on demand whenever the virtual key-
the results are not analyzed in time before the next test run.
board was changed. Based on the test adapter, these tests
checked numerous properties of the keyboard and helped to
discover several bugs including one in Oracle’s JavaFX code1. ACKNOWLEDGMENT
– Enabling automated test generation again caused additional This work has been funded in the frame of the COMET
effort, mostly for revising the test adapter and eliminating false center SCCH (FFG #844597).
positives. We went through several cycles of generating tests
and revising the adapter. The main challenge in generating GUI REFERENCES
tests is ensuring that the system is completely reset after every [1] M. Leotta, D. Clerissi, F. Ricca, and C. Spadaro, “Improving test suites
test. Dependencies between tests lead to flakiness and cascad- maintainability with the page object pattern: An industrial case study,”
ing faults. Another challenge lies in writing effective checks 6th International Conf. on Software Testing, Verification and Validation
for properties that are neither too generic nor too specific. Workshops (ICSTW), IEEE, 2013.
[2] Randoop: https://randoop.github.io/randoop/
Phase 4: Managment And Maintenance [3] C. Klammer, R. Ramler, and H. Stummer, “Harnessing Automated Test
Case Generators for GUI Testing in Industry,” 42th Euromicro Conf. on
In phase four the virtual keyboard reached a stable state. De- Software Engineering and Advanced Applications (SEAA), IEEE, 2016.
[4] M. Cohn, “Succeeding with agile: software development using Scrum,”
1 Pearson Education, 2010.
https://bugs.openjdk.java.net/browse/JDK-8176270
592
Authorized licensed use limited to: Volkswagen AG. Downloaded on January 08,2023 at 09:53:10 UTC from IEEE Xplore. Restrictions apply.