• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Test Engine in MVC

 
Bobby Sharma
Ranch Hand
Posts: 598
3
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there, I am building a test engine in MVC and want to add a functionality in which user session should not be killed i.e. suppose a person undergoing a test, suddenly faced a powercut, and when the power comes back , he or she should go back to the state at where they was interrupted by power-cut. The session should be resumed where he or she left the test. I am not asking for any code, just hints as I have no idea how to achieve this. Prometric test engine have this functionality already.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34695
367
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bobby,
First you need a way to identify the user is the same person. Presumably you already have a username/password.

You also probably want to make sure the person only has one session at a time so you'd want to invalidate the first session when a new one is created. One way to do this is to create a map of username to HttpSession so you can call invalidate. Another way is to have a filter or servlet check the database to see what the "current" session id is for the user.

Finally, you want to store the state of the test in something more durable than a session (database or file system is good.) That way you can re-load the new session with the current state when the user logs in again.
 
Bobby Sharma
Ranch Hand
Posts: 598
3
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you. I am using Microsoft c# .net and asp.net mvc. sorry , I forgot to mention this on my post. The answer you have provided me gave me some nice ideas though.

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bobby Sharma wrote:Hi there, I am building a test engine in MVC and want to add a functionality in which user session should not be killed i.e. suppose a person undergoing a test, suddenly faced a powercut, and when the power comes back , he or she should go back to the state at where they was interrupted by power-cut. The session should be resumed where he or she left the test. I am not asking for any code, just hints as I have no idea how to achieve this. Prometric test engine have this functionality already.


I used a Model class to represent a user/test combination. This class contains everything needed to identify the state of the test - answers to questions already done, whether or not test has been graded yet etc.

Also this Model class is serializable and each user/test combination has a unique ID which must be in text suitable for use as a file name.

The Model class object is serialized to disk after every significant action, keeping a copy in memory if possible.

If the user drops the connection and reconnects, the unique id can be used to recover the state he was in last.

Now you may think that serializing the object to disk frequently is slow, I can assure you that it is not compared to everything else going on.

MVC orientation will help in all aspects of creating a Test engine.

Bill

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic