I'm new to unity testing and having a hard time identifying the correct scenarios to test.
Mainly I have following functions in my website:
View Pages
-
Retrieve values from the DB using a model
-
Pass that data into the HTML template via the controller
-
Print data in HTML template to display
//view
public function getStudents(){
$students = Student::all(); // model: get all the students from Database
$data['students'] = $students;
return view('views/students', $data);// Pass data into the view
}
Edit/Create Pages
-
Retrieve input data from the view file
-
Validate
-
Save/Update DB and print success message.
public function editStudent($id){
//grab input data //validate //save in DB}
Above scenario looks pretty straight forward. As long as I get database entries I get the output. Do we need to write unit tests for this? What are the test scenarios?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire