Which methods in PropertyProvider are used during code generation? - visual-studio-2013

I have implemented a UITestPropertyProvider for my custom control following the steps here: http://msdn.microsoft.com/en-us/library/hh552522.aspx
When I use the Coded UI Test Builder I can see my custom properties on my custom controls and I can record steps that interact with the control and the code generates and playback works fine. But when I try to add an assert on any property--not just the custom properties added through PropertyProvider--when try to generate code for that I get an error that says "Cannot add the same member twice to a SerializationInfo object."
When I remove my custom property provider I can still record and playback clicks and stuff and I can assert on any property, but I cannot access my custom properties.
There's got to be something wrong with my PropertyProvider but I don't know what. Which methods of the PropertyProvider are being used during code generation?

Related

Implement setValue in PCF Custom Control

My custom control does not react to getAttribute("abc").setValue("123") from form js.
Do I have implement something in PCF Custom Control code?
Pls verify these.
Debug and see whether the updateView() in PCF index.ts is hitting, your control will be rendering there to get updated for any change in its property bag
Validate you have usage="bound" for the property in ControlManifest.Input.xml file

Simple Coded UI login test on remote server

I used Microsoft Test Manager to create a test for a log on page (not locally hosted) and recorded this. All steps were executed without errors.
Then I've created a Coded UI test project in Visual Studio 2013.
I added a Coded UI Test with the existing recording.
I ran the test and I got the message below:
"FailedToPerformActionOnHiddenControlException: Cannot perform 'SetProperty of Text with value " on the username field.
I received this message when using the existing recording, but also if I record using the recording function in Visual Studio.
Has someone got experience with Coded UI Tests and maybe give me an example as to how to set it up.
If I understand correctly, you're basically trying to have Coded UI input a value into an HtmlInput control that's a text box on a web page. The error message "FailedToPerformActionOnHiddenControlException: Cannot perform 'SetProperty of Text with value" normally means that the value you're trying to submit isn't able to be taken by the control, either because a value isn't accepted (example, numeric values in a name field) or because it's more characters than can be accepted by the field. It could also be that the recording isn't defining the object properly, and that the property Text isn't an option on the control that was found.
So, confirm these three things:
1. The control you're tying to send value to is actually an HtmlInput. You can't send the Text property to, for example, an `HtmlDiv`.
2. The value you're submitting is a valid value for your control (you're not trying to submit numbers, for example, into a field that won't accept them).
3. The value you're submitting is within the length limit for the field.
If I were a betting man, I would say that you probably don't have the object defined properly. Take a look at the SearchProperties of the control in question first and make sure that it matches the HTML on the page itself.
Do I need to set a standard environment for testing on an other server.
I develop the Coded UI test project in a workspace on a development environment, but I need the tests to be run on a acceptation environment (the recorded tests are executed on the acceptation environment).
I read it's easy to setup this environment though, but what is best practise?
Is it better to execute it on the same environment?
Here's a code snippet:
[TestMethod]
public void TestLogonToAccount()
{
// To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
this.UIMap.Enterusername();
this.UIMap.Enterpassword();
this.UIMap.Clickonlogin();
this.UIMap.ClickonCentral();
this.UIMap.Searchforemailaddress();
this.UIMap.Clickonlogin1();
}
I forgot an important part regarding the login recording test in MTM.
I just tried to play the steps again and got this error:
Playback of the selected sections of the action recording could not be completed The playback failed to find the control with the
given search properties. Additional Details: TechnologyName: 'MSAA'
Name: '' ClassName: 'MozillaWindowClass' ControlType: 'Window'

What does exposeBinding do?

I have been using bindings without having ever heard of exposeBinding.
Is it only intended to plug-ins ?
What does exposeBinding do ?
Expose bindings are nothing special, it is just normal binding what you see in the Xcode. But why its named is expose binding becuase when you do any binding in the interface builder. It causes second binding automatically in the interface builder which is called expose binding.
For your understanding i have attached the screen shot in which inside binding inspector i have just bind file owner to the hidden in Availablity section and then you can see below automatically it created hidden2 inside Availablity section below. This new binding hidden2 is called exposed binding. And also the used of these binding values are then used together in returning the final value of the binding. Please follow the attached screen shot:-
From the doc.
exposeBinding:
Exposes the specified binding, advertising its availability.

How can I validate custom dialog input in a .NET Installer class?

I have a VS 2010 Setup project.
In the setup project I have a custom dialog, and a custom action.
Both work, I can even debug my custom action and it receives correctly the input the user provides in the custom dialog.
I would like to validate user input and only allow user go to next step if the input is valid.
I can show a messagebox with MessageBox.Show, but how can I prevent to go to the next step until the user corrects the input?
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
string myInput = Context.Parameters["MY_INPUT"]; // Value from custom dialog
if (myInput ..... )
{
// Not a valid input, we do not want to proceed to the next step
MessageBox.Show("Not a valid input, please correct it");
// What to do here?
// How can I tell the Installer do not accept this input?
}
else
{
// Valid input...
}
}
Thx for answers
The simplest method of achieving this is set a property from your custom action and use that property to condition the NewDialog event that is called when the user press the "Next" button, so the event does not get executed if the condition is not true.
A .NET Installer class custom action cannot set the property directly from its code, but you could use your C# code to write another type of custom action that can get/set properties, as in this example: http://www.advancedinstaller.com/user-guide/qa-c-sharp-ca.html
EDIT: You can do that by editing the MSI generated from VS with Orca, however, this is quite painful I would say as you need to edit multiple tables manually, like Binary, CustomActions, ControlEvent. Here is something to get you started with that:http://support.microsoft.com/kb/255905
Another method would be to switch creating the setup package with a more advanced setup authoring tool. If you want to go with a free and powerful one I recommend WiX (http://wix.sourceforge.net/), it will take you some time to get started with it but its way faster than editing in Orca. The commercial alternative, which will allow you to edit your project even faster and much easier is Advanced Installer (http://www.advancedinstaller.com), but you will need an Enterprise license for what you require to accomplish.

Enum in custom web test validation rule

I'm building a Web Test using Microsoft VS2010.
I used the explanation on MSDN: How to: Create a Custom Validation Rule for a Web Performance Test.
In the example there using string and int as private members with public "get" and "set" those parameters valid for edit in the UI when I add this validation rule to my test.
I want to have an Enum with 3 option that when I add the validation rule to the UI I can choose from.
Is there a way to add an Enum variable which will also be valid in the UI ?
Are there any other types which can be used which will be valid in the UI ?
Unfortunately the UI only shows String and primitive-type properties in user-created rules/plugins. Yet some built-in rules/plugins use enums... how can this be? Thanks to the magic of the disassember and some detective work, we discover that it only accepts enums whose assembly name contains the string "Microsoft.VisualStudio.QualityTools.WebTestFramework".
So if you go to the trouble of compiling your enums (or indeed, your entire project) into an assembly called, for example, "MyEnums.Microsoft.VisualStudio.QualityTools.WebTestFramework", BOOM your enum-typed properties will happily appear in the editor UI.

Resources