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

UI script silent invalid error


I was writing an ui script to do certain actions on success of the form in testcase add/create/delete page. so wanted to know the results by making it an ajax call as follows

// code begins
name: EventTransmitter
description: Sends event from ui to backend
author: Collabnet Inc.
version: 1.0
includes: ^cases/

(document).ready( function() { (“form#form”).submit(function(e) {
var actionurl = e.currentTarget.action;
console.log( ("form#form").serialize()); .ajax({
url: actionurl,
type: ‘post’,
data: $(“form#form”).serialize(),
success: function(data) {
error: function( jq, status, error) {
complete: function(jqxhr, status) {

div.some-class {

the above does not work … it did made the ajax call to status success but failed silently with response message

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.

but when I put the ajax call alone (code indented: in the chrome developer console … and make the tescase add/edit in ui , ajax call works as expected by successful completion .

why is this behavior in uiscript ? how to make it work ?


Found the reason why it was not working …
It was due to the hidden field value ‘js_test’ .
for some reason it is set as 1 when form is submitted by button click.
but it is sent as 0 itself when i do ajax call from ui script …
so changing it to 1 before doing ajax call fixes this problem …

(what is the purpose behind this js_test field ?)


Hello Harish,

Thanks for your posting! Submitting the case form via Ajax wouldn’t really be supported as there’s more to submitting the form than just serializing it and posting the values. For example, if you use the separated steps field, TestRail will manually serialize the steps (as JSON) and inject that into the form. It will also set the js_test parameter (which indicates that there are no JS issues which can be causd by malfunctioning UI scripts).

An lightweight alternative to detect error/success after add/edit actions would be to check for the error/success message at the top of the screen (in case it’s a POST request).

I hope this helps!