locked
Delayed test RRS feed

  • Question

  • Hi All,

    I want to do automated tests for my project. It is a DLL that can be used in a webserver to store client data on webserver side. To do so, I will use a session cookie for the client ID, and the DLL keeps a dictiionary with key == client ID and value is a dictionary with key value pairs for the data to be stored. Actually the server has to keep some variable data that has been sent to the client.

    Each time the client access the webserver - and - the webserver accesses the client data storage, inside the datastorage a 'last update' time is set to the current time (DateTime.Now)

    The DLL has a timer, and each time that the timer times out, the client data timestamps are checked. If the 'last update' time is too old, all data for that client is cleared.

    Now I would like to create some tests where I can

    1) Add a new client
    2) Get the client
    3) Add data to the client
    4) Get the data from the client

    The above tests I already have, no problem. Now I want a test that will start only 2x timer timeout value later to check if the client has been cleaned correctly. Thus I want to delay the execution of my test method

    I would appreciate if someone could explain how to create a delayed test method (preferable not using thread.sleep)

    Thanks

    Wednesday, September 14, 2011 7:45 AM

Answers

  • I have created a ordered test so that I can decide in which order the testmethods are executed. After this, I have created a separate test method that is doing a thread.sleep.

    Looping and sleeping inside other test method's is not usefull especially when you want to check the timing

    I would have expected VS2010 to have some more options for this.

    • Marked as answer by bart___s Wednesday, September 21, 2011 5:51 AM
    Wednesday, September 21, 2011 5:51 AM

All replies

  • Hi,

    Do you have a method which will expose the current state of the client. If yes, you can have a while loop which exits only when the state is set to clean, otherwise it keeps cheking the state at a specific interval.

    You might want to think of any other similar ways.

    If not, then Thread. Sleep is the way to go if you know the default timeout value.

    Thanks,

    Anuj


    http://www.anujchaudhary.com/
    Thursday, September 15, 2011 6:15 AM
  • I have created a ordered test so that I can decide in which order the testmethods are executed. After this, I have created a separate test method that is doing a thread.sleep.

    Looping and sleeping inside other test method's is not usefull especially when you want to check the timing

    I would have expected VS2010 to have some more options for this.

    • Marked as answer by bart___s Wednesday, September 21, 2011 5:51 AM
    Wednesday, September 21, 2011 5:51 AM