Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI editor for Beanshell doesn't always pick up changes, code is lost #1980

Closed
asfimport opened this issue Jul 20, 2007 · 6 comments
Closed

Comments

@asfimport
Copy link
Collaborator

David Martinez (Bug 42947):
Most of the time, copying code and pasting it into the beanshell script areas does not work. Pasting
content then using control-S to save makes the content get cleared immediately. Pasting content then
running the script uses the old content. Making small changes to the content then saving also keeps
the old content.

It's annoying because It's much easier to use an editor without proper syntax highlighting, completion,
etcetera (especially since most of JMeter's beanshell nodes do not support just making reference to a
file, but that's a request for another day).
This makes it impossible to use any editor other than the jmeter included editor (and even then small
edits are usually lost). I'm much more productive in (insert actual programmer's editor here).

To reproduce, try this:

  1. Add a beanshell postprocessor
  2. Type "See me dissapear!" in the Script: Area
  3. WIthout moving focus away, press Control-S to save.

Expected: The text does not dissapear.
Actual: Text dissapears

As a workaround you can move away to another node then come back. But THIS DOES NOT ALWAYS
WORK on longer scripts for some reason.

Severity: major
OS: Mac OS X 10.4

@asfimport
Copy link
Collaborator Author

Scott Marlowe (migrated from Bugzilla):
Note that I get the exact same goofy and unpredictable behaviour when editing a
regular expression dialog in a regex postprocessor. The text is in the box, but
when I hit run, jmeter doesn't actually run, and when I click out of the dialog
and back in, my old regex is there staring back at me, laughing.

Using Jmeter 2.3RC3

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
It appears that using Control+S to save a test plan has always been broken for
GUI items that use TestBeanGUI.

For example, using CSV Dataset: enter a value in the filename field, and save
the plan using control+S. Exit and reload the plan - the value has not been
saved.

The difference in 2.3RC3 is that this behaviour has become obvious, as the
saved version is now reflected in the GUI.

The same problem applies to other short-cut keys such as Control+R.

Normally the value in the GUI field is saved whenever there is a focus-lost
event however this does not happen for short-cut keys.

@asfimport
Copy link
Collaborator Author

Alf Hogemark (migrated from Bugzilla):
(In reply to comment 2)

It appears that using Control+S to save a test plan has always been broken for
GUI items that use TestBeanGUI.

For example, using CSV Dataset: enter a value in the filename field, and save
the plan using control+S. Exit and reload the plan - the value has not been
saved.

The difference in 2.3RC3 is that this behaviour has become obvious, as the
saved version is now reflected in the GUI.

The same problem applies to other short-cut keys such as Control+R.

Normally the value in the GUI field is saved whenever there is a focus-lost
event however this does not happen for short-cut keys.

The problem seems to be that the "propertyChange" event for the PropertyEditor
in the TestBeanGui is not fired until after the changes have been stored. If you
change the comment of the BeanShell Postprocessor and hit Ctrl+S, that change is
saved.

The problem is that the PropertyChange events have not been processed before the
TestBeanGui.modifyTestElement method is moving changes from gui to model.
Therefore, the changes are not saved.

I do not see an easy fix at the moment, will have to investigate more on how the
java PropertyEditor works in conjunction with keyboard shortcuts.

@asfimport
Copy link
Collaborator Author

Alf Hogemark (migrated from Bugzilla):
(In reply to comment 1)

Note that I get the exact same goofy and unpredictable behaviour when editing a
regular expression dialog in a regex postprocessor. The text is in the box, but
when I hit run, jmeter doesn't actually run, and when I click out of the dialog
and back in, my old regex is there staring back at me, laughing.

Using Jmeter 2.3RC3

I think you are in fact observing #1992, which I have just made a patch for.

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
Added code to TestBeanGUI.modifyTestElement() to copy the values of the fields
from the GUI.

Applied to SVN in r571348.

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
There was a slight problem with the previous fix - only one change was saved,
as there was a return in the loop.

This has been corrected in r571407.

BTW, I looked into propertyChange events - the event was not being fired for
short-cut keys. This appears to be a feature of Swing/AWT.

The propertyChange code became redundant; now both TestBeanGUI and other GUI
classes save the field contents in modifyTestElement().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant