TestProject Forum

Setup / Teardown / Before Test / After Test / Suite

Hi guys is there any easy way to implement the @beforeSuite / Tests from code into the UI? If not can we implement this please, would be really helpful for database cleanup ect.

Or is there away to run just call another test inside a test? Any help would be appreciated.

There are several ways to implement @beforeSuite/Tests , the easiest will be creating a step as test (sub test) in your main tests, just locate the Add test as step icon on your recorder then search for the cleanup test you created.

then inside you cleanup test you can use code or already existing actions to preform your cleanup operations.

Using Code

  1. Develop and addon and upload to your account (JAVA) then use it as steps/actions in your cleanup test.
  2. Develop a coded test in C#/Java then upload the JAR/DLL to the platform and run it as whole test as step.

Codeless by using existing actions

  1. Execute JavaScript look for Execute JavaScript action, paste JS code.
  2. Execute SQL query look for send sql query action, paste any query and you are good to go
  3. Execute cmd command looks for Execute action
  4. HTTP POST/GET/PUT commands search for HTTP actions

How to search for actions

gotcha thanks for the workarounds, would be nice if there was a before after section, where it would apply to all tests, and maybe a checkbox to exclude tests ect. as opposed to adding it to every test in the UI.

but this works for now.

tags on tests/jobs will be avilbale soon, right after it smart job execution with tags…

Hey Mark, what is the work around for doing a before / after suite? basically add the test in the job 1st, and last? and let it run against 5 browsers ect.?

Anyway to have 1 of the tests in the job run against only 1 browser? Can’t think of another way to use before suite / after.

Scenario is we seed some database data, before the whole job runs with all the tests.

If this is your scenario maybe you can use nested tests, adding them as a before after steps in your primary test.

This is how it can work: create a small test that will seed your database (you can use SQL addon for that), then use the option of image in your main test as your first step and last step.

then drop the main test in your job.

with this method you will be able to apply validations/conditions on these before after tests as well, since they will be considered as test steps

the problem with the above, i think Artem opened a request for it. Is the setup is fine, it’s the teardown, if the test has 60 steps, and it fails at step 12, even setting to continue each step failing searching for elements would take like 20minutes to get to the final step to run clear database.

Also the scenario is for jobs or at the suite level. Say I’m running 20 tests. I don’t want to seed and clear the database between each test. Only once run the tests, then at the end of the tests do something.

I guess just put setup test in the front of the job, then teardown test at the end of the job?

got it, if this is the scenario yes: put setup test in the front of the job, then teardown test at the end of the job will do the trick