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

[UI Script] Option to add another test with values copied from current

#1

Another extension from me aiding usability. It adds a checkbox on Add New Case page that allows to memorize values from current test case and insert them in the new case. This is very handy if one has to create multiple test cases with similar preconditions/steps/results/title etc.

UPD (Mar 4, 2015): The script now supports separate steps mode! For TestRail 4.0 and newer only. » Gist here «

Note: you must add and enable both scripts for everything to wire up.

Functionality:
[list=]
[
]While the checkbox is checked: when Add Test Case is clicked, and current case is valid, it is saved, and the user is forwarded to the page for creating another test, where all fields will be pre-populated with values from the saved case.[/]
[
]When the checkbox is unchecked, adding cases works as usual.[/]
[
]Now also works with separate steps![/*]
[/list]

Things to consider:
[list=]
[
]Since cases functionality still uses form submission (unlike other pages that use AJAX), the script is a bit hackish. First, you’ll notice that there are in fact two redirects, and you require two scripts for two pages for this functionality to work. I hope, this functionality will soon be AJAX’ified and I’ll update the script to have better UX (or maybe the Gurocks will implement this feature natively? ;))[/]
[
]The script uses HTML5 session storage to store case data and flags between pages.[/]
[
]New: Since TestRail servers block too many concurrent requests, adding steps in multi-step mode might be slow because it’s done synchronously. The loading time should be well below 2 seconds for <20 steps though[/*]
[/list]

With best regards,
Paul

0 Likes

#2

Thanks, Paul!

Regards,
Tobias

0 Likes

#3

@actine, i am using this script it added “add another” button and copying all the fields to next test case but its not carrying over the test steps. Do you have any idea about this? or the script written to work like that?

Thanks,
Sujatha.

0 Likes

#4

@sujatha, are you in the separate steps mode? This script was designed for “preconditions-steps-results” mode and wasn’t tested for separate steps (apparently it won’t work)

P.S. Yeah, indeed, doesn’t work with separate steps. And this is not that trivial to fix. I’ll probably look into that in a few days

0 Likes

#5

I would really like the ability to do this too as we use the test steps functionality alot

0 Likes

#6

@Actine , Am not sure what exactly is the separate steps mode but when I create a test case and select the “Add another” it carries over the pre-conditions but not the steps I have written in the test case.

If we can carry over the steps it will help us a lot as the steps are mostly repeated when we create the new test cases for a feature. It would be great if you can work on this in near future.

Thanks,
Sujatha.

0 Likes

#7

Oh… Sorry for disappearing.

@sujatha, the separate steps mode is this: http://docs.gurock.com/testrail-faq/config-steps
If you’re using the “usual” preconditions-steps-results fields, that’s pretty strange why the script wouldn’t work for you — it does for me just fine: http://screencast.com/t/g00QnApCJz
I don’t know, maybe you changed the field ID or something? (though it shouldn’t be the case, as far as I remember the script just saves and carries over whatever it finds in the form)

@PFOX, going to look into this today. Not sure whether I’ll find a sensible solution though — from what I saw, adding a new step is not instantaneous (maybe some AJAX occurs).

0 Likes

#8

@sujatha, @PFOX
Done! Updated the scripts to work with separate steps. See the first post for Gist link.
Check if it works for you

@tgurock, thanks again for letting me use the staging instance to have this done!

0 Likes

#9

I just tried this Script, knowing it is several years old. When I create a case, then click “Add Test Case” the second case is brought up with the fields filled out. However, the “Add Another” checkbox is missing and if I hit Add Test Case on the second one it fails to save and gives me an error in Test Rail:
The JavaScript of your browser is not working properly and the test case wasn’t saved as a safety measure. This can be caused by malfunctioning browser plugins or invalid UI scripts that were added to your TestRail installation. Please contact your TestRail administrator to look into this.

0 Likes

#10

Hi Jason,

Just tested the script myself. It seems the error only appears when using “Add & Next”. While this seems like the proper button to push this button wasn’t actually available in TestRail until a very recently update. Therefore the script was only intended for use with and still works when using the “Add Test Case” button.

0 Likes

#11

Oh wow, I’m surprised that after 4 years it kinda still works.

Sorry, but I don’t support this any more. Have moved on from testing long ago and haven’t worked with TestRail since then. But I believe someone can figure it out and update the script.

P.S. Oh, got it. Still works, just not with a recently added button. Great! :smile:

0 Likes

#12

Thanks for chiming in Paul and your script! Should be an easy edit to factor in the new button if someone is inclined and bothered enough. :slight_smile:

0 Likes