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

Saving test parameters as a default parameter #703

Open
YashUoM opened this issue Apr 30, 2021 · 25 comments
Open

Saving test parameters as a default parameter #703

YashUoM opened this issue Apr 30, 2021 · 25 comments
Labels
Feature A new feature. Normal Priority Normal priority issue
Milestone

Comments

@YashUoM
Copy link
Contributor

YashUoM commented Apr 30, 2021

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?

@CharliePoole
Copy link
Contributor

Do you mean the parameters, which are available to your tests through TestContext?

@CharliePoole
Copy link
Contributor

@YashUoM Waiting for you to clarify. 😃

@CharliePoole CharliePoole added the Question User question label May 1, 2021
@YashUoM
Copy link
Contributor Author

YashUoM commented May 5, 2021

@CharliePoole Yes TestContext parameters. Sorry about the late clarification

@CharliePoole
Copy link
Contributor

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.

@CharliePoole CharliePoole added Feature A new feature. Normal Priority Normal priority issue and removed Question User question labels May 5, 2021
@CharliePoole CharliePoole added this to the 2.0.0 milestone May 5, 2021
@YashUoM
Copy link
Contributor Author

YashUoM commented May 13, 2021

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

@CharliePoole
Copy link
Contributor

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.

@YashUoM
Copy link
Contributor Author

YashUoM commented May 13, 2021

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

@CharliePoole
Copy link
Contributor

What have you done so far? Are you building TC from source?

@YashUoM
Copy link
Contributor Author

YashUoM commented May 13, 2021

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.
Yes I am building TC from source.

@CharliePoole
Copy link
Contributor

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.

@YashUoM
Copy link
Contributor Author

YashUoM commented May 13, 2021

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)

@CharliePoole
Copy link
Contributor

CharliePoole commented May 13, 2021 via email

@YashUoM
Copy link
Contributor Author

YashUoM commented May 13, 2021

Yes I'd love to contribute for the long term fix. Once I'm done with this I will join it.
Great. Hope to hear from you soon.

Yashoda

@CharliePoole
Copy link
Contributor

CharliePoole commented May 13, 2021

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

@YashUoM
Copy link
Contributor Author

YashUoM commented May 14, 2021

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.

@CharliePoole
Copy link
Contributor

CharliePoole commented May 14, 2021 via email

@CharliePoole
Copy link
Contributor

CharliePoole commented May 14, 2021 via email

@YashUoM
Copy link
Contributor Author

YashUoM commented May 14, 2021

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

@CharliePoole
Copy link
Contributor

CharliePoole commented May 14, 2021 via email

@YashUoM
Copy link
Contributor Author

YashUoM commented May 17, 2021

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?

@CharliePoole
Copy link
Contributor

CharliePoole commented May 17, 2021 via email

@YashUoM
Copy link
Contributor Author

YashUoM commented May 17, 2021

Well, what my test parameter does is get the list of reports which we test. So we need the test tree to be created with as in this image
tempsnip

This happens when I save test parameters through test parameter dialog. However I'm unable to create the test tree with the same value passed to the view. That's why I tried ChangePackageSettingsAndReload since Its how it happens when loaded via tests parameter dialog

@CharliePoole
Copy link
Contributor

CharliePoole commented May 17, 2021 via email

@YashUoM
Copy link
Contributor Author

YashUoM commented May 17, 2021

Hi Charlie,
We decided not to do this change. Thank you very much for you help. :)

@CharliePoole
Copy link
Contributor

OK... let me know if you have more questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature A new feature. Normal Priority Normal priority issue
Projects
None yet
Development

No branches or pull requests

2 participants