I have to automate a series of manual tests which contain a time window for which the user has to wait for a period of time - 48h.After this period, the status of my objects is changed. And this I have to check, if the status has changed. Is there a way to automate this using QTP/UFT, only on the UI? Or DB changes are needed in order to speed up those 48 hours?

  • 2
    This seems like an idea place to mock a response. Instead of waiting for actual input, can you simulate the input so your test can move on? 48 hours of waiting within a single test seems bad. Mar 20 '17 at 16:05
  • 1
    I agree, or change the timeframe for testing purposes. You can add an implicit wait for 48hours which would do what you want, but you would have to ensure it doesn't go to sleep or anything and noone touch the machine during the timeframe. It's really best to mock time situations with a controllable parameter rather than force days of waiting.
    – mutt
    Mar 20 '17 at 16:59

There are several ways you can do this, depending on the nature of your application. Some suggestions:

  1. If status changes based on time since creation and you have access to the database, part of your setup is to set the database object creation timestamp to 47:00:59 before now, then wait one second and check the object.
  2. If there is a configurable wait time in the application (such as setting a cool-down time of 48 hours) you can change that setting to something like 30 seconds; create your object, then wait 30 seconds to check that its status changed on schedule.
  3. If you are running tests on a schedule, you can get creative and have part of your setup create the objects and use the expected "maturation time" in their name if you can. Then you check them during the test run two days later. (I don't recommend this if you can possibly avoid it. It's complicated, messy, and has far too many dependencies involved. But it may be all you have available to you).
  4. You can mock the date/time to be what you choose, and set your mock date/time value to when you expect the object to change status.

If I had to test this scenario, I'd probably use a combination of #1, #2, and #4 so I had some tests covering status change 48 hours after creation, some covering honoring the wait time interval, and some focusing only on the status change.

Regardless of the way you approach the problem, you will need to use code rather than the UFT GUI to create and modify your tests.

  • I think this is a great reply, but I would try to approach things a bit different as in try to break the tests as much as possible and then schedule the bits that need to be run after the 48hours gap.
    – AndreiT
    Mar 22 '17 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.