Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
How to Test a Time Machine

You're reading from  How to Test a Time Machine

Product type Book
Published in Mar 2023
Publisher Packt
ISBN-13 9781801817028
Pages 384 pages
Edition 1st Edition
Languages
Author (1):
Noemí Ferrera Noemí Ferrera
Profile icon Noemí Ferrera

Table of Contents (19) Chapters

Preface 1. Part 1 Getting Started – Understanding Where You Are and Where You Want to Go
2. Chapter 1: Introduction – Finding Your QA Level 3. Chapter 2: The Secret Passages of the Test Pyramid – The Base of the Pyramid 4. Chapter 3: The Secret Passages of the Test Pyramid – the Middle of the Pyramid 5. Chapter 4: The Secret Passages of the Test Pyramid – the Top of the Pyramid 6. Part 2 Changing the Status – Tips for Better Quality
7. Chapter 5: Testing Automation Patterns 8. Chapter 6: Continuous Testing – CI/CD and Other DevOps Concepts You Should Know 9. Chapter 7: Mathematics and Algorithms in Testing 10. Part 3 Going to the Next Level – New Technologies and Inspiring Stories
11. Chapter 8: Artificial Intelligence is the New Intelligence 12. Chapter 9: Having Your Head up in the Clouds 13. Chapter 10: Traveling Across Realities 14. Chapter 11: How to Test a Time Machine (and Other Hard-to-Test Applications) 15. Chapter 12: Taking Your Testing to the Next Level 16. Index 17. Other Books You May Enjoy Appendix – Self-Assessment

Having Your Head up in the Clouds

The cloud has been a hot topic for many years, to the point of becoming mainstream (everybody is using it in one way or another). In this chapter, we will see some concepts about the cloud, how it can help increase the quality and development speed of your apps, and which things you have to be careful about while using it.

Some people might say that having your head up in the clouds is a bad thing, but in this case, in regard to testing, I believe it is something you should definitely aim for.

In this chapter, we will cover the following concepts:

  • What exactly is the cloud, and how can it help you?
  • Creating a benchmark to measure testing performance
  • Testing appropriately in the cloud
  • Dangers of the cloud
  • Testing applications in the cloud
  • Thinking out of the box about the cloud

Technical requirements

Some degree of programming skills is recommended to get the best of the examples provided in the chapter.

In this chapter, we will use a variety of programming languages (mainly Java), with TestNG as the unit testing framework for Java.

We recommend reviewing and working with different languages as a self-growth exercise, and we provide some examples in our GitHub repository, so it should be easier for you to play with them: https://github.com/PacktPublishing/How-to-Test-a-Time-Machine/tree/main/Chapter09.

While this chapter is written with QA/SDET roles in mind, developers may also find this one interesting and useful, especially when selecting cloud testing providers or testing serverless applications.

What exactly is the cloud, and how can it help you?

Before the 2010s, if you’d heard the word cloud, you would have imagined some sort of cluster of soft-looking water in a gas state floating in the sky. However, nowadays, when you hear cloud, you might imagine some application that allows you to store data or use some device without the need for local ones. A cluster of powerful computers or other devices stored in multiple secure undisclosed locations might also come to your imagination, as this is how the services are implemented in reality.

Whichever the definition, for most of the 2010s, it was the hot topic, and everybody seemed to want things to happen in the cloud. And that’s how mostly everything was reborn, by adding “...in the cloud” after it. Your data? In the cloud. Your applications? In the cloud. Your testing? In the cloud!

Even though enthusiasm about the topic sounds slightly colder now, since many companies are providing their own...

Creating a benchmark to measure testing performance

In step 3 of the previous list, we mentioned running a benchmark, which is a piece of code or an algorithm that measures something. In this case, we can measure the time that it takes to run each test on each platform and compare them. The performance measured might be a deciding factor for the platform to use but might not be the only one, as there are other important aspects in the previous list, in steps 1 and 2.

In our case, we will measure the time it takes to run each test and the time it takes to run the entire class. Some cloud providers add extra time to their system setup and teardown or cleanup, and you should be aware of these values too. Sometimes, there is also some extra time taken if you need to send the test for it to be uploaded to their system (as opposed to running it remotely).

Let us see an example of how to make a simple benchmark with two tests using Java and TestNG (don’t mind the code repetition...

Testing appropriately in the cloud

Some people might just consider the cloud as a test aid to achieve support for more devices or browsers, then proceed to use it as they would use their current system. However, the cloud offers much more than that, and it is important to use it in an appropriate manner to get the best out of it.

In this section, we are going to have a general look into how to run your tests on a cloud test provider. Then, we will discuss how parallelizing tests and orchestrating tests can be achieved in the cloud.

There are two possible ways to execute a test in the cloud:

The first one is to upload the entire test project into the agent that executes the test.

The second one is to use some provider’s particular desired capabilities and a remote connection, such as in the following example:

General provider example

driver = webdriver.Remote(providerURL, providerCapabilities)

Here, the providerURL parameter should include a username and...

Dangers of the cloud

In step 1 of the What exactly is the cloud, and how can it help you? section’s list for selecting a cloud provider, security is mentioned as one of the features you might need, especially when you are dealing with sensitive data.

Providing a secure system is in the interest of all cloud providers, but sometimes there might be some limitations due to the nature of the cloud. Not only do you have to trust that the company itself will not take advantage of your system, but also that it will keep it secure from external malicious individuals.

Missing issues due to the tests being executed in simulated devices rather than real ones, is also a danger of the cloud, so make sure you confirm what case it is going to be and cover yourself from it.

As we will see in a bit, one more danger could be that the provider does not clean up the application and tests after their execution, and since devices are shared across clients, some other client might have access...

Testing applications in the cloud

The other side of cloud testing is when you have applications that, fully or partially, reside in the cloud. This is the case for serverless applications.

Serverless application

An application in which part of it is handled in the cloud—that is, there is a provider that will take care of maintenance and scalability of the (generally back-end) systems required for the application to run.

You might think that the difference between testing fully hosted applications and partially hosted applications is that you can skip some of the tests that generally would take place in those areas. However, while you could skip extensive testing for those areas, it is still important to test the stability of the system and assign contracts and verifications across it to make sure everything works as expected.

In Chapter 3, The Secret Passages of the Test Pyramid – The Middle of the Pyramid, we covered tests such as the ones just mentioned...

Thinking out of the box about the cloud

There could be many other advantages to using cloud computing other than speeding up testing and deployments. For example, we already covered this in Chapter 6, Continuous Testing – CI/CD and Other DevOps Concepts You Should Know. CI (and/or testing) could be performed and installed in the cloud by using runners.

Runner

In CI/CD, a runner is an agent (a program) available in one or more machines that can execute jobs (pieces of code).

Runners can be local or live in the cloud. For this chapter, we are considering mostly the ones in the cloud.

Runners can perform several actions, including setting up a Dockerfile to prepare the runner with the required programs to install and run the app. They can also run the test code, which will call the cloud provider if we are using one. That would be a cloud that is talking to another cloud, about potentially yet another cloud (if your app is serverless):

Figure 9.3: Example of a cloud architecture

Figure...

Summary

In this chapter, we have reviewed several ways of seeing and using the cloud in relation to testing and test architecture. We started the chapter with some definitions, followed by how to pick the right cloud provider. Then, we looked into how to test appropriately and the potential dangers of using a cloud provider for testing. We then looked into the opposite side of the cloud: testing an application in the cloud. Finally, we reviewed other ways we could use the cloud to our benefit for testing.

In the next chapter, we will take a trip into virtual, augmented, and cross realities.

Further reading

Make sure you continue pursuing knowledge of other topics related to the cloud: different providers, cloud testing (testing the cloud), and testing in the cloud (testing using the cloud).

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 2023 Publisher: Packt ISBN-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.
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}