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


#2

Thanks, Paul!

Regards,
Tobias


#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.


#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


#5

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


#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.


#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).


#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!