Q1: | For the above XTrack story, assume we've defined the following high-level acceptance tests in release planning. We know this isn't complete; it's just enough to illustrate the ideas (see Table 16.4). Table 16.4. Test data for Exercise 10 Action | Data | Expected Result | 1. Add a new task | Valid values for the task fields | Success: the task is added | 2. Add a new task | Invalid values for task fields | Failure: invalid fields message | Also assume we've come up with the following additional information while planning and beginning the first iteration: Users must be logged in to add, update, or delete tasks. The name and description fields are required. State has a fixed list of values: Not Started, Started, Completed. Estimate and actual time spent must be numeric. Write these as an executable test in the style illustrated in the two examples in this chapter. |
A1: | // got to be logged in login("bob","bobspassword") // Add a new task with valid values it succeeds assertTrue( addTask( "User Gui", // name "Create GUI", // description "Bob", // assignee "2", // estimate "3", // actual "Not Started" ) ); // state assertTrue( addTask( "User Gui", // name "Create GUI", // description "Bob", // assignee "2", // estimate "3", // actual "Started" ) ); // state assertTrue( addTask( "User Gui", // name "Create GUI", // description "Bob", // assignee "2", // estimate "3", // actual "Complete" ) ); // state // add task with invalid values it fails assertFalse( addTask( "", // name - missing "", // description - missing "Bob", // assignee "long time", // estimate not numeric "longer", // actual not numeric "Ohio" ) ); // state invalid addTask() adds a task using the specified values and returns true if the task was added and false if it failed. |