Ask a Question

Keyword operation script extension not adding info to keyword test editor

SOLVED
vthomeschoolmom
Super Contributor

Keyword operation script extension not adding info to keyword test editor

I am writing a script extension for my team's use. When I use the jkeyword test operation defined by the script extension, I see my user form as expected. But when I click OK, nothing is added to my keyword editor workspace page. I am following this tutorial page

 

https://support.smartbear.com/testcomplete/docs/working-with/extending/script/tutorials/creating-key...

 

I think I am seeing that this segment

 

			<Columns>
				<Column Name="Item" Value="VSI Standard Startup" />
				<Column Name="Value" GetValue="StartingSegment_GetValue" />
				<Column Name="Description" GetValue="StartingSegment_GetDescription" />
			</Columns>

of the description XML is supposed to identify what goes in the columns. And this code

 

function StartingSegment_GetDescription(Data)
{
	return Data.Description;
}

function StartingSegment_GetValue(Data)
{
  	return Data.QACompleteInfo;
}

Where Data is comnig from the values of my user form

 

function StartingSegment_OnSetup(Data) {

    var frm = UserForms.ssEditForm;
    // Display the Operation Properties dialog and check the results
    if (frm.ShowModal() != mrOk) return false; // No changes were made

    Data.QACompleteInfo = frm.txtNameId.Text;
    Data.PreReqText = frm.txtPreReq.Text;
}

Can anyone advise as to what I am doing wrong? THANKS!

11 REPLIES 11
tristaanogre
Esteemed Contributor

What do you have set up in your OnClick handler for your OK button?  That is where the mrOK value should be set for the show modal.  So, once the OK button is clicked, the form "ModalResults" property should be set to mrOK.  If that's not happening, then the form closes but it might not have the proper value and the "return false" executes and none of the rest of the data shows.

 

That's a rough guess but that's where I 'd start.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

In the form desgner, I have ModalResult = mrOk for the OK button, which I am clicking. I see no code in the example. I thought mrOk property was sufficient to say GO! 🙂 I have included the solution as attachment. I have also included the source files for the form, extension code and ...  I am still in the debugging step, so have not yet packed the extension up.

 

Thanks for your reply. 

More info...  still stuck

 

function StartingSegment_OnSetup(Data) {

    var frm = UserForms.ssEditForm;
    // Display the Operation Properties dialog and check the results
    if (frm.ShowModal() != mrOk) return false; // No changes were made
		var sFile = "C:\\\VSI Script Extensions\\" + GetRandomString() + ".txt";
		var iResult = aqFile.Create(sFile);
		if (iResult == 0)
		{
			aqFile.WriteToTextFile(sFile, "YOOOOOO!", aqFile.ctUTF8);
		}
        Data.QACompleteInfo = frm.txtNameId.Text;
        Data.PreReqText = frm.txtPreReq.Text;
    

}

I changed the OK code. I can see a file being created with the yo text in it. So... I have something wrong in my description file? 

 

			<Columns>
				<Column Name="Item" Value="VSI Standard Startup" />
				<Column Name="Value" GetValue="StartingSegment_GetValue" />
				<Column Name="Description" GetValue="StartingSegment_GetDescription" />
			</Columns>	

For giggle, I replaced the value an description columns with value and some bogus fixed text. Nuttin.

 

Thanks again!

SO I know I am doing something very basic wrong. So I went back to the docs (which I think are awesome btw SmartBear!). I am struggling because I don't understand all the words in the context in which they are written. What I want to do should be basic as heck. I want a keyword test operation that will add a few rows to the top of the open keyword test. The exact behavior I want is:

 

  1. Drag extensions operation from the operations pane into the keyword test editor.
  2. Pop the form which asks for information.
  3. On mrOK, add several rows to the start of the keyword etst above anything that may already exist.''

I even don't need or really want any runtime behavior in particular. 

 

So what you are seeing is my feeble attempt at getting clsoe to that.

 

TanyaYatskovska
SmartBear Alumni (Retired)

Community, any more suggestions?

@AlexKaras@Marsha_R@RUDOLF_BOTHMA@Vallalarasu_P ?

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



The thing that has me baffled is that at one point, the entries were added to the keyword test. At some point in my debugging something else, I cause that behavior to fail. Alas I can't tell what I did wrong. One thing I am 99% sure of is that I did not change the <fields> in the description.xml nor their getdata functions. Well let's say 80% sure since .... I clearly broke something.

I have attached a video explaining the issue I am having. Thanks.

@tristaanogre is the extension guru   🙂

tristaanogre
Esteemed Contributor

Yup... but even this one has me a bit stumped.  I typically do RunTime objects so doing a Keyword operation is a little bit new for me.  I'm enjoying the learning experience, though.

I MIGHT deconstruct this down to start and see if I can figure out where the problem is.  I honestly think it has something to do with when the edit form is closed... there's some event that is not defined somewhere to add the operation.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: