0% found this document useful (0 votes)
6 views24 pages

Course Transcript-DevOps Test Tools

The course 'Software Testing for DevOps: DevOps Test Tools' covers key DevOps testing tools such as Apache JMeter, Selenium, Vagrant, and Chef, focusing on their advantages, selection criteria, and the role of automation in DevOps culture. It includes 13 videos that explore various aspects of DevOps testing, including test strategy, automation, optimization, and collaboration. The course aims to equip learners with foundational skills for software testing in a DevOps environment.

Uploaded by

mmjohn1981
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views24 pages

Course Transcript-DevOps Test Tools

The course 'Software Testing for DevOps: DevOps Test Tools' covers key DevOps testing tools such as Apache JMeter, Selenium, Vagrant, and Chef, focusing on their advantages, selection criteria, and the role of automation in DevOps culture. It includes 13 videos that explore various aspects of DevOps testing, including test strategy, automation, optimization, and collaboration. The course aims to equip learners with foundational skills for software testing in a DevOps environment.

Uploaded by

mmjohn1981
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

1/4/24, 1:09 PM Course Transcript

Software Testing for DevOps: DevOps Test Tools


Learners will discover key DevOps test tools such as Apache JMeter, Selenium Vagrant, and Chef, in
this 13-video course exploring advantages of some tools over others, selection criteria, the role of
automation in DevOps culture, and best practices for testing strategy in a DevOps culture. You will
begin by examining various types of DevOps testing tools, and key considerations when choosing the
right DevOps test tool. Examine the role played by test automation in a DevOps culture; the role that
test optimization plays in a DevOps culture; and the importance of collaboration in a DevOps testing
workflow. Then explore considerations necessary when generating a testing strategy in a DevOps
culture; work with test-driven development tools for automating acceptance tests; work with
performance and load testing tools; and work with Selenium to record and export user interactions
with a web browser. This leads into working with Vagrant and Chef to create and configure
infrastructure, and working with ChefSpec to generate and run unit tests against infrastructure. The
concluding exercise focuses on DevOps test tools.

Table of Contents
1. Video: Course Overview (it_atstfddj_03_enus_01)
2. Video: DevOps Testing Tools (it_atstfddj_03_enus_02)
3. Video: DevOps Test Tools Selection (it_atstfddj_03_enus_03)
4. Video: DevOps and Test Automation (it_atstfddj_03_enus_04)
5. Video: DevOps and Test Optimization (it_atstfddj_03_enus_05)
6. Video: DevOps and Collaboration (it_atstfddj_03_enus_06)
7. Video: DevOps Test Strategy (it_atstfddj_03_enus_07)
8. Video: Test-driven Development (it_atstfddj_03_enus_08)
9. Video: Apache JMeter Load Test Tool (it_atstfddj_03_enus_09)
10. Video: Selenium Browser Automation (it_atstfddj_03_enus_10)
11. Video: Chef Infrastructure Configuration (it_atstfddj_03_enus_11)
12. Video: ChefSpec Unit Tests (it_atstfddj_03_enus_12)
13. Video: Exercise: DevOps Test Tools (it_atstfddj_03_enus_13)
Course File-based Resources

1. Video: Course Overview (it_atstfddj_03_enus_01)

discover the key concepts covered in this course

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603a… 1/24
1/4/24, 1:09 PM Course Transcript

[Video description begins] Topic title: Course Overview. [Video description ends]

Hi, I'm Joseph Khoury.

[Video description begins] Your host for the session isJoseph Khoury. He is an IT and a Business
Expert. [Video description ends]

I'm a professional engineer, IT consultant, and entrepreneur. As a professional engineer, I've


logged over 8,000 hours managing projects. Driven by an entrepreneurial motivation, I have
founded and sold two IT-based businesses, and I've been involved in the e-learning market for the
better part of 12 years. I write for an IT-based e-learning blog and I'm a published author for the
IEEE, and will often speak IT conferences on technology-based subjects, globally. DevOps,
developers, and engineers will need to have foundational skills for software testing that will allow
them to embark on a journey to aspire to be an automated DevOps tester.

In this course, I'll explore key DevOps test tools. Advantages of some tools over others, selection
criteria. The role of automation in a DevOps culture. And best practices for testing strategy in a
DevOps culture. Some of the specific topics I'll cover include DevOps test tool selection. DevOps
and test automation. DevOps and test optimization, collaboration, test strategy, test-driven
development. Working with Apache JMeter load testing tool. Working with Selenium to record
and play back user interactions. Working with Vagrant development environments. And working
with Chef configuration management.

2. Video: DevOps Testing Tools (it_atstfddj_03_enus_02)

Upon completion of this video, you will be able to recognize the various types of DevOps testing
tools.

recognize the various types of DevOps testing tools

[Video description begins] Topic Title: DevOps Testing Tools. Your host for the session is Joseph
Khoury. [Video description ends]

In this video, we'll take a look at the types of DevOps testing tools that are out there. First, a recap
of continuous testing. In continuous testing, you'll typically see unit tests, and these can be
automated, and these are written by the developers. And then you see integration tests, and these
are also automated and come after the unit tests. Then we have UI tests, which can be automated.
We have load and performance tests, and this includes monitoring as well. And finally, we have
manual and exploratory tests which are manual. However, they are included here because they are
part of a continuous testing strategy.

Now, the types of DevOps test tools include tools for developers, build tools, configuration
management tools, monitoring tools, and deployment tools. And notice that these cover the entire
software development lifecycle, from start to finish. So let's look at these type of tools a little bit
closer. First, development tools, or code tools. Developers write unit tests in behavior driven-
development, or test-driven development tests. They can be built into a continuous integration
https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603a… 2/24
1/4/24, 1:09 PM Course Transcript

pipeline since they're automated. And this is an important foundation for DevOps testing strategy,
especially because of the frequent integrations that DevOps sees across the CI/CD pipeline.

Build tools include CI/CD servers. They perform automated build/compiles, and this happens
when code gets committed to a version control repository like Bitbucket or GitHub. Build tools are
pivotal to a well-built delivery pipeline. Configuration management tools provide standardized
resource configurations. This is important because it means they're repeatable. So configuration
management tools can enforce state on infrastructure. They're considered automated and agile.
Because we're talking infrastructure as code, this is a big deal.

Because if your infrastructure is defined as code, then it's testable, scalable, repeatable, reliable
infrastructure. Monitoring tools are typically used to monitor application performance, servers,
and services. Some even provide code-level visibility. And, at the end of the day, what we're talking
about here is collecting data. So we can take that data, that information, feed it back into the
CI/CD pipeline for continuous improvement, continuous learning. And deployment tools, these
are release automation tools. So they automate the release of software, supporting the
continuous delivery of that software. Deployment tools represent the last step in the delivery
pipeline.

3. Video: DevOps Test Tools Selection (it_atstfddj_03_enus_03)

After completing this video, you will be able to recognize key considerations for choosing DevOps
test tools.

recognize key considerations when choosing DevOps test tools

[Video description begins] Topic Title: DevOps Test Tools Selection. Your host for the session is
Joseph Khoury. [Video description ends]

In this video, we'll consider DevOps test tool selection. It's important to have the right tools if an
organization wants to be a high performance CI/CD organization. There are tons of tools out
there. So choosing the best tools means taking into consideration some key factors that will help
when deciding on what exactly right for your organization's situation. Small or large organization,
it doesn't matter. The whole emphasis and bottom line objective is to support continuous testing.
And this ultimately keeps up the pace of delivery that we expect in a DevOps culture. And there
are five key considerations.

And those are version control, testable infrastructure, virtual test environment, continuous
improvement, and automation. Version control is so important because you can branch and merge,
you can work on different branches and then merge those branches back in as new features. And
it's undeniably superior at keeping change history. And that, in testing, is a best practice that will
support traceability. And that's key. Testable Infrastructure. When you hear that, you should think
infrastructure as code.

It means all the same software tools and all the same software processes can be run against
infrastructure as run against your own software that you're developing. This means version
https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603a… 3/24
1/4/24, 1:09 PM Course Transcript

control. And this means testable code. So when you check a new infrastructure in, you can fire off
and build on that and ensure that it works. That's testable code. That's infrastructure as code.
Virtual Test Environment. You can virtualize servers, services, clients, and this means
infrastructure as code, right? So when we're spinning up our servers, services, clients, that's
infrastructure as code.

We can test that at the same time. Considering continuous improvement. Well, how do we do
that? Well, we gather data. We gather data everywhere. That's shareable data, product visibility.
In fact, data must be gathered from development and from operations and shared across the
organization. This makes for a more knowledgeable DevOps team and the DevOps team will get
better and better with each incremental improvement. So tool selection should seriously take into
account the ability to put data back into the pipeline and use it for continuous improvement.

And automation, we really want to be automating everything, right? And that means testing.
Remember, some tests are best performed by people, so right now, not every test can be
automated, but most can. Infrastructure, automating infrastructure, and that's where, again,
infrastructure as code comes in. So we can spin up our infrastructure automatically. Feedback, this
includes logging, diagnostics and analytics. These must be automated in order to ensure that
they're reliable, consistent, and the whole process is repeatable. And finally, all aspects of CI/CD,
for optimal performance, from development to deployment, must be automated.

4. Video: DevOps and Test Automation (it_atstfddj_03_enus_04)

Upon completion of this video, you will be able to recognize the role that test automation plays in a
DevOps culture.

recognize the role that test automation plays in a DevOps culture

[Video description begins] Topic Title: DevOps and Test Automation. Your host for the session is
Joseph Khoury. [Video description ends]

In this video, we'll talk DevOps and test automation. DevOps, the orchestration and
synchronization of all the steps in a well-built CI/CD pipeline in a DevOps culture. It's all about
delivery speed and agile processes, and that necessarily means test automation.

[Video description begins] Screen Title: DevOps Test Automation. [Video description ends]

In DevOps, it's important to have that agile process across your entire pipeline which requires that
all test processes are automated, that they run automatically when triggered by a deployment to
test or QA. Specialized automation testing tools and continuous integration tools are used to
achieve the high rate of integration that we expect of DevOps. DevOps requires a well-designed
automation testing framework for many reasons. But in this context, the testing framework must
support the quick and easy scripting of new test cases.

In DevOps, we have this continuous cycle. We orchestrate and synchronize all the steps in this
overarching process. In order to have a smooth flowing CI/CD pipeline, we need to automate all of
https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603a… 4/24
1/4/24, 1:09 PM Course Transcript

our testing everywhere. That means in planning, when you're merging code back in, when you're
writing code, when your app is being built, when it's released, when it's deployed to operations,
that's all test planning as well. So at every step of the way, we need to integrate automated testing.
Otherwise, we don't have that smooth flowing, well-built CI/CD pipeline that we expect out of
DevOps.

5. Video: DevOps and Test Optimization (it_atstfddj_03_enus_05)

Upon completion of this video, you will be able to recognize the role that test optimization plays in a
DevOps culture.

recognize the role that test optimization plays in a DevOps culture

[Video description begins] Topic Title: DevOps and Test Optimization. Your host for the session is
Joseph Khoury. [Video description ends]

In this video, we'll consider DevOps and test optimization. Test automation is the starting point for
supporting the speed with which a DevOps process should perform in order to deliver at the
speed of DevOps. It's important to consider the right balance of all testing. So that's unit,
integration, functional testing, manual, as well as exploratory. So we have to take all of these tests
into account and consider not only test automation, yes, that's extremely important, but we have
to think in terms of optimization.

In test optimization, you should contemplate very carefully how to optimize the overall testing
strategy. You want to take advantage of what DevOps offers, which is speed and efficiency. This is
an overall process. And therefore, to optimize, the overall process must be considered end-to-end.
So not just one point at a time, the overall process must also be considered.

[Video description begins] Screen Title: Steps to Optimize Testing. [Video description ends]

The development team must do these things to make this happen. Identify risky areas. When we
identify risky areas, that's where we can optimize our testing. Our test automation should be able
to address those risky areas. And properly reporting risk is so important. If risk is not reported
properly, of course, you can go off the rails as far as your testing goes.

So even though you've got automated testing, maybe you're not automating the proper testing.
Maybe this is happening because the true risk wasn't properly reported. Development teams must
also review test plans. Of course, this is crucial and it's just best practice. And the development
team should also review the entire process. So that means the development team's involved, from
end-to-end, which is what DevOps is all about. It's speed, yes, but it also means that you have
teams that work from one end to the other, in both Dev and Ops.

6. Video: DevOps and Collaboration (it_atstfddj_03_enus_06)

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603a… 5/24
1/4/24, 1:09 PM Course Transcript

After completing this video, you will be able to recognize the importance of collaboration in a
DevOps testing workflow.

recognize the importance of collaboration in a DevOps testing workflow

[Video description begins] Topic title: DevOps and Collaboration. Your host for the session is
Joseph Khoury. [Video description ends]

In this video, we'll consider DevOps collaboration.

[Video description begins] Screen Title: DevOps Foundation. [Video description ends]

The DevOps philosophy is fundamentally based on an Agile and Lean development methodology
which requires that changes made to code are incremental in nature, they're small. And this
supports the high release and integration frequency customary of high-performing DevOps
organizations. A well functioning DevOps culture allows the organization to focus on customers.
Yes, they're kind of important. It allows the organization to focus on quick delivery to production,
as quickly as possible.

The organization must focus on automating as much as possible in order to enable that quick
delivery and feedback, in the form of feedback from customers, developers, the software itself,
metrics measured for analysis. And notably, this data that's gathered is shared. This is continuous
improvement, continuous learning. One of the key ingredients that ties the entire DevOps process
together then is collaboration. It actually facilitates the DevOps culture. There are certain
characteristics that embody DevOps, agile, delivery speed, feedback, automation, improvement,
united teams.

If I were to ask in two words or less, how to describe DevOps, these would probably be right up
there with the most common suggestions. But think about this. Would they even be possible
without collaboration at each step of the way in a DevOps culture? So how is this related to
DevOps testing? Well, let's consider this. Every step in a high performing DevOps process is like
clockwork, so reliable and so timely. How is this enabled? By failing early, incrementally, and by
continuous testing, and that is testing everywhere. So collaboration tools, processes, information
sharing, they're all part of the holistic CI/CD process. Therefore, they are indirectly test tools.

7. Video: DevOps Test Strategy (it_atstfddj_03_enus_07)

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603a… 6/24
1/4/24, 1:09 PM Course Transcript

After completing this video, you will be able to describe the considerations necessary for generating
a testing strategy in a DevOps culture.

describe the considerations necessary when generating a testing strategy in a DevOps culture

[Video description begins] Topic Title: DevOps Test Strategy. Your host for the session is Joseph
Khoury. [Video description ends]

In this video, we'll talk DevOps test strategy. DevOps has changed testing forever. DevOps has
changed testing in terms of the testing scope and the testing role. Testing in DevOps
environments occur across the entire software development lifecycle, end-to-end testing
everywhere. Testers in DevOps environments assume a much larger role as QA professionals.
Quality in DevOps, recall, is the responsibility of the entire team. It's shared responsibility. And,
accordingly, testers aren't just involved in functional testing and feature verification. The role of
testers has expanded to include testing in operations.

So, again, here we are talking about the end-to-end process and united teams. So testing in
operations. Testers can also be called on to do essential or basic security testing. Testers
participate in monitoring and production and the analysis of data gathered. Testers also assist in
the design, configuration, and execution of load and performance testing. So test strategy, and
therefore the test tools that will be used, must take into account these considerations for various
reasons. The tester's expanded role, the Agile testing process in and of itself. Considerations for
test strategy and tools also include the automation of certain tests. And, certainly, continuous
testing should be top of mind when considering test strategy and tools in a DevOps environment.

8. Video: Test-driven Development (it_atstfddj_03_enus_08)

During this video, you will learn how to work with test-driven development tools for automating
tests that ensure that a software program meets its requirements.

work with test-driven development tools for automating acceptance tests

[Video description begins] Topic title: Test-driven Development. Your host for this session is
Joseph Khoury. [Video description ends]

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603a… 7/24
1/4/24, 1:09 PM Course Transcript

In this video, we'll work with test-driven development tools. Actually, in this demo we're going to
be working with Cucumber, which is a behavior-driven development tool. But behavior-driven
development is kind of an offshoot from test-driven development. And it's focused on the
behavior of the system from the customer's point of view. Okay, so the prerequisites you need
Node.js.

[Video description begins] A nodejs page opens in the browser window. At the top, the following
tabs are present: Home, About, Downloads, etc. Currently, the Home tab is open. A page titled
Download for Windows (x64) is open. It has the following buttons in the center: 10.16.3 LTS and
12.9.0 Current. [Video description ends]

So the most recent long term support or LTS version will do. To get that just go to nodejs.org,
download and install it. It's a simple install, all of the activities like setting your environment path
variables, those activities are all done for you, so it's really simple install. Once you get that done,
then you can start working with Cucumber. So I'm going to go over to File Explorer, I'm in projects,
cucumber, and I've got an app.zip file.

[Video description begins] A Windows Explorer opens. Currently, the C drive is open. [Video
description ends]

This archive file contains all of my working files for this demo. So if I right click, select the option
Extract All and I'll extract everything to the cucumber directory, not cucumber/app, just cucumber.

[Video description begins] A pop-up window titled Extract Compressed (Zipped) Folders opens. It
has an input field for path. A Browse button is present beside it. Extract and Cancel buttons are
present at the bottom. [Video description ends]

[Video description begins] Currently, the following path is present in the input field:
C:\projects\cucumber\app.zip. He deletes the following: app.zip. [Video description ends]

And click Extract and there are all the files.

[Video description begins] The pop up window closes. The screen shifts to the Windows Explorer.
A folder named app appears in the cucumber directory. He selects the app folder. A list of files and
folders appears in the app directory. [Video description ends]

Okay, now let's go into Visual Studio Code. I've got it pinned to the task bar, so I'll click the icon on
the task bar and that opens Visual Studio Code. I previously was working in the app directory, so
it's cached that location conveniently for me.

[Video description begins] A Visual Studio Code IDE opens. It has a navigation pane with the
following options: Explorer, Search, Debug, etc. Beside it, an Explorer pane is present with the
following directories: Open Editors and App. The App expands to show a list of files. An Editor
pane is present at the center. [Video description ends]

So here are the files that we expanded, we have cucumber.js, we have package-lock.json and the
package.json file. And this is convenient because we're going to use npm to install all of the
dependencies. And it's pretty simple if you get the package.json file configured with all of your
development dependencies. Now expanding features, we have a couple of items here, we have an
addition.feature, and what is that?

[Video description begins] In the Explorer pane, under App, he expands Features. [Video
description ends]

Well, let's double click and open it. Okay, so this is my feature file in the context of cucumber.

[Video description begins] A tab titled addition.feature opens in the Editor pane. It has a set of
code lines. [Video description ends]

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603a… 8/24
1/4/24, 1:09 PM Course Transcript

What this does is it allows me to set up a scenario and use plain English language to describe that
scenario, and these are considered tests. So then I write code to make these tests pass. Okay, over
in Explorer in Visual Studio Code, I'll expand step definitions and there's my step definition.

[Video description begins] In the Explorer pane, under features, he expands an item named
step_definitions. A file titled stepdefs.js appears below it. [Video description ends]

Let's have a look, so I'll double click to open that.

[Video description begins] A tab titled stepdefs.js opens in the editor pane. It has 14 code lines.
[Video description ends]

I set up some constants, but then I handle those steps within that scenario in this way. So given
that I start with this value int, then anonymous function, pass int, and I set answer = int.

[Video description begins] He points at code line 4. It reads: Given('that I start with (int)', function
(int) {. [Video description ends]

[Video description begins] He points at code line 5. [Video description ends]

And let's go back here to addition.feature, take a look at this.

[Video description begins] In the editor pane, he shifts to the addition.feature tab. [Video
description ends]

So this should look very familiar to you now. So if I highlight this, right click, select Copy, let's go
back over to step defs, on a new line, I'll paste these in.

[Video description begins] He highlights code lines 6, 7, and 8. Code line 6 reads: Given that I start
with 99. Code line 7 reads: When I add 1. Code line 8 reads: Then the result should be 100. [Video
description ends]

[Video description begins] He pastes the copied code on lines 16-18. [Video description ends]

So Given that I start with, Given ('that I start with {int}', and that's the int, very nice. So that's
basically what we're passing in here, that value, so the answer = 99.

[Video description begins] He points at code line 4. He points at code line 5. It reads: answer = int;.
[Video description ends]

When I add 1, next step when I add int, so again, we're going to call the function in the same way,
and then pass int.

[Video description begins] He points at code line 8. It reads: When('I add (int)', function (int) {.
[Video description ends]

And now expected = answer + this new int extracted from this description.

[Video description begins] He points at code line 9. It reads: expected = answer + int;. [Video
description ends]

And then you've got the assertion, this is where we pass our final test. Then the result should be
int, and not 10, it's actually 100.

[Video description begins] He points at code line 12. It reads: Then('the result should be (int)',
function (int) {. [Video description ends]

Anyway, it gives us the gist of these statements. So let's delete this.

[Video description begins] He points at code line 18. It reads: Then the result should be 10. He
modifies it. It now reads: Then the result should be 100. [Video description ends]
https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603a… 9/24
1/4/24, 1:09 PM Course Transcript

Okay, and we'll save the changes. And now Ctrl+Backtick to start a new terminal session.

[Video description begins] He deletes code line 16, 17, and 18. [Video description ends]

And now first, I'll type npm install.

[Video description begins] A pane appears at the bottom. It has the following tabs: Problems,
Output, Debug Console, and Terminal. Currently, the Terminal tab is open. The command prompt
is: PS C:\projects\cucumber\app>. [Video description ends]

Because I conveniently included the package.json file, issuing npm install will install all of the
dependencies in the package.json file, so pressing Enter. And we should see a node modules
directory over in Explorer in Visual Studio Code and we do, these are all the dependencies that
were just installed.

[Video description begins] In the Explorer pane, under features, a directory named node_modules
appears. He expands the directory. It has a list of items. [Video description ends]

Okay, so now let's clear the screen. And now to run the tests, you type npm test, this is going to
reference that package.json file npm test.

[Video description begins] In the explorer pane, under App, he clicks on package.json file. A tab for
it opens in the editor pane. It has 14 code lines. [Video description ends]

So it's going to access this key value pair.

[Video description begins] He highlights code line 7. It reads: "test" : "cucumber-js". [Video
description ends]

And what I'm actually doing is running cucumber-js. So that's npm test, press Enter, 1 scenario, 3
steps passed. So basically, that's the essence of behavior or test-driven development. You start out
with the tests first and then you write code, and only enough code to make the tests pass.

9. Video: Apache JMeter Load Test Tool (it_atstfddj_03_enus_09)

In this video, you will learn how to work with performance and load testing tools.

work with performance and load testing tools

[Video description begins] Topic title: Apache JMeter Load Test Tool. Your host for this session is
Joseph Khoury. [Video description ends]

In this video, we'll work with Apache JMeter Load Testing Tool to create a load testing plan.

[Video description begins] A Google search page opens in the browser window. A search bar is
present at the top. It has the following text: jdk8. Below it, search results for jdk8 are present.
[Video description ends]
https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 10/24
1/4/24, 1:09 PM Course Transcript

For this demo, you'll need Java JDK 8 installed or Open JDK 8, and you'll need Apache JMeter. So
JMeter can be found at jmeter.apache.org.

[Video description begins] He switches to another tab titled: Apache JMeter. A page for the same
opens. It has information about the Apache JMeter. [Video description ends]

And for JDK 8, just do a Google search for JDK 8 and you'll find that one of the top two or three
matches will be the download from Oracle. Okay, so JMeter is used to create and execute test
plans, and it stores those plans in XML file format. So that means you can create and edit test plans
using any text editor.

It's just so happens though that JMeter has a convenient GUI, so we'll look at that shortly. So
JMeter test plan is simply a container used to hold all the test plan elements. It's organized in a
tree structure, and the test plan elements describe a series of tests to execute, defining what is to
be tested and how it's to be tested. So let's start it up. I open Terminal and type jmeter, press Enter
and that launches JMeter.

[Video description begins] The command prompt is: joe@ubuntu:-$. [Video description ends]

[Video description begins] An Apache JMeter window opens. It has a menu bar with the following
options: File, Edit, Search, etc. Below it, a toolbar is present with the following icons: New, Save,
Start, etc. A navigation pane is present with the following nodes: Test Plan and WorkBench.
Currently, Test Plan is selected. A page for the same is open in the center. [Video description ends]

I'll maximize the window. So now we're in GUI mode. Next, we need to add a Thread Group to the
Test Plan. So right click Test Plan, point to Add, then point to Threads (Users) and select Thread
Group.

[Video description begins] In the navigation pane, Thread Group appears under Test Plan. A page
titled Thread Group opens in the center. It has input boxes for Name and Comments. Here, Name
is Thread Group. For Action to be taken after Sampler error, the following options are present with
radio buttons: Continue, Start Next Thread Loop, Stop Thread, Stop Test, and Stop Test Now. Here,
Continue is selected by default. Below it, a section titled Thread Properties is present. Under it,
input fields are present for the following options: Number of Threads (users), Ramp-up Period (in
seconds), and Loop Count. Under Loop Count, three options are present with checkboxes: Forever,
Delay Thread creation until needed, and Scheduler. [Video description ends]

Now, we set the properties in the Thread Group. And there's three important properties that we'll
set here, Number of Threads (users), we'll set that at 10. The Ramp-Up Period (in seconds), this is
the duration of time over which JMeter will distribute the launching of the threads, we'll set this to
10 as well.

And the Loop Count is number of times to loop through and execute the test. We'll leave this set at
1. Next, we'll need a config element. We'll add an HTTP request defaults config element as it's used
to set default values for HTTP requests for our Test Plan. So we'll select the Thread Group, right-
click, point to Add, then point to Config Element and then we'll select HTTP Request Defaults.

[Video description begins] In the navigation pane, HTTP Request Defaults appears under Thread
Group. A page for it opens in the center. It has the following sections: Web Server and HTTP
Request. [Video description ends]

Now, in the HTTP Request Defaults pane under the Web Server section, we'll fill in the server
name or IP field with the name of the web server we'll test.

[Video description begins] In the input field for Server Name or IP, he types skillsoft.com. [Video
description ends]

When we set the server here that makes it the default server for the rest of the items in this
Thread Group. Okay, now we'll add another config element. We can add support for cookies by

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 11/24
1/4/24, 1:09 PM Course Transcript

adding an HTTP cookie manager to the Thread Group. So we right click Thread Group, point to
Add again, Config Element and this time, we'll select HTTP Cookie Manager.

[Video description begins] In the navigation pane, HTTP Cookie Manager appears under Thread
Group. A page for it opens in the center. It has the following sections: Options and User-Defined
Cookies. [Video description ends]

Now, let's add an HTTP request sampler to the Thread Group. So we'll click on Thread Group, then
right click, select Add, point to Sampler, and I'll select HTTP Request.

[Video description begins] In the navigation pane, HTTP Request appears under Thread Group. A
page for it opens in the center. It has the following sections: Web Server and HTTP Request. Below
it, tabs are present for Parameters and Body Data. [Video description ends]

In the HTTP Request pane under the HTTP Request section, we'll fill in the path with a forward
slash.

[Video description begins] Under HTTP Request section, drop-downs are present for
Implementation and Method. It has input fields for Protocol [http], Content encoding, and Path.
[Video description ends]

We'll do that here so that each thread will access the home page on the server. Okay, and now we
have to add a listener. Listeners are used to output the results of a load test. There are a number of
listeners to choose from, so let's output the results graphically and we'll select view results in table
as well. So right click on Thread Group, point to Add, Listener, and we'll select Graph Results.

[Video description begins] In the navigation pane, Graph Results appears under Thread Group. A
page for it opens in the center. [Video description ends]

And we'll do one more, so we'll right-click Thread Group again, Add, Listener and this time we'll
specify View Results in Table.

[Video description begins] In the navigation pane, View Results in Table appears under Thread
Group. A page for it opens in the center. [Video description ends]

Okay, and now we can save our Test Plan by clicking File, Save or we could also just click the Save
icon in the toolbar. So we'll do that and in the dialog, I'll save this as test.jmx.

[Video description begins] A dialog box opens. In the input field for File Name, he types test.jmx.
Save and Cancel buttons are present at the bottom. [Video description ends]

All right, now let's go and run it.

[Video description begins] He clicks the Save button. The dialog box closes. [Video description
ends]

So I can run this Test Plan by clicking Start in the toolbar. Okay, and we see the results starting to
come in. If we look at the graph, we'd see a few spots here and there.

[Video description begins] In the View Results in Table page, a table appears with the following
columns: Sample, Start Time, Thread Name, Label, etc. It has a list of threads. In the navigation
pane, under Thread Group, he clicks on Graph Results. A page for it opens in the center. It has a
graph. Above the graph, the following options are present with checkboxes: Data, Average,
Median, Deviation, and Throughput. Currently, all the checkboxes are selected. In the graph,
several dots appear next to the y-axis. [Video description ends]

Really, we would have to, in order to see any kind of trend, we'd have to leave this going for some
time.

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 12/24
1/4/24, 1:09 PM Course Transcript

10. Video: Selenium Browser Automation (it_atstfddj_03_enus_10)

During this video, you will learn how to work with Selenium to record and export user interactions
with a web browser.

work with Selenium to record and export user interactions with a Web browser

[Video description begins] Topic title: Selenium Browser Automation. Your host for this session is
Joseph Khoury. [Video description ends]

In this video, we'll work with Selenium browser automation. Selenium has the web driver and the
Selenium IDE. The Selenium IDE is a convenient browser add-on for Firefox and Chrome that can
record and playback tests. And there's also an export function, which is really awesome. So let's
have a look. I've got my Firefox browser open. I'll click the open menu icon, and locate Add-ons.

[Video description begins] A Firefox browser window is open. It has an address bar at the top. A
menu icon is present at the top right corner. He clicks on it. A list of options appears. [Video
description ends]

Click Add-ons.

[Video description begins] A page titled Add-ons Manager opens. It has a search bar at the top.
Below it, tiles are present for Recommended Extensions. An Add to Firefox button is present on
each tile. [Video description ends]

In the search field, I'll type selenium. Press Enter.

[Video description begins] A tab titled Firefox Add-ons opens. In the center, search results for
Selenium are present. [Video description ends]

Locate Selenium IDE, click on it.

[Video description begins] A page titled Selenium IDE opens. An Add to Firefox button is present
here. [Video description ends]

And on the Selenium IDE page, click Add to Firefox.

[Video description begins] A dialog box appears at the top. It has a question: Add Selenium IDE?
Below it, a few Access permissions are listed. Add and Cancel buttons are present at the bottom.
[Video description ends]

We'll add the permission requested, and click, Okay, Got it.

[Video description begins] The dialog box closes. Another dialog box opens in the top-right corner.
It reads: Selenium IDE has been added to Firefox. An Okay, Got it button is present at the bottom.
The dialog box closes. In the toolbar, a Selenium IDE icon appears in the top-right corner of the
menu bar. [Video description ends]

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 13/24
1/4/24, 1:09 PM Course Transcript

Now we're ready to use Selenium IDE. In the toolbar, click on Selenium IDE.

[Video description begins] A Selenium IDE window opens. On top of it, a welcome screen is open.
It has the following question: What would you like to do? Below it, links are present for the
following options: Record a new test in a new project, Open an existing project, Create a new
project, etc. [Video description ends]

And in the window that appears, click Record a new test in a new project.

[Video description begins] A new page opens in the same pop-up window. The heading is Name
your new project. It has an input field for Project Name. OK and Cancel buttons are present at the
bottom. [Video description ends]

For a Project Name, we'll call this myProject. Click OK.

[Video description begins] A new page opens in the same pop-up window. The heading is Set your
project's base URL. It has an input field for Base URL. Start Recording and Cancel buttons are
present at the bottom. [Video description ends]

For a base URL, now, base URL has to be specified because this is where our tests will originate
from. So let's go with https://google.com. And click Start Recording.

[Video description begins] The pop-up window closes. A Google search page opens in a browser.
[Video description ends]

Okay, the notification in the bottom of the browser shows that Selenium IDE is recording. Let's
maximize the window. Let's do a search for devops.

[Video description begins] Search results for DevOps appear in the center. [Video description
ends]

Now, scroll down. Scroll back up. Now click on the Selenium IDE icon in the browser toolbar.

[Video description begins] A Selenium IDE titled myProject appears. It has a the following icons at
the top-right corner: New, Open, and Save. In the navigation pane, a file named Untitled is listed.
Currently, it is selected and is open in the center. In the center, a Stop icon is present at the top-
right corner. An address bar is present below it. Beneath it, a table is present with three columns:
Command, Target, and Value. [Video description ends]

Click the Stop recording button to stop recording, or alternatively, Ctrl+U.

[Video description begins] A pop-up window titled Name your new test opens. It has an input field
for Test Name. OK and Later buttons are present at the bottom. [Video description ends]

Now we need to give the test a name. And we can create several tests, and create suites of tests.
We're just doing one for this demo, though. So we'll call this firstTest. Click OK.

[Video description begins] The pop-up window closes. The screen shifts back to Selenium IDE.
[Video description ends]

And now we can save this project by clicking the Save icon. Its name is myProject.

[Video description begins] A Windows Explorer titled Save As opens. The breadcrumb is: This PC >
Downloads. At the bottom, in the input field for File Name, the following name is present:
myProject.side. Save and Cancel buttons are present at the bottom. [Video description ends]

Click Save. And done, it's saved.

[Video description begins] The pop-up window closes. The screen shifts back to Selenium IDE. At
the top-right corner, the Stop icon changes to a Rec icon. [Video description ends]

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 14/24
1/4/24, 1:09 PM Course Transcript

Now let's open this window a little bit further. So here are all the commands that took place as we
were navigating to google.com and doing searches.

[Video description begins] In the navigation pane, name of the Untitled file changes to firstTest. In
the center, a list of commands is present in the table such as: open, set window size, click, etc.
[Video description ends]

Now here's one of the most interesting aspects of Selenium IDE. If I right-click my test, I have some
options. Rename, Duplicate, Delete, and Export. So Rename, Duplicate, Delete are pretty
straightforward. That's exactly what they do. Export is going to allow me to export it to a couple of
different languages. So let's click Export. So we can export to Java JUnit, JavaScript Mocha, and
Python pytest.

[Video description begins] A pop-up window titled Select languages opens. It has a list of
languages with radio buttons. Export and Cancel buttons are present at the bottom. [Video
description ends]

So let's click the Python pytest option. Let's click Export.

[Video description begins] The pop-up window closes. A Windows Explorer titled Save As opens.
Save and Cancel buttons are present at the bottom. [Video description ends]

We'll leave the default name and click Save.

[Video description begins] In the input field for First name, the following name is present:
test_firstTest.py. The screen shifts back to Selenium IDE. [Video description ends]

Okay, so now, let's go over to File Explorer, my Downloads.

[Video description begins] In the Windows task bar, he selects File Explorer icon. A Windows
Explorer opens. The breadcrumb is: This PC > Downloads. In the center, a list of files and folders is
present. [Video description ends]

And here's the test that we just exported.

[Video description begins] He points at the following file: test_firstTest.py. [Video description
ends]

I'll right-click, select Open with Code. I want to open it with Visual Studio Code.

[Video description begins] A Visual Studio Code window titled test_firstTest.py opens. It has a
menu bar with the following options: File, Edit, Selection, etc. It has a navigation pane with the
following options: Explorer, Search, Debug, etc. In the center, it has an editor pane. In the editor
pane, a tab titled test_firstTest.py is open. It has a set of code lines. [Video description ends]

And there is my test script. So this was generated entirely by the Selenium IDE. And this script can
be automated. It can be imported into Selenium WebDriver. So that's a look at Selenium browser
automation.

11. Video: Chef Infrastructure Configuration (it_atstfddj_03_enus_11)

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 15/24
1/4/24, 1:09 PM Course Transcript

Find out how to work with Vagrant and Chef to create and configure infrastructure.

work with Vagrant and Chef to create and configure infrastructure

[Video description begins] Topic title: Chef Infrastructure Configuration. Your host for this session
is Joseph Khoury. [Video description ends]

In this video, we'll work with Chef to provision and configure infrastructure. In this video, we're
going to spin up a Vagrant VirtualBox.

[Video description begins] An Oracle VM VirtualBox web page opens in the browser window. It
has a navigation pane with the following options: About, Screenshots, Downloads, etc. A page
titled VirtualBox is open in the center. It has a welcome message. Below it, the following button is
present: Download VirtualBox 6.0. [Video description ends]

It's an Ubuntu 16.04 VM. We provisioned this VM in course two in a video named VirtualBox in
Vagrant. We'll configure that box using Chef. We'll install Chef Workstation, which has everything
we need in order to play with Chef on that Ubuntu 16.04 VM so that we can configure its state
using Chef. All right, so let's go over to Command Prompt.

[Video description begins] A terminal window opens. The command prompt is:
c:\projects\vagrant>. [Video description ends]

Now, I have an administrative Command Prompt open. I'm in projects\vagrants subdirectory on C


drive. I'm gong to tell Vagrant to spin up this machine by typing, vagrant up. Okay, that's done. Now
I'm going to clear the screen by typing, cls, and pressing Enter. Now that the VM spun up, we can
SSH into it. So we type, vagrant ssh, press Enter. And the terminal prompt changes to indicate that
we are now on the Ubuntu virtual machine.

[Video description begins] The command prompt changes to: vagrant@ubuntu-xenial:~$. [Video
description ends]

Okay, first thing I'll do is quickly create an alias for clear. So that's alias c=clear. And now every
time I type c, press enter, that clears the screen. To save us a little bit of time, I'm going to paste a
command chain into terminal. I'm going to update the apt cache.

[Video description begins] At the command prompt, he pastes the following command: sudo apt-
get update; sudo apt install tree; sudo apt-get -y install curl. [Video description ends]

I'm going to install tree. And I'm going to install the curl program. Okay, now that's done. At this
point, we've got our machine up and running.

[Video description begins] At the command prompt, he types c. The screen clears. [Video
description ends]

We're on the Ubuntu 16.04 machine. Now we want to configure and enforce the state of this
machine. And we do that with Chef. So what I'm going to do is run a wget command here with a
URL to bring down Chef Workstation. Now, let's go to the Taskbar and click on Firefox icon and

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 16/24
1/4/24, 1:09 PM Course Transcript

bring Firefox up. On the third tab, I have Chef Downloads. So that's just downloads.chef.io. And at
the top, Chef Workstation.

[Video description begins] Under Chef Workstation, a Get it button is present. [Video description
ends]

You can click, Get it, and we have to scroll down.

[Video description begins] A page titled Chef Workstation 0.8.7 opens. It has download links for
Chef workstation for the following OS: Red Hat Enterprise Linux, macOS, Ubuntu, etc. [Video
description ends]

So we want to find version for Ubuntu 16.04. Here it is, and here's that URL.

[Video description begins] He scrolls down the page. The following section appears: Ubuntu 16.04.
It has a url to download Chef Workstation. A Download button is present beside it. [Video
description ends]

So let's just copy this. So I'll highlight it, right click, select Copy. Now let's go back over to
Command Prompt. And now at this point, we can wget, space, and right-click to paste that
resource in here. And let's press Enter and download Chef Workstation. Okay, now that's done. To
install Chef Workstation, we can use dpkg for that.

[Video description begins] At the command prompt, he types c. The screen clears. [Video
description ends]

So I type, sudo dpkg -i chef-workstation, and I just press Tab to auto complete this. So 0.8.7-1.

[Video description begins] At the command prompt, he types sudo dpkg -i chef-workstation_0.8.7-
1_amd64.deb. [Video description ends]

And now let's press Enter to install Chef Workstation on this Ubuntu 16.04 machine. Now that's
done. Let's clear the screen again. And now, at this point, everything should be all set up on this
Vagrant box for us to start using Chef Workstation. Now let's see what version of Chef we have
running here by typing, chef --version.

Okay, and it gives us the version of each individual component of Chef Workstation that we've
installed. So let's clear the screen again. But now to keep things tidy, let's create a cookbooks
directory. So that's, mkdir cookbooks. And now to generate a cookbook, so we'll generate a
cookbook named apache. That's what we're going to install on our infrastructure.

[Video description begins] At the command prompt, he types c. The screen clears. [Video
description ends]

That's the state that we're going to maintain. So that's just, chef generate cookbook, and that's in
the cookbooks folder. And we're calling it apache.

[Video description begins] In the command, after cookbook, he types cookbooks/apache. [Video
description ends]

So this will automatically create an apache cookbook and the apache folder. Okay, done.

[Video description begins] At the command prompt, he types c. The screen clears. [Video
description ends]

Now if I type tree, press Enter, this gives me the layout. We've got cookbooks. We've got apache,
under here. And we have recipes. We have a default recipe, and that's what we're going to be
using. We also have a placeholder to create unit tests and integration tests. Now we'll use nano to
edit the default recipe. That's the default recipe under cookbooks/apache/recipes.

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 17/24
1/4/24, 1:09 PM Course Transcript

[Video description begins] He clears the screen. At the command prompt, he types nano
cookbooks/apache/recipes/default.rb. [Video description ends]

And let's press Enter.

[Video description begins] In the same window, a nano editor opens. [Video description ends]

Now we're going to specify the state of this machine. So first, an apt_update.

[Video description begins] He types the following command: apt_update 'update'. [Video
description ends]

Then we'll reference the apache2 package.

[Video description begins] He types the following command: package 'apache2'. [Video description
ends]

We don't have to tell Chef explicitly that we want to install, that's the default option. So that's
good. Now we want to create a file resource. We want to place it in the directory where the
index.html is served up by apache2. So that's File 'var/www/html/index.html'.

[Video description begins] He types the following command: file 'var/www/html/index.html' do.
[Video description ends]

So we create the file, then we want to perform some action. And that's content, we're going to
specify this content.

[Video description begins] He types the following command: content '<h1>Hello DevOps!</h1>'.
[Video description ends]

And we need to start the service.

[Video description begins] He types the following command: end. He types the following three
commands: service 'apache2' do, action [:start, :enable], end. [Video description ends]

And to save the changes in nano, Ctrl+X, press Y and press Enter.

[Video description begins] The editor closes. The screen shifts to the command prompt. [Video
description ends]

And now to run this, sudo chef-client --local-mode --runlist,and we reference the apache recipe.

[Video description begins] At the command prompt, he types c. The screen clears. [Video
description ends]

[Video description begins] In the command, after runlist, he types 'recipe[apache]'. He presses
Enter and an output appears. [Video description ends]

Now we'll run curl on localhost, and we should see, Hello DevOps, with the h1 tags.

[Video description begins] In the command, he types curl localhost. In the next line, before the
command prompt, the following text appears: <h1>Hello DevOps!</h1>. [Video description ends]

And we do. So we've successfully provisioned and configured infrastructure using Chef.

12. Video: ChefSpec Unit Tests (it_atstfddj_03_enus_12)

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 18/24
1/4/24, 1:09 PM Course Transcript

In this video, you will work with ChefSpec to generate and run unit tests for infrastructure.

work with ChefSpec to generate and run unit tests against infrastructure

[Video description begins] Topic title: ChefSpec Unit Tests. Your host for this session is Joseph
Khoury. [Video description ends]

In this video, we'll use ChefSpec to create unit tests.

[Video description begins] A terminal window appears. The command prompt is:
c:\projects\vagrant>. [Video description ends]

In the video Chef Infrastructure Configuration, I successfully used Chef to provision and configure
infrastructure. I installed Chef Workstation and used it to install configure and start Apache web
server on Ubuntu 16.04. Now, I'm going to configure that same VM to run unit tests against the
infrastructure. Okay, so I have an elevated administrative command prompt opened. I am at
project vagrant on C drive. Now, I have a Vagrant machine running, it's a web server. And to check
the status of running Vagrant virtual boxes, I type vagrant status. And there is a virtual machine
running.

[Video description begins] He clears the screen. [Video description ends]

So let's ssh into that machine. Okay, and prompt changes to indicate that we're on that virtual
box, in Ubuntu 16.04 machine.

[Video description begins] He types the following command: vagrant ssh. The command prompt
changes to: vagrant@ubuntu-xenial:~$. [Video description ends]

I'll quickly create an alias for clear.

[Video description begins] He types the following command: alias c = clear. [Video description
ends]

So now if I type c and press Enter, it clears the screen. Okay, I'll type tree and that shows me the
layout of my cookbooks that I've got on this machine. So I've got one cookbook that's called
apache, and I've got a default recipe. I've also got a placeholder for some unit tests, and that's what
we're going to use now. We're going to modify default_spec.rb, that is our unit test. Okay, so let's
go ahead and do that then.

[Video description begins] He clears the screen. [Video description ends]

First, we'll cd into the cookbook apache.

[Video description begins] He types the following command: cd cookbooks/apache. The command
prompt changes to: vagrant@ubuntu-xenial: ~/cookbooks/apache $. [Video description ends]

And now, we'll edit default_spec.rb with nano editor.

[Video description begins] He clears the screen. [Video description ends]


https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 19/24
1/4/24, 1:09 PM Course Transcript

So that's spec/unit/recipes/default_spec.rb.

[Video description begins] He types the following command: nano


spec/unit/recipes/default_spec.rb. [Video description ends]

And here's our default unit test.

[Video description begins] In the same window, a GNU nano editor opens. It has a set of code lines.
[Video description ends]

Right now, it's setting up a context for Ubuntu 18.04. But we don't have 18.04, we've only got
16.04. So we're going to alter this. So we'll change both instances of Ubuntu 18.04 to 16.04.

[Video description begins] He highlights the following code lines: context 'When all attributes are
default, on Ubuntu 18.04' do and platform 'ubuntu' , '18.04'. He changes 18.04 to 16.04 in both the
code lines. [Video description ends]

Also, there's a context for CentOS 7. We don't need that. We don't have a CentOS box in this
demo.

[Video description begins] He highlights the following code line: context ' when all attributes are
default, on CentOS' do. [Video description ends]

So Ctrl+K will delete line by line. Okay, and so right now, there is our unit test. It's saying if it
converges successfully, in other words, if the chef_run works, then no error is raised.

[Video description begins] He highlights the following code lines: it 'converges successfully' do and
expect { chef_run }.to_not raise_error. [Video description ends]

Now, let's go and add some unit tests to this. And we'll put them inside the Ubuntu 16.04 context.
So first we want to check that Chef installed the apache2 package. And to do that, we type it
'installs the apache2 package' do. And we place the expectation here by typing expect chef_run.to
install_package('apache2').

[Video description begins] He types the following command: it 'installs the apache2 package' do.
[Video description ends]

[Video description begins] He types the following command: expect(chef_run).to


install_package('apache2'). [Video description ends]

Okay, now we need one other. Okay, now we're going to create another block of unit tests. This is
actually two unit tests to ensure that we start and enable the apache2 service. So I'll start a new
line, it starts and enables the apache2 service.

[Video description begins] He types the following command: it 'starts and enables the apache2
service' do. [Video description ends]

Now, we set our expectations again. Okay, so we're expecting the chef run to start the apache2
service.

[Video description begins] He types the following command: expect(chef_run) . to


start_service('apache2'). [Video description ends]

And we're expecting the chef run to enable the apache2 service.

[Video description begins] He types the following command: expect(chef_run).to


enable_service('apache2'). [Video description ends]

Okay, now we save that with Ctrl+X, press Y, and enter to write those changes to default spec.

[Video description begins] He types the following command: end. [Video description ends]
https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 20/24
1/4/24, 1:09 PM Course Transcript

[Video description begins] The screen shifts to the command prompt. He clears the screen. [Video
description ends]

Now, let's run that and see what we get, okay? And we do that by running chef exec rspec. And
we're specifying the name of the unit test default_spec.rb, and let's go ahead and run that.

[Video description begins] He types the following command: chef exec rspec
spec/unit/recipes/default_spec.rb -f d. [Video description ends]

And it comes back and tells us for the Ubuntu 16.04 context, which is that machine that we
configured, that it converges successfully. So Chef runs fine. It installs the apache2 package and
starts and enables the apache2 service. So all three unit tests pass. So we successfully wrote and
ran three unit tests using ChefSpec.

13. Video: Exercise: DevOps Test Tools (it_atstfddj_03_enus_13)

After completing this video, you will be able to describe types of DevOps test tools, list key factors
for selecting DevOps test tools, describe the role that automation plays in DevOps, and work with
Vagrant to create a test environment.

describe types of DevOps test tools, list key factors for selecting DevOps test tools, describe the role that
automation plays in DevOps, and work with Vagrant to create a test environment

[Video description begins] Topic title: Exercise: DevOps Test Tools. Your host for this session is
Joseph Khoury. [Video description ends]

In this exercise, you'll practice what you learned about DevOps testing tools. You will describe
types of DevOps test tools, list key factors for selecting DevOps test tools, describe the role that
automation plays in DevOps, work with Vagrant to create a test environment. Now pause the
video and perform the exercise. When you're finished, come back here to see my solution. Okay,
first, the types of DevOps test tools include tools for development, tools for build, configuration
management tools, monitoring tools, and deployment tools.

[Video description begins] A Solution banner appears. [Video description ends]

Key factors for selecting the right DevOps test tools include understanding that the objective is to
support continuous testing. And that means that you should incorporate version control, testable
infrastructure, that's infrastructure as code, virtual environments for test, for infrastructure.
Continuous improvement, this takes feedback and feeds it back into the DevOps pipeline, that
CI/CD pipeline, for continuous improvement. And automation, of course, is key. Now describe the
roles that automation plays in DevOps.

Well, DevOps is all about delivery speed and agile processes. So test automation is all about
automating all test processes, and running all those tests automatically, and automating
deployment. So without automation, that just wouldn't be possible. So along the way, we have to
choose automation test tools, continuous integration tools, a testing framework that will support

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 21/24
1/4/24, 1:09 PM Course Transcript

automation and DevOps as well as being able to create test case scripts very quickly. And DevOps
is a test everywhere scenario, that's everywhere possible. Okay, let's hop over to my workstation
where we can work with Chef and Vagrant.

[Video description begins] A terminal window opens. The command prompt is:
c:\projects\vagrant>. [Video description ends]

Now, I have an administrative command prompt open. I'm in projects\vagrant subdirectory on the
C drive. I'm going to tell Vagrant to spin up this machine by typing vagrant up. Okay, that's done,
now I'm going to clear the screen by typing cls and pressing Enter. Now that the VM is spun up, we
can SSH into it. So we type vagrant ssh, press Enter, and the terminal prompt changes to indicate
that we are now on the Ubuntu virtual machine.

[Video description begins] The command prompt changes to: vagrant@ubuntu-xenial: ~$. [Video
description ends]

Okay, first thing I'll do is quickly create an alias for clear, so that's alias c=clear. And now every time
I type c, press Enter, that clears the screen. To save us a little bit of time, I'm going to paste a
command chain into terminal. I'm going to update the app cache, I'm going to install tree, and I'm
going to install this CURL program.

[Video description begins] At the command prompt, he pastes the following command: sudo apt-
get update; sudo apt install tree; sudo apt-get -y install curl. [Video description ends]

So what I'm going to do is run a wget command here with URL to bring down Chef Workstation.

[Video description begins] He clears the screen. [Video description ends]

[Video description begins] He types wget followed by a url. [Video description ends]

It's done. To install Chef Workstation, we can use dpkg for that. So I type sudo dpkg -i chef-
workstation, and I just press Tab to auto-complete this, so 0.8.7-1.

[Video description begins] He types sudo dpkg -i chef-workstation_0.8.7-1_amd64.deb. [Video


description ends]

And now let's press Enter to install Chef Workstation on this Ubuntu 16.04 machine. Now that's
done, let's clear the screen again. And now, at this point, everything should be all set up on this
Vagrant box for us to start using Chef Workstation. And now to keep things tidy, let's create a
cookbooks directory, so it's mkdir cookbooks. And now to generate a cookbook, so we'll generate
a cookbook named apache. That's what we're going to install on our infrastructure, that's the state
that we're going to maintain.

[Video description begins] He clears the screen. [Video description ends]

So that's just chef generate cookbook, and that's in the cookbooks folder, and we're calling it
apache.

[Video description begins] He types the following command: chef generate cookbook
cookbooks/apache. [Video description ends]

So this will automatically create an apache cookbook and the apache folder. Okay, done, now if I
type tree, press Enter, this gives me the layout.

[Video description begins] He clears the screen. [Video description ends]

We've got cookbooks, we've got apache under here, and we have recipes. We have a default
recipe, and that's what we're going to be using. We also have a placeholder to create unit tests and
integration tests. Now we'll use nano to edit the default recipe. That's the default recipe under
cookbooks/apache/recipes, and let's press Enter.

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 22/24
1/4/24, 1:09 PM Course Transcript

[Video description begins] He types nano cookbooks/apache/recipes/default.rb. In the same


window, a nano editor opens. [Video description ends]

Now we're going to specify the state of this machine, so first an apt_update.

[Video description begins] He types the following command: apt_update 'update'. [Video
description ends]

Then we'll reference the apache2 package.

[Video description begins] He types the following command: package 'apache2'. [Video description
ends]

We don't have to tell Chef explicitly that we want to install, that's the default option, so that's
good. Now we want to create a file resource, we want to place it in the directory where the
index.html is served up by Apache2. So it's file 'var/www/html/index.html'.

[Video description begins] He types the following command: file 'var/www/html/index.html' do.
[Video description ends]

So we create the file, then we want to perform some action, and that's content, we're going to
specify this content.

[Video description begins] He types the following command: content '<h1>Hello DevOps!</h1>'.
[Video description ends]

And we need to start the service.

[Video description begins] He types the following command: end. He types the following three
commands: service 'apache2' do, action [:start, :enable], end. [Video description ends]

And to save the changes in nano, Ctrl+X, press Y, and press Enter.

[Video description begins] The editor closes. The screen shifts to the Terminal window. [Video
description ends]

And now to run this, sudo chef-client --local-mode --runlist, and we reference the apache recipe.

[Video description begins] He clears the screen. [Video description ends]

[Video description begins] In the command, after runlist, he types 'recipe[apache]'. He presses
Enter and an output appears. He clears the screen. [Video description ends]

Now we'll run CURL on localhost, and we should see Hello DevOps with the h1 tags.

[Video description begins] He types curl localhost. In the next line, before the command prompt,
the following text appears: <h1>Hello DevOps!</h1>. [Video description ends]

And we do, so we've successfully provisioned and configured infrastructure using Chef.

Course File-based Resources


• DevOps Test Tools: Test-driven Development
Assets

• DevOps Test Chef Infrastructure Configuration


Assets

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 23/24
1/4/24, 1:09 PM Course Transcript

• DevOps Test Tools: ChefSpec Unit Tests


Assets

© 2023 Skillsoft Ireland Limited - All rights reserved.

https://cdn2.percipio.com/secure/c/1704480313.f8df89373627cfb8b488f9a4d14a240455434b5f/eot/transcripts/373eea06-db4e-4c6a-aec0-72bf603… 24/24

You might also like