Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
In this video, we will discuss how to stressing your application can help test to be sure it will work.
Definitions:
- Load test: How quickly does the server respond to a certain amount of users? Usually this test will measure responsiveness, then add more users and measure responsiveness again.
- Stress test: How many users can the server handle before it doesn't respond at all? This test continues to add more users until the server shuts down entirely.
- Soak test: Can the server handle a load of users for a long period of time? This test puts a certain amount of users on the server for a period of several days to measure reliability.
Jmeter: https://jmeter.apache.org/
Locust: https://locust.io/
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
In this course we've mostly been talking
about QA in regard to web applications.
0:00
One thing we haven't tried to do
much of in our previous lessons
0:05
is simulate what it would be like to
have a website open to the public.
0:09
Many websites experience a lot more than
just a single tester clicking around on
0:14
their web page.
0:18
They usually get thousands of users
doing all sorts of things at once.
0:19
This can be pretty stressful to a server,
so
0:24
we like to employ load tests to see
if the server can handle it or not.
0:26
This type of testing almost always
needs to use some type of automation
0:32
to get good data back.
0:36
Though like we mentioned in
the last video, you could possibly
0:38
use a crowd sourcing service to get
many users to simulate load as well.
0:41
Another way to do this is to get
your customers and users to try out
0:47
a beta version of your software before
release, and to use that as a load test.
0:51
But for the rest of this video,
we'll assume you are using automation.
0:56
You'll want to create an automated script
that has a user do typically actions on
1:00
your web app, and
then multiply that script by 1,000.
1:05
Many tools exist that help you do this
such as a free tool called JMeter or
1:08
the Python-friendly frame
work called Locust.
1:13
There's a few different types of things to
try here when testing the performance of
1:16
the server.
1:21
First, a load test is simply starting
up a number of automated users and
1:21
having them all hit the server at once.
1:26
The test should measure how quickly the
server responds with this number of users.
1:29
Then it should increase the number
of users and measure it again.
1:34
And repeat this in a stair-step approach
until the desired amount of users is
1:37
reached.
1:41
The point of this type of test is to get
an idea of how performant the system is
1:43
at various loads of users.
1:47
This should give whoever
maintains the server,
1:49
an idea of what type of
performance they should expect and
1:52
might also give your team an idea of
whether they need to increase the hardware
1:55
they're using or rewrite some parts
of the code to perform better.
1:59
Another type of test that can help those
who maintain the servers is a stress test.
2:04
This test is like the load test,
but you keep adding more and
2:09
more automated users until the server
just can't handle it anymore.
2:13
If our application was going to
have a big release next week,
2:17
we anticipate that many more users
are going to get on the site as once.
2:20
Maybe we expect twice as many users, but
2:24
it would be good to be able to
handle much more than that.
2:27
A stress test script should add
another 1 to 10 users every second
2:30
until the server can't even
respond to the load any longer.
2:35
The point when this happens will tell you
what the maximum number of users you can
2:38
handle is.
2:42
The last type of test
is called a soak test.
2:42
This is very much like a load test as
well, but we leave the script running for
2:46
a very long period of time to see what
the reliability of the server is.
2:50
Usually we leave this test running for
several days.
2:55
There's a couple of things this tests,
one is simple reliability.
2:58
Will the server be able to handle the load
of users for a long period of time?
3:03
You'll be surprise how often other
performance tests will pass, but
3:07
leaving it on for a couple of days
will actually crash the server.
3:12
Another thing this tests is
any problem with the server.
3:15
Often different times, our processes
in the background of the server
3:19
will affect how it performs under load.
3:23
So keeping the test running for
3:26
a couple of days should
expose any of those problems.
3:28
If you're creating a load test,
I recommend recording a lot of the data.
3:31
Record what the users
are doing at every moment and
3:36
record how long each action takes.
3:39
When something goes wrong,
you'll want to be able to go back and
3:42
see exactly what triggered
that problem when it happened.
3:45
In the web application
world where you know you're
3:48
going to be using a server-client model,
3:51
load testing is essential, especially if
your application is open to the public.
3:54
These type of tests are all great
ways to ensure that you'll be ready
4:00
when a huge amount of new users suddenly
starts hitting your server all at once.
4:04
And that does it for
our overview of other types of testing.
4:10
In our next video, we'll go over some
ways that you can communicate quality
4:14
to the rest of your company.
4:17
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up