CSci 4657 Lab 5. Due Friday, February 25 at 11:59pm
Goals of this lab:
- Practice with PHP, including forms handling and sessions
- Using Selenium IDE for testing server-side processing and cookies.
Work in pairs. Ping-pong programming is recommended.
Lab tasks (40 points)
The goal for this lab is to develop a simple hangman game using
server-side PHP processing. The server-side application keeps track of
the player statistics using sessions. The player may erase the
statistics by destroying the session and start again. In addition to
developing the
game you are also required to test its functionality using Selenium.
Below are the specific requirements:
- Your task is to write a page for simplified version of a game of
"hangman". Each game starts with the computer picking a
three-letter word from a list and setting the number of remaning
attempts to some fixed number, such as 10. The user then enters a
letter. If
the letter appears in the chosen word, it is revealed to the
user. If it doesn't appear then it's added to the list of "tried"
letters (shown to the user) and the number of attempts is
decremented by 1. The game continues until the user guesses the
word or the number of failed attempts reaches the given
number.
- Make sure that you test the functionality using Selenium. Note
that in this case you are likely to need clickAndWait
since the page will be reloaded with every submitted
letter.
For a sample test that checks, stores, and
retrieves cookie values click here:
CookieTest.html. Note that since your
cookie is an auto-generated session cookie, you will need to store its
value and then retrieve it later to check if it's the same or a
different session.
- On the server side a session is opened when the user starts the
first game by clicking "New game" button. The user is prompted for
their name (which is stored in
a session variable) and the game score (see below) is
initialized.
- The server is keeping track of the user's total score (the number
of won/lost games and the total number of failed attempts on the
games that the user won). The score is updated in the session after
each attempt and is displayed to the user in the page.
- The user has the ability to restart the score. If the user clicks
on "restart" button then the session is destroyed. If the user
clicks on "New game" after that then they are prompted for their
name again and a new session is started.
What to submit.
Send me a link to your files (the PHP file and the selenium tests) on
the csci4657spr11
server. Do not modify your file after the submission.
This page is a part of CSci 4657
course web site.