Unit Testing is a tedious, often monotonous, but crucial activitiy in every software development project. In this article, I show you how the intrusion of Artificial Intelligence (AI) techniques into current unit testing practices will change the way we are approaching unit testing – to the better. The main benefit will be the automation of redundant and monotonous activities that currently have to be carried out manually, because they require a certain level of human intelligence. Additionally, optimization techniques will become more prominent withint the testing process. As a result, the role of a unit tester will shift fundamentally to be suitable as a human twin that guides the artificial intelligence through the unit testing process. So let’s look at these aspects in a bit more detail.
Reducing duplicate work

Testers are often faced with a lot of redundant work that have to be carried out monotonously.
Test cases have to be written down based on predefined specifications. Using techniques such as equivalence class partitioning or boundary value analysis (read more about this here:
“2 methods that help you save 60 % of your effort in Unit Testing”), this becomes fast, but also very monotonously. After these test cases are created, they have to be carried out multiple times to check the correctness of the software, validate the fixing of a defect, or ensure that a code change did not cause any unwanted side effects.
AI-based techniques such as Machine Learning or Meta-Heuristic Search algorithms can be used to reduce and automate this redundant work.

Scructured ways to define specifications can already be used to automatically derive unit testing (this is usually refered to as Behavior Driven Development). However, such definitions usually require a lot of effort (often the same effort than writing test code in the first place). Artificial Intelligence can reduce this effort by assisting in the definition of such specifications. Already defined information can be reused to recommend information that has to be entered next (this approach has already shown great results in current low-code platforms such as Mendix “AI-Assisted Development”). For software testing, this means that test cases, or even equivalence class partitionings, can be reused for similar methods to be tested. For equivalence classes, the representatives to be used for creating test cases can also be chosen automatically based on past decisions. However, even test cases are generated automatically, they have to be run over and over again, to analyze the test results after every run and derive actions. To keep this manageable, a unit tester has to ensure to keep the set of test cases as small as possible, but still provide sufficient coverage of relevant code paths. All these steps mentioned above can be automated by (i) automaticaly chosing regression tests (e.g. using genetic search algorithms), (ii) automatically running them (not really AI, to be fair), and (iii) analyzing test results over time to derive actions based on outliers in these results (e.g. using unsupervised machine learning techniques).

Optimize everything

Using modern AI techniques, optimization becomes both fast and easy. So-called meta-heuristic search algorithms can calculate the optimum combination of different aspects, trading off multiple conflicting goals. To improve calculation speed, these algorithms use so-called heuristics to only consider a sub-part of the overall search space of possible combinations. Applied to unit testing, this means that in the future, (i) the number of tests in a test suite will be optimized, trading off conflicting metrics such as execution time and code coverage (ii) new ways to evaluate test cases will be developed, based on additional information that can be taken into account (e.g. previously identified defects, or similarities to already tested code paths) (iii) mutation testing and metamorphic testing will become more relevant due to automation of finding optimum mutants and metamorphic relations.

Testers as data scientists

One fundamental change that will come with the intrusion of Artificial Intelligence into Software Testing is a shift of the role of a software tester. Instead of using most of her time to perform redundant activities (see first part of this article), a software tester has to be the manager of the artificial intelligence performing all these activities. This will require a number of new skills, including most of the things that a data scientist requires to do her job today. This includes a basic understanding of different Artificial Intelligence techniques such as supervised, unsupervised, or reinforcement learning, and meta-heuristic search algorithms. Understanding how these techniques work for unit testing problems help testers interpret results, and twist the right angles of these algorithms to adapt them to the needs of a specific project.
In this article, I highlighted 3 aspects how AI will change the way we do unit testing in the future. What is your opinion on this? Did you already made some experience with AI-based testing tools? Let me know in the comments section below!

We use cookies to give you the best online experience. By agreeing you accept the use of cookies in accordance with our cookie policy.

Privacy Settings saved!
Privacy Settings

When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. Control your personal Cookie Services here.

GetResponse, Google Analytics

We use LinkedIn Insight for marketing purposes. You can disable these cookies.

We use Google Analytics for marketing purposes. You can disable these cookies.
  • __utmz
  • __utma
  • _ga
  • _gat

We use GetResponse for marketing purposes. This service cannot be disabled, otherwise the website functions will be limited.

Decline all Services
Accept all Services
Get Free Access Now to
9 eBooks!
All about Automated Software Testing
Proven experts
Learn to save up to 75% of your test efforts
Get Free Access Now!
Get Access Now! & Save 50%
Personal Trainer FREE Nutrition Custom Workout App
Get Access Now!
eBook Download
Enter your details to get your free ebook!
All about Automated Software Testing
Download Free Ebook
Lorem ipsum dolor sit amet, consectetur adipiscing