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 demonstrate how to add edge cases to your manual tests.
Special Characters
Characters that are not typical alphanumeric characters [0-9, a-z and A-Z].
Can be the ones found on the keyboard or ones found outside like the "registered symbol".
Registered symbol: ®
Sample Test
Name: Invitee - Edit
Setup: Delete all existing users. Add invitee 'Jay McGavren'.
Steps:
# | Step | Expected Result |
1 | Click Edit under the first person. | Person's name is in a text box. |
2 | Delete the person's name and type 'Test Person'. | 'Test Person' is now in the text box. |
3 | Click Save Button. | 'Test Person' is now the invitee's name. |
4 | Click Edit under 'Test Person'. | Text box appears with 'Test Person' |
5 | Enter more than 100 characters and click save. | Textbox is red and error appears: 'too many characters, please enter a name less than 100 characters'. |
6 | Enter 100 characters with no spaces and save. | Name is saved and the text box stays inside the boundaries of the application. |
7 | Click Edit under the saved long name'. | Text box appears with long name. |
8 | Enter '!@#$%^&*()_+{}:">? | All special characters are saved as the name. |
9 | Click Edit and delete all characters from text box, then save. | Textbox is red and error appears: 'You must provide a name'. |
Teardown: Delete user 'Test Person'.
Hi, and welcome to the final
video on writing test cases.
0:00
In this video, we're going to actually
putting a lot of the theory from
0:04
the last video into our test case,
and try to add some common Edge cases
0:09
to the text input field for
the edit named feature.
0:14
We should be looking
around the application for
0:18
everything that a user can input.
0:20
The RSVP app has one that we just
tested in the previous video,
0:21
this edit name text box
that we can see right here.
0:26
Now, the acceptance criteria for
0:29
this feature never specified
how long a name should be,
0:31
how many names it can have, or any
special characters that are allowed here.
0:34
Let's try all those out and
add them to our test case.
0:39
We're going to add these test steps onto
0:42
the original Invitee Edit test
that we started in the last video.
0:45
Right now the test is very happy path.
0:49
We click edit,
changed the name, and save it.
0:52
But it doesn't really give us a lot of
confidence that this feature is going to
0:54
work for our other Edge cases.
0:59
Let's add a new step right
after saving the new name step.
1:01
For this step,
we simply wanna get back the edit screen.
1:05
So click edit button with
an expected result of
1:08
Text box appears with 'Test Person',
1:13
which is the name that we
changed it to earlier.
1:17
Note that this is also testing the ability
to re-edit something that we just saved.
1:22
Our first Edge case is users who enter in
way too many characters in the name field.
1:27
To test this we are simply going to
type in as many characters as we can.
1:32
But we expect that the app has a hard
limit of 150 characters for this field.
1:36
So for our next test step,
adding in a new one,
1:41
let's put Enter more than
100 characters and save.
1:46
Let's go back to the RSVP app
just to see what that looks like.
1:52
We don't really care if someone has one
name or multiple names, we just wanna
1:56
limit the amount of characters so that it
doesn't throw off the display too much.
2:00
If a person has one word for
their name but many, many characters.
2:04
So let's just type in
Manymanymanymanymanymanycharacters.
2:10
And we just wanna test that it doesn't
throw the display off too much.
2:18
You can see here that that many characters
does expand how much room this card
2:22
takes up.
2:26
So it'll force the area the box renders
in to be much larger than usual.
2:27
We really don't want that to negatively
affect the app's presentation.
2:31
By the way, a really easy way to test
how many characters are in your word,
2:35
is to open up a notepad application that
has a line number and a column counter,
2:39
such as Adam.
2:44
Or look up a character counter website,
2:45
like the one that I'm at right now
called CharacterCounterOnline.com.
2:47
When you type in the word,
2:52
you should see the amount of
characters there are as you type them.
2:54
It's safe to say that we would want some
kinda error to appear if the user enters
3:03
in more than 100 characters.
3:07
So our expected result that we would
wanna see is Textbox is red and
3:09
error appears: 'too many characters,
3:17
please enter a name less
than 100 characters'.
3:22
Note that this is not necessarily what we
are going to see in the app right now.
3:30
Remember that we want this error to happen
and we want it to be helpful to the user.
3:35
I'm sure you've experienced errors in
programs before that simply read error,
3:40
with no other context for
why that happened.
3:45
When possible an error should both
tell the user what went wrong and
3:48
how to fix it.
3:54
We also wanna test that putting in the
very maximum amount of characters works
3:55
properly.
3:59
So let's add another step.
4:00
Enter 100 characters with no spaces and
save.
4:05
With an expected result of Name
is saved and the text box,
4:12
Stays inside the boundaries
of the application.
4:20
We're trying to make sure that entering
one single long name doesn't break
4:27
the appearance to the app,
but still saves properly.
4:31
So I'm going to enter in
a very very long name again.
4:34
Long name with a many,
many, many characters.
4:41
And when I save this box it should
take up its own line entirely.
4:46
But you'll notice that it still fits.
4:51
One other Edge case I can think of that
will happen pretty often is that users
4:54
will wanna put quotes, or parenthesis,
in for someone's nickname.
4:58
Or they might wanna trademark
someone's name just as a joke.
5:02
So for our next step we want to ensure
that many special characters are allowed.
5:05
So let's go back to the test case,
and add in a special character step.
5:10
Special characters are just about anything
that's not an alpha-numeric character, so
5:15
things like asterisks, parentheses,
pound signs and dollar signs, or
5:20
even more esoteric things like copyright
symbol or the omega symbol would count.
5:24
The reason I wanna test this is
that oftentimes special characters
5:29
present awkward challenges
to the databases,
5:33
HTML links, and even some JavaScript
functions if they're not saved properly.
5:35
Since we're fairly confident that our
users will wanna use these characters,
5:40
let's add it in as a step.
5:45
So let's add a new step.
5:46
And we'll say Enter,
5:49
and then just choose some of the keys
that are at the top of your keyboard.
5:50
I like to enter most of them in, And save.
5:54
This is just a string of characters
that you can easily find, obviously.
5:59
But for fun,
let's also add the registered symbol,
6:03
which I've added to the teacher's
notes at the bottom.
6:06
And I'll just add this in right there.
6:12
You could also enter it as
a special key combination on your
6:15
keyboard if your operating
system supports it.
6:18
Our expected result is simply that
the special character save and
6:21
display on the site.
6:25
So let's add that in.
6:26
All special characters,
Are saved as the name.
6:28
Lastly, there will probably be some
cases where users delete the name and
6:36
forget to add the new one before saving.
6:40
So let's verify that the name field
is required when editing the name.
6:43
If a user erases everything in the field,
6:47
we will want to remind
them to enter something.
6:49
So for our last step let's write, Edit and
6:52
delete all characters from text box,
then save.
6:58
Our expected result would be,
Textbox is red and
7:05
error appears: 'You must provide a name'.
7:12
Great, note on that last step I added
a lot of our previous steps into one.
7:21
Tests should generally
start very atomically.
7:28
But as the steps become more repetitive
it's okay to start putting some
7:30
simple steps together,
7:35
especially after we've established that
those actions work in previous steps.
7:37
And that does it for
building out our first test case, and
7:42
adding in some common Edge cases.
7:46
We're now testing more than the happy
path of editing a username,
7:48
we're also testing Edge cases where
the user might experience an error.
7:53
We also want to make sure that errors
are helpful to the user when they
7:57
experience them,
with some sort of advice on how to fix it.
8:02
Edge cases are all about
thinking outside the box.
8:06
So hopefully these examples will help
you think of ways to do that within
8:09
the features that you'll
be writing tests for.
8:13
You need to sign up for Treehouse in order to download course files.
Sign up