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