Forum Discussion

jloiselle's avatar
jloiselle
Occasional Contributor
14 years ago

How do I run an AMF request from a teardown script?

I have a test case that creates a database object via an AMF Request as its first step. The last step is to delete this object from the DB with another AMF Request. But if any of my assertions fail, the object is left in the database.

Is there a way to make sure that if the object is successfully created in the first step, that the final step will execute even if a step in-between fails?

Does the teardown script not execute if the test fails?

I'd like to use this testCase for a loadUI test, but if the lists are left in the DB due to failed assertions, clean up will be very difficult as I have to generate random credentials and only the owner of a DB object can remove it.

1 Reply

  • Hi Jloiselle

    you can run your test step using testRunner.runTestStepByName( "TestStepName") in tear down method, but you need to make sure that this code execute when your run final step execute.

    For this you create a conditional statement in tear down method and execute only when your final step execute.

    Thanks
    Sadik Ali