Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

How to duplicate a testRun from at TestPlan


#1

Hello,
I wish to have several test runs within the testplan with the same tests and a different testrun name.
For example i have some feature test plan and i wish to run the same tests for different browsers.
I know i have the rerun button- but it doesn’t help when i wish the team will work in parallel.

Is there an option to do so from within the testplan?

Now i have to manually select the test cases again and again and it is very frustrating.


#2

Hi Maya,

If you want to duplicate a test run within one of your test plans, the easiest way to do this is by using the re-run option in a test run. This will allow you to select the tests you want to copy into the new test run as well as configure the name, etc., as if you were creating a brand new test run.

http://docs.gurock.com/testrail-userguide/userguide-tips#rerunning_test_runs

Hope this helps.


#3

Thank you but it duplicates the whole test plan, while i wish to only duplicate a test run within the test plan.

  1. This is adding a New and duplicated test plan But i have no option to re-reun or duplicate a testRun
    (i wanted to past another image but there is a restriction of only one image :frowning: )

So if i wish to have a hierarchy of
Feature Test plan
–> Testrun 1
–> IE testRun
And now i wish to duplicate the IE testRun and name it FF TestRun i can’t… (or not sure how to)

Thanks


#4

Hi Maya,

A test run can only be duplicated if it is outside of a test plan. If you are attempting to duplicate a test run that is inside of a test plan, you will not be able to do this. You would have to duplicate the entire test plan. The easiest thing to do in this case would be to create a new test plan from scratch and it only takes a few clicks to do this.


#5

Sad to hear.
Can i request this as a feature?


#6

Hey Maya,

Sure! I would be more than happy to submit this for consideration for a future release of TestRail.


#7

Hi, just want to say I have the same need. I need to run the same testrun that I ran 3 months ago. I wanted just to copy the testplan I used last so i will be sure to pick the same testes. We hava a big number of tests and not all of them are on all platforms, so it is a selection on different plattforms as well as it is a selection of test from many different testsuites. I took quite some time to pick all the tests for this spesific testrun.


#8

Hi Inae,

Thanks for your reply! You can already copy a previous test plan that has been run by using TestRail’s Rerun feature. The Rerun button would be located at the top right when viewing the test plan or test run page, and this would copy/create a new test plan with the previous test plan’s runs. You can also modify the runs and case selection after copying this in case you need to remove specific runs afterwards that are no longer relevant to the new test plan’s scope. You can learn more about the Rerun feature on our website here:

http://docs.gurock.com/testrail-userguide/userguide-tips#rerunning_test_runs

Hope this helps!

Regards,
Marco


#9

+1 for copying a test run from a test plan. Sometimes I require to run a specific test run on it’s own and I don’t want it looking like a test plan!


#10

Hi Dani,

Thanks for the reply and feedback! Sure, this makes sense and we’re happy to review this for a future update. I’ve added your vote to the request!

Regards,
Marco


#12

Hello,

We really need this feature too in our team so I developed it by myself

For the moment it only works with runs without configuration but it works well to copy a test run inside the plan

=================================================

If somebody need this too and for sure if testrail team allowed me, i’ll be happy to share my scripts.

This is just a prototype for the moment but i will try to improve this :grin:


#13

Hi Afaeld, I would really love to have your script!

I plan to develop something similar, but if someone have already done the job why would I do it!
:laughing:

Thanks in advance!


#14

Hey kevin no problems i will share that with you:) I just have to fix a small issue that i found before.

For your information these scripts are running with python 2.7 and PHP 5.4 on a linux. So i dont guarantee anything if you’re running these on an other environment :grin:


#15

All good, in the worst case I will at least be able to inspire myself from them!

Thanks a lot!


#16

Hi Afaeld,

I have started to work on my task to add the “Copy test run” button in the plans/edit page. I am currently trying to figure out how to get the test run id of the specific.

I don’t want to add pressure on you, but I was wondering when you could share your code.

Thanks!


#17

The mechanism for that exists, it’s called ‘configurations’. It’s easy to duplicate test runs in different conditions, for instance with different browsers.


#18

@Kevin_Labrie Hi ! Thanks for the reminder, I totally forgot. My bad !

In a first time here is the customUI Javascript

https://pastebin.com/6eT6WE6v

This is not so hard to understand if you have basics in JavaScript

To identify the run i use the “id” that you can find on each entry in your plan

You can retrieve the id in the database by the column “entry_id” in the run table :

Each “Duplicate this test run” contains the id of the run, when a user click on this link an ajax call is made on a php file with plan and entry as attribute.

Will share PHP and python just after


#19

For some reasons I use an intermediate PHP file. This is not mandatory i think, normally you should be able to execute the python script directly with the ajax call. But i don’t guarantee that is the secure way to do this action.

The PHP file just execute the python file with the entry and planId as parameter
https://pastebin.com/hShV5E99

Now the Python File, you will need some python module to execute this but for sure you can adapt this with any programmation language you want. This is only database select requests and a HTTP POST to the testRail API
https://pastebin.com/dL52xDTV

In this code I recover the run in the database with the entry id and with these datas i build a new run with same tests and attributes.
I will not explain each line, the code is not long, but if you need help on a point I will be happy to help you :slight_smile:
I’m sure this is not the best way to do this feature but it doing what we need for the moment and I will improve it later. But it give you all elements to develop this feature on your side !
Hope this will help you a bit ! :slight_smile: