I'm assuming you've already read the players rules on tests -- if you haven't, I'd start there and then come back here and we can break down how to make them.
Picking the difficulty
So how do you choose the specific number that your players roll against? First of all, you have to know what attribute you're testing, and what the player's level is in that attribute. Your players should have that on their character sheet, but if they don't you can calculate it by adding their attribute modifier to their character level.
Check out the table below to see a rough mapping from an attribute's level to the difficulty of a test that will challenge it. Note that the difficulty grows by 5 every level, but by an additional 5 (for a total of 10) at level 3, 6, 9, 12, 15, and 18.
|Attribute level||Test Difficulty|
This is a good rule of thumb for your players power. However, you may notice that this table goes up to 20-- what the heck? Aren't players only supposed to go up to level 10, and their attributes up to +5? How could they possibly reach Level 20?
The thing about this table is it's not going to be totally accurate to your party. It's a good rule of thumb, but as your players gather strong equipment and learn powerful special abilities, they'll start rolling even higher than you might expect! Once they start doing so consistently, it's probably best to start keeping track of the level that your characters roll like in addition to the level they have on their character sheet, just so you know for planning purposes.
However, not all tests have a level-- it's also perfectly valid for a test to be a roll off between the involved characters. Take an arm wrestling contest with, for example -- it would be a test of brawn, and both players would roll against each other. The outcome of the test, then, comes from comparing the rolls rather than comparing the roll to a static number.
In the rare event of a tie in a competition, everybody involved in the tie should either fail or partially succeed, depending on what makes sense to you.
When you're dealing with three or more people involved in the same competition, it's probably best to abandon the idea of failing or succeeding entirely. Instead, judge how characters did by ranking them from highest to lowest roll.
Offer hard choices when there are multiple risks
Lots of tests may have multiple risks involved. Chasing after a bad guy through a crowded alley in an unfamiliar city might have both the risk of letting them get away and getting lost in a part of town you don't know. While it's perfectly reasonable for a failure on a test to mean "all of the bad stuff that could happen, does happen" consider also offering hard choices to your players on which bad stuff might happen when they fail or partially succeed.
If your players are trying to do something and you just don't think they can do something like that in just one test, you can instead pick a target number and create a progress bar to track the effort spent.
A progress bar starts at 0 and ends at whatever target number you set it at. Whenever your players roll on tests that contribute to the goal of the progress bar, add their roll to the progress bar to fill it up! Once the progress bar hits the number you targeted, the goal is accomplished!
Optionally, you can also have additional "stretch goals" at further target numbers if your players want to keep going.
A test is fundamentally useless without a goal, a risk, and an uncertainty. Without uncertainty, the narrative already clearly indicates what will happen, so it should just happen. Without a goal, the roller's agency is subverted-- if they don't know what they're trying to do, the number rolled doesn't mean anything to them. Without a risk, failure has no cost and the test is drained of tension. At best, it's boring-- at worst it's frustrating.
This is not to say that tests need always be dramatic or life-changing-- changing the lettering of a sign to prank a party member is as valid a goal as crossing a precarious bridge. Getting caught by said party member in the middle of defacing a street sign is still a risk, it's just a less obvious one than tumbling off of that precarious bridge.
The concept of goals and risks is something that relies on the players being immersed in their character, their surroundings, and the world at large. If you're playing with a bunch of people new to the system, take some time in an introductory dungeon to help your players think in terms of the goals they want to perform and the risks that might come with them.
Goals are a statement of intent and should be more than just avoiding risks. To that end, goals should ideally be as specific as possible-- the goal is probably not to just dodge the swinging axe traps, but rather to get to the other side of the deadly blades so you can go on looting the tomb.
This is the part of tests that fall on the players to define. You should be prepared to ask questions until you are absolutely certain of the intention of the player's actions. If a player doesn't know what they are trying to do in the situation, consider presenting a few options like in a choose-your-own-adventure novel.
Risks are negative consequences to any action. Risks can be as benign as taking a whole day to research something or as life-or-death as taking a terrible injury, and should rarely just be failing to achieve a goal in a way such that the character couldn't just try again.
A character shouldn't just attempt to push some boxes and find them unable to budge, failure should be them accidentally getting pinned beneath them or their efforts alerting a passing warehouse guard. Even something as apparently riskless as failing a researching skill check in an quiet town library should result in a sleepless night, missing a crucial detail, or getting a fact wrong.