-
Notifications
You must be signed in to change notification settings - Fork 31
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
Saving test parameters as a default parameter #703
Comments
Do you mean the parameters, which are available to your tests through TestContext? |
@YashUoM Waiting for you to clarify. 😃 |
@CharliePoole Yes TestContext parameters. Sorry about the late clarification |
Currently, there is no way to do this. Since those parameters are stored in the TestPackage, I see this as a part of issue #3. We'll keep this alive to remind us that saving TestPackages has to include any parameters provided. At the moment, I'm afraid I don't have a schedule for finishing that issue but it will be incorporated in the 2.0 release. |
Is this possible to do with the current code base? I'm trying to implement this and have around 60% success by keeping the test parameters in the user settings. However currently having issues with reloading tests with test parameters when loading the exe and creating the test-tree. A tip would be really nice. :-) |
I don't see any way to do it short of modifying TestCentric to save and restore these for each package. That's a fairly large change and I'm afraid my time is currently devoted to other issues related to the 2.0 release. If you are interested in working on the modification, let me know and I'll help you get set up to do that. |
Well I'm currently working on this and currently stuck at how I can reload tests with test parameters. If you can help me set up this, it would be great |
What have you done so far? Are you building TC from source? |
What I did so far is save the test parameters to a settings.settings file from test parameter dialog when user input test parameters so it is available there as well. Then I saved the test parameters to the Nunit30Settings.xml using the same way as how TC saves recent files to the Nunit30Settings.xml. Then added the test parameters to the model by reading it from Nunit30Settings.xml. |
Since the settings are global, the approach you're taking is only workable if you never work on any other projects. I think we want the settings to be saved for each individual package we load, similar to what we do for the visual state. Issue #3 is aimed at doing that. I think we need to take issue #3 and expand in more detail. I looked at your GitHub profile and I see you've done some open source contributing already. I'm looking for folks to join this project. If you're interested, lets start with this general problem. It's a fairly big one, but I think we can divide it into manageable pieces. It's getting a little late, but I'll look at #3 tomorrow and try to lay out some steps I think are needed. Where are you in the world? I'm near Seattle in the US and on Pacific Daylight Time. |
At the moment I need this for a requirement from my office and making it work for one project is enough for the moment. For that I used the same way TC reloads after adding test parameters using "ChangePackageSettingAndReload("TestParametersDictionary", value);". However I noticed that the commandhandler event is not invoking when I do that, the way it happens on save button click of the testParameterDialog. If I can solve it for now and make it work for the current requirement for my client, it will be great. I'm from Sri Lanka on India Standard Time (GMT +5.30) |
OK... if you need it soon then that's a good approach in the short term.
I'm still inviting you to volunteer on the project for a longer term fix.
:-)
I'm ready to sleep now, but I'll take a look at the CommandHandler tomorrow.
Charlie
…On Wed, May 12, 2021 at 10:20 PM Yashoda Chandrasekara < ***@***.***> wrote:
At the moment I need this for a requirement from my office and making it
work for one project is enough for the moment. For that I used the same way
TC reloads after adding test parameters using
"ChangePackageSettingAndReload("TestParametersDictionary", value);".
However I noticed that the commandhandler event is not invoking when I do
that, the way it happens on save button click of the testParameterDialog.
If I can solve it for now and make it work for the current requirement for
my client, it will be great.
I'm from Sri Lanka on India Standard Time (GMT +5.30)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#703 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUN7BMEXNVGGESOTQHHLBDTNNOQTANCNFSM433RKSYA>
.
|
Yes I'd love to contribute for the long term fix. Once I'm done with this I will join it. Yashoda |
Hi Yashoda, It looks to me like you ought to modify AppEntry.cs to add parameters to PackageOverrides if present in the settings. In that way, you are simulating the presence of a command-line option, which sets the parameters and the model will use the setting each time it creates a new TestPackage. In fact, an actual parameter isn't such a bad idea, since it would allow scripting execution of the GUI with various parameters. But just adding it for your own copy will work in the short term. Charlie |
Yes I did add the parameters to the PackageOverrides. But I havent thought about modifying the AppEntry.cs I will try that and see where it goes, since ChangePackageSettingAndReload("TestParametersDictionary", value) not properly loading the tests after checking testParameters. |
So the way I usually work these things is in a sequence...
1. Does the change happen correctly after I modify the dialog?
2. Does the change persist when I do subsequent runs?
3. Does the change persist when I do a reload?
4. Does the change persist after I close and restart the application.
It's rare that one of the higher numbered items works correctly unless all
the lower ones work first.
Where are you in that sequenc?
Charlie
…On Thu, May 13, 2021 at 7:50 PM Yashoda Chandrasekara < ***@***.***> wrote:
Yes I did add the parameters to the PackageOverrides. But I havent thought
about modifying the AppEntry.cs I will try that and see where it goes,
since ChangePackageSettingAndReload("TestParametersDictionary", value) not
properly loading the tests after checking testParameters.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#703 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUN7BPBUXW3EJN5Y2UL3K3TNSFY7ANCNFSM433RKSYA>
.
|
And, of course, changing AppEntry is intended to deal with the fourth step.
:-)
On Thu, May 13, 2021 at 8:44 PM Charlie Poole ***@***.***>
wrote:
… So the way I usually work these things is in a sequence...
1. Does the change happen correctly after I modify the dialog?
2. Does the change persist when I do subsequent runs?
3. Does the change persist when I do a reload?
4. Does the change persist after I close and restart the application.
It's rare that one of the higher numbered items works correctly unless all
the lower ones work first.
Where are you in that sequenc?
Charlie
On Thu, May 13, 2021 at 7:50 PM Yashoda Chandrasekara <
***@***.***> wrote:
> Yes I did add the parameters to the PackageOverrides. But I havent
> thought about modifying the AppEntry.cs I will try that and see where it
> goes, since ChangePackageSettingAndReload("TestParametersDictionary",
> value) not properly loading the tests after checking testParameters.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#703 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAUN7BPBUXW3EJN5Y2UL3K3TNSFY7ANCNFSM433RKSYA>
> .
>
|
Yes I'm in the 4th step but now I've realized that I'm adding the params to PackageOverrides at the wrong step of the initialization. It is too late when I do that. So I hope changing that will work. :) |
And at that point, you should do no more than add them just as is done for
the other command-line options... don't call ChangePackageSettingsAndReload
since nothing has been loaded as yet.
…On Thu, May 13, 2021 at 8:57 PM Yashoda Chandrasekara < ***@***.***> wrote:
Yes I'm in the 4th step but now I've realized that I'm adding the params
to PackageOverrides at the wrong step of the initialization. It is too late
when I do that. So I hope changing that will work. :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#703 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUN7BPXVWTCK54TBS3M3OTTNSNUBANCNFSM433RKSYA>
.
|
Hi Charlie, Well I did added the params to PackageOverrides when creating the model so it is available for the view. However the treeview is not created using that. Any tip on where I can create/recreate the treeview using the test parameters? |
I don't quite understand... How should the parameters impact the treeview?
…On Sun, May 16, 2021 at 10:37 PM Yashoda Chandrasekara < ***@***.***> wrote:
Hi Charlie,
Well I did added the params to PackageOverrides when creating the model so
it is available for the view. However the treeview is not created using
that. Any tip on where I can create/recreate the treeview using the test
parameters?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#703 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUN7BKCX2527YO55T4IHJLTOCTQXANCNFSM433RKSYA>
.
|
Hi Yashoda,
Do you remember I asked you what kind of parameters you were using? That
was because test run parameters, specified at the command line and
retrieved from the TestContext are completely different from method
parameters. But I didn't realize you are trying to use test run parameters
in order to set up run method parameters. This sets up a circularity that
can only work part of the time.
The reason is that TestRunParamters are available only after the test
starts to run. But the method parameters are created when the test is
discovered, long (I used to say, centuries in computer time) before the
test starts to run... before there is even a test, which could run. Of
course, the parameters could have been designed to work the way you are
using them... they just weren't!
Still, this may be able to work for you in limited conditions. My guess is
that you will have to always use the same names and only change the values
and you will have to reload the tests each time.
Can you send me a copy of AppEntry.cs as you have changed it? I'll take a
look tomorrow.
Charlie
On Wed, May 12, 2021 at 10:34 PM Charlie Poole ***@***.***>
wrote:
… OK... if you need it soon then that's a good approach in the short term.
I'm still inviting you to volunteer on the project for a longer term fix.
:-)
I'm ready to sleep now, but I'll take a look at the CommandHandler
tomorrow.
Charlie
On Wed, May 12, 2021 at 10:20 PM Yashoda Chandrasekara <
***@***.***> wrote:
> At the moment I need this for a requirement from my office and making it
> work for one project is enough for the moment. For that I used the same way
> TC reloads after adding test parameters using
> "ChangePackageSettingAndReload("TestParametersDictionary", value);".
> However I noticed that the commandhandler event is not invoking when I do
> that, the way it happens on save button click of the testParameterDialog.
> If I can solve it for now and make it work for the current requirement for
> my client, it will be great.
>
> I'm from Sri Lanka on India Standard Time (GMT +5.30)
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#703 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAUN7BMEXNVGGESOTQHHLBDTNNOQTANCNFSM433RKSYA>
> .
>
|
Hi Charlie, |
OK... let me know if you have more questions. |
Is there a way we can save the test parameter to have them even after closing and re-opening the exe, so that we do not need to enter test parameters every time we open the exe?
The text was updated successfully, but these errors were encountered: