Using phpTest

Now that we've read a bit about how the different pieces of phpTest work together, we'll present a sample scenario, and how phpTest can be used to meet the needs of this scenario.

Introduction: Jane's school

Jane is an administrator for her local high school. She has received several requests from teachers to implement some sort of standardized web-based testing system for the students to use. The teachers have several requirements for a system that would be usable to them:

  1. The teachers should have isolated test areas for each of their classes. Some teachers teach more than one subject.

  2. Teachers should be able to administer their own tests. They want to be able to add, delete, and modify questions. They also would like to be able to add, remove, and schedule tests.

  3. The teachers don't want to have to ask someone else everytime they need to add a student to the system. The teacher should be able to add students herself.

  4. The teachers would like to minimize cheating. Teachers realize that on typical multiple choice tests, answers can easily be passed around and shared between students. Ideally, the questions would be in a different order each time.

  5. The teachers are busy, and don't want to have to grade the tests themselves. The system should automatically grade the tests, and keep the answers for the teacher and student to look over.

This scenario may seem a little unrealistic, and it probably is. The point is that phpTest can meet all of the above requirements for the teachers, and we'll see how to use each portion of the test.

For our scenario, let's say we have three teachers who teach two subjects each. With these requirements in mind, we'll take the roll of the administrator and set phpTest up to meet each requirement.

Logging in

Before you can do any editing, you need to login to the system. Open up the index.php page. You'll see the screen below. If you want to change the text in the blue box, open $language.inc.php and look for 'MAIN_TEXT' => 'This is the phpTest...'.

Login with username: admin and password: 123456 (if you have already changed the password, login with that password instead

Once you are logged in, the menu below will appear on the left-hand side of the screen. This menu contains all of the administrative functions used to maintain the tests. Lets go through these options one by one. We'll go into detail of each item througout the documentation.

  • 'Change Password' is used to change your password. Everyone has access to this page.

  • 'View Test Results' is used to view your test results. It will show the test results of the logged in user.

  • 'Log Out' is used to log out of the system

  • 'Add Subject' and 'Add Test' are used to add new subjects and tests, respectively.

  • 'Add multiple choice question' is used to add a new multiple choice questions. Multiple choice questions are a question and 4 possible answers. The user picks the answer they believe to be correct

  • 'Add True/False question' adds a true false question. True false questions are a statement. The user has the option to choose whether the statement is true or false.

  • 'Add user' and 'Add group' are used to add users and groups, respectively.

  • The second 'View Test Results' is for administrators only. It shows test results for all users in the system

  • 'View Security Log' is used to view the security log. An entry is written to the log everytime someone tries to access an unauthorized or administrator-only page.

  • 'Clear Cached tests' is used to clear the temporary test files. More on this later.

The rest of the options are to edit or view the categories under the 'Addition' functions listed above.

Adding subjects

Please note: in the screenshots, the phrase 'skill level' is used instead of 'subject'. They mean the same thing.

Our teachers each teach two subjects. The questions for tests are pulled from a pool of available questions based upon the subject of the test. If you have 20 questions belonging to a subject called 'math', and you make a test called 'math test' with a subject of 'math', only questions from the math subject will be included on the test. Perhaps it's a little confusing but it will make sense in a bit. In our case, a subject is analogous to a subject, so we will add six subjects, one for each subject. The next screenshot shows the add subject screen.

Notice the yellow box at the top of the screen. This is the online help system. That yellow box will always contain useful or helpful information about the screen you are currently viewing. Let's call our first subject 'Math' and press the Submit button:

We see at the top that the subject was added successfully. Our new subject is listed at the bottom. The header columns in blue are clickable; you can sort that column by the header if you click on it. In this example we can sort by either s_id, or by name.

We'll add five more subjects, one for each subject: science, english, history, and spanish. Here is how our view skills page looks with all of the subjects added:

Adding groups

We also need to add a group for each subject. The groups will hold the users for each class. In reality you can call the group whatever you want, but for clarity, let's name the groups similar to each subject. Adding a group is identical to adding a subject; click on the "Add Group" link on the side and fill out the form:

You'll then be taken to the view groups page:

Here's a screenshot of the view groups page with all of the groups added:

Adding users

Now that we have the subjects and groups set up, we will add the teacher user accounts. We have three teachers who are each teaching two classes. Let's give the teachers names to avoid confusion.

Click on the 'add user' link from the left-hand menu. You'll see the following screen: (I've broken it into a few parts so you can see the whole thing)

Start by filling in a username and password. It's also helpful to put in a real name and email address, but not required (unless the administrator has set the REQUIRE_VALID_EMAIL option). Ms. Brown teaches both english and spanish, so check those the 'English Class' and 'Spanish Class' groups. Because Ms. Brown only belongs to those two groups, she will only be able to view tests that also belong to those groups. This will prevent her from even looking at any Math or Science tests. If you wanted Ms. Brown to have full administrator rights to the system (i.e. the same rights you have, can view and modify everything) you can check the "Check box for admin access" checkbox. The next two list of checkboxes will assign Ms. Brown partial admin access to her subjects and groups. Since we want Ms. Brown to be able to add questions for the Spanish and English subjects, check those two subject boxes. Also check the 'Spanish Class' and 'English Class' checkboxes, so she can add, delete, and modify her own users.

Once you've set the appropriate permissions and restrictions on Ms. Brown, press the submit button. You'll be taken to the 'View users' page. See the screenshot below:

We'll do the same for Mr Pink and Mr Green. Here is what the view users page looks like with all of the teachers added:

Adding questions

Now that the infrastructure has been set up, we can let the teachers log in to add their questions, tests, and students invdividually. We'll start with Ms. Brown, the bilingual English/Spanish teacher. When Ms. Brown logs in, she'll see the following screen. Notice that most of the admin options are gone. Only the relevant adding and editing options are shown.

We'll start off by adding some English questions. We won't be adding any Spanish questions because I don't speak Spanish. Ms. Brown clicks on the "Add Multiple Choice question" from the menu. She's then presented with the following screen with all of the fields necessary to type her question in:

Because we've only given Ms. Brown permission to add and edit English and Spanish subjects, when she chooses the subject for her question, she only sees the appropriate options: