Reader small image

You're reading from  How to Test a Time Machine

Product typeBook
Published inMar 2023
Reading LevelN/a
PublisherPackt
ISBN-139781801817028
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Noemí Ferrera
Noemí Ferrera
author image
Noemí Ferrera

Noemí Ferrera is a self-taught programmer and wrote her first comprehensive program at the age of nine. When she grew up, she proceeded to achieve a degree in computer science specializing in hardware in Spain, a bachelor's degree in software engineering in Ireland, and a master's degree in computer science in Spain. She is an international speaker and participates in testing community conferences (such as Selenium, Appium, and Automation guilds) and engages with the community through Slack channels, Twitter, and her blog. In the 2020 Test Guilds publication, she was named as one of the top 28 test engineers to follow, as well as one of the top 33 test automation leaders to follow in the 2019 Tech Beacon and as one of the 100 women in tech to follow and learn from by agiletestindays in 2023.
Read more about Noemí Ferrera

Right arrow

Artificial Intelligence is the New Intelligence

Artificial intelligence (AI) has a wide scope, and it can help with our testing in several ways. It can also help with creating automation tools. In the previous chapter, we provided an introduction to this topic and gave some examples of where AI could be useful. However, it would be impossible to cover AI fully in this book (consider that AI experts have dedicated their careers to the topic). In this chapter, we will provide an introduction to some of the core topics of AI and see examples of how it is (and could be) useful for testing. Then, we will review applications that use AI so that we can identify them and check whether we need to do anything special to test those. Finally, we will see some other technical examples that might be of use in your application.

In this chapter, we are going to cover the following main topics:

  • Is AI taking my job? Why learn about AI?
  • Core concepts of AI
  • AI for testing
  • Testing...

Technical requirements

This is an advanced chapter and while we hope you can still enjoy it without developing mathematical/AI knowledge, you would get the best out of this chapter if you are familiar with these topics and have some degree of programming knowledge. However, you can still take this one as an introduction so that you can learn more on your own. We hope to make it as fun and easy as possible so that it can help you build useful tools for your team!

The examples in this chapter were written using Python, although they could be written in different languages. You can find them in this book’s GitHub repository: https://github.com/PacktPublishing/How-to-Test-a-Time-Machine/tree/main/Chapter08.

Is AI taking my job? Why learn about AI?

In the past, I’ve given talks about AI topics in which I could see faces of awe and enjoyment but also fear among the audience. The most frequent questions from the audience with little AI knowledge were the ones posed in the title of this section:

  • Is AI going to replace the job of a tester/QA expert?
  • Why should I learn about AI?

More experienced people who are into testing (and even any other job, especially ones related to computing) also wonder and frequently argue about the first question.

To answer the first question, we should first define and agree on what exactly AI is. In Chapter 7, Mathematics and Algorithms in Testing, we saw the following AI definition:

Artificial intelligence – Luger and Stubblefield, 1993

[AI is the] branch of computer science that is concerned with the automation of intelligent behavior.

From this definition, we can easily conclude that AI is a tool...

Core concepts of AI

In the previous section, we saw one of the AI definitions that relates AI to automation. However, the most commonly used definition for AI is that of Arthur Samuel:

Artificial intelligence – Arthur Samuel, 1959

AI gives “computers the ability to learn without being explicitly programmed.

This definition, while being more general about the “what,” is more specific and restrictive about the “how” than the one mentioned in the previous section. It sets the goal of AI to learn on its own rather than appear smart as we could make it seem in the previous chapter by programming rules. This apparently subtle difference is the common base for debate in the scientific community and it is likely to get more and more restrictive as the techniques and machines advance toward the goal of intelligence per se.

There are different areas in AI. To continue with the topic of machine learning, let us define it:

Machine...

AI for testing

In the previous chapter, we looked at an application of AI for testing: a test case analyzer. Later, in the Test case analysis with machine learning section, we will see a practical example of how to do this using machine learning.

While that particular example could be of direct use to some people, there are many other applications of AI for testing. In this section, we will analyze some other examples that will hopefully inspire you to create more tools that use AI for testing purposes (I would be proud and delighted to add those to future revisions of this book).

Games

As we will see in Chapter 11, How to Test a Time Machine (and Other Hard-to-Test Applications), games are one of the most difficult applications to test due to their indeterministic and dynamic nature. There are different points in which games could present a challenge and in which AI could help us with their testing.

For example, we could use AI to help us create exploratory tests, by using...

Testing AI apps

Now that you have a better understanding of the different types of learning and AI approaches, you should be able to guess that there are just as many different types of AI applications. In the previous section, we saw some of those types when we reviewed using AI for creating apps for testing.

Types of AI apps

Let us group them into the different types of learning so that we can think of ways of testing them.

Supervised learning apps

As we mentioned previously, these applications get the inputs and outputs to produce a result. Classifiers, such as the test case analyzer that we reviewed in the previous section, are examples of these types of apps.

In these apps, the AI test itself is done as part of the AI automation phase. Therefore, there is nothing to do in this aspect from a quality team’s perspective. The app should be tested as any other application, checking for performance, accessibility, usability, and every other aspect of the app itself...

Sending your code to the Gym

Gym [8] is Python’s toolkit for reinforcement learning algorithms. This tool is commonly used for solving games, which could help us if we were to create test automation for games. However, it is not the only reinforcement learning tool that exists and games are not the only potential uses for it. In the previous chapter, we created an exploratory web crawler. We could create another version using reinforcement learning so that instead of telling the system where to crawl next, the system will crawl to the areas where crashes are most probable.

Creating a crawler using reinforcement learning might not be the best solution for it, but this is only an example to help us explain this concept in a friendly fashion to qualified experts and to inspire you to think out of the box concerning testing. Furthermore, keep in mind that there are some tools out there that already have crawlers built in, and you might be better off exploring purchasing such...

Other cool AI projects and tools

AI tools and projects are growing exponentially, so, by the time you read this chapter, there will probably be many more than the ones discussed here. However, we will look at some of them here to get you started. In this section, we will explore other tools for AI, then discuss ways of learning more about this in case you want to get more general knowledge to create your own tools.

Other tools for AI

While working on previous projects could help you gain more knowledge of AI and how it can be related to testing, there are already many tools on the market that you could use directly to aid you with your AI-related issues. Instead of reinventing the wheel, try looking around and finding the one that could be adjusted to meet your specific needs. We mentioned some of them in the AI for testing section of this chapter.

We can recommend Python as the language to use if you are starting with AI tooling due to its ease of use and small learning curve...

Summary

In this chapter, we reviewed AI, a concept that is getting more and more popular across all computing areas as more powerful machines and new algorithms that use that power get developed.

We started this chapter by exploring the foundations of AI and why it's important to know about this. Then, we reviewed some general knowledge about technical concepts related to AI.

We also saw some AI tools that could be of use for testing and learning about types of AI apps and the specifics of each type when it comes to testing them.

We completed the analyzer that we reviewed in the previous chapter with machine learning and looked at the difference between the two systems and when you should opt for one or the other.

We also looked at some examples related to reinforcement learning, which could be useful for finding solutions in games and other applications.

Finally, we talked briefly about tools for AI and other projects that could be of interest.

In the next chapter...

Further reading

To learn more about the topics that were covered in this chapter, take a look at the following resources:

lock icon
The rest of the chapter is locked
You have been reading a chapter from
How to Test a Time Machine
Published in: Mar 2023Publisher: PacktISBN-13: 9781801817028
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Noemí Ferrera

Noemí Ferrera is a self-taught programmer and wrote her first comprehensive program at the age of nine. When she grew up, she proceeded to achieve a degree in computer science specializing in hardware in Spain, a bachelor's degree in software engineering in Ireland, and a master's degree in computer science in Spain. She is an international speaker and participates in testing community conferences (such as Selenium, Appium, and Automation guilds) and engages with the community through Slack channels, Twitter, and her blog. In the 2020 Test Guilds publication, she was named as one of the top 28 test engineers to follow, as well as one of the top 33 test automation leaders to follow in the 2019 Tech Beacon and as one of the 100 women in tech to follow and learn from by agiletestindays in 2023.
Read more about Noemí Ferrera