Every sprint begins with a planning activity. This is when the Scrum team decides on the work to be done in the iteration ahead.
Sprint planning is divided into two parts.
During the first part user stories are analyzed, evaluated and estimated. After that, the developers determine a reasonable workload that they think they can commit to.
During the second part, selected stories are analyzed in more detail by the developers (remember, I use the term developer for everyone building the product, including coders, designers, testers, documenters, and so on).