I'm working with the visual studio 2010 codedUI tests.
I want to be able to perform a little more than i can at the moment.
e.g. I can can Assert if a particular field "AreEqual" to or "Contains" etc, but i want to do more.
eg, i want to check if the field contains a numerical value within it.
I edited the UIMap.Designer.cs and was able to achieve what i wanted.
The only problem is is that this file gets overwritten when new test are added.
so my question is how can i "fiddle" with fields/stings in the UI and implement my own assertions on them?
Thanks
Use the partial class created (UIMap.cs) to add your custom code. This file doesn't get blown away and has full access to the internals of the UIMap (since it's part of it).
You can get it done dude, but be careful by keeping back up.
Open uitest file :
Go to test marker node that contains the relevant assertion,
Delete the method.
Save and find the stuff you expect
Its beeen working great for me but one two occasions I was dumbfound to face many issues with my acriipt running. So have back up and test this out.
I was told that the solution in "Coded UI" was to create your own libraries and then twitch your new test cases accordingly.
Haven't tried it, though.
Related
I'm new to Godot coming fresh from unity and I cant figure out how to duplicate an object/node. I've tried the duplicate function to no effect. My most recent attempts try to create child nodes with the same property as the parent. I cant seem to get anywhere, help would be appreciated. Here is my code that tries to create a child node:
Node copynode = new Node();
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
copynode = this;
for (int i = 0; i < 5; i++)
{
AddChild(copynode);
}
}
Also could someone tell me what the object/node/item in the scene is actually called and how to reference it? Is it a Node or a Gamedot.Object or something else? And how do I get and set its properties? I'm just really used to unity and cant figure this stuff out. The only tutorials I find are in the Godot language, and I kind of know c# already so I would prefer to program in that.
Nodes are references
I believe you expected Node to behave as a value type, but actually it is a reference. Let us over what happens:
Here you declare a variable of type Node, and initialize it to a new Node:
Node copynode = new Node();
And then here you overwrite it with the Node on which this script is being executed:
copynode = this;
And then you try to add the Node as child of itself five times:
AddChild(copynode);
Which, of course, does not work. And you do that five times.
Let us be glad this does not work. Because if it did, you have a Node that makes five copies of itself, which each also make five copies of themselves, and you can imagine how that goes. Which is why I will not give you some code to do it.
As you are aware there is a duplicate method. I suspect you expected it to add the duplicate to the scene tree. However it does not do that. Instead it returns the duplicate, and you have to add it (or do something else with it).
Your questions
Also could someone tell me what the object/node/item in the scene is actually called and how to reference it?
I'm not sure what you mean. However, if it helps, this will refer to the object on which the script is executing.
Is it a Node or a Gamedot.Object or something else?
The class Godot.Node inherits from Godot.Object. If you attached a script to a Node the class of your script must inherit form the type of the Node, which could be Godot.Node or a class that inherits from Godot.Node. I hope that helps.
And how do I get and set its properties?
You get and set them like any C# property. Although you should be able to use the Get and Set methods too, but that is intended for dynamic code.
If what you are looking for is how to make the properties available in the inspector panel, you do that by adding the [Export] attribute. For example:
[Export]
public float Speed;
And it should appear in the inspector panel when the object that has the script is selected.
The only tutorials I find are in the Godot language, and I kind of know c# already so I would prefer to program in that.
Most of the tutorials are in GDScript because:
There are two Godot builds. One with C# and one without it. But both can use GDScript. Thus GDScript is useful regardless of which build you are using.
Translating from GDScript to C# is not difficult. It is mostly the naming convention (and some edge cases, which you are probably not encounter when you are beginning). See C# API differences to GDScript.
The way C# is used with Godot follows C# conventions. I'd argue that it follows them closer than Unity. Although there are some rough edges when it comes to signals and async methods.
See the video Intro to C# in Godot 3.1: Your First Script (tutorial) by GDQuest.
I'll also recommend the underrated video Godot C# Delegate Tutorial.
And hare some YouTube channels have some C# Godot content that I've found: FinePointCGI, BurgZerg Arcade, Abdullah, BeIndie - Alan Thorn, Godot Academy.
Some advice for Unity developers arriving to Godot
Since you are familiar with C#, go ahead and use C#.
By the way my personal recommendation is to use an external editor (such as Visual Studio or Visual Studio Code, for which there are some good plugins for Godot) instead of using the integrated one. Because - even thought C# is fully supported - C# is poorly integrated with the editor.
Also be aware it is OK to use both C# and GDScript on the same project, or Godot visual scripting, or other languages that can be added to Godot (or even C++ if you really want to). How much C# you use is up to you.
Thus, you can use each language to their strength. For example you can use C# to get some extra performance compared to GDScript, and have access to all the .NET libraries and some modern language features. And use GDScript as glue with the rest of Godot (e.g. exporting variables and connecting singals, and calling into C#).
If you decide to combine GDScript and C# be aware the GDScript cannot properly consume C# async methods. My advice for that is to design around signals when they need to interact asynchronously.
Before you ask how to use components. There are multiple ways to build a component system on top of Godot, but it does not include one. And you probably don't need them. Most of what Unity does with components is done in Godot with Nodes instead.
Furthermore, coming from Unity, you might be expecting some distinction between "prefab", "scene" and "node". There isn't. An scene can have other scenes inside, and the scenes are nodes. And as I said, you will use nodes instead of components.
That does not mean that everything is nodes. You absolutely can make classes that are not nodes. It can be in particular useful to make resource classes, but that is its own topic.
Although, scenes are nodes, there is an slight distinction: a scene is a node that is serialized. Thus if you want to create a whole thing that can be instantiated multiple times, then you want to create a scene. And then you can add that scene as a node - which it is - inside of another scene. Similarly when you import model that you can place in a scene… the models are scenes.
There is an example of loading and instantiating a scene:
var scene = (PackedScene)ResourceLoader.Load("res://scenes/Scene.tscn");
Node scene_instance = ground.Instance();
AddChild(scene_instance);
I don't know if that is what you are trying to do with your code, but I figured I'd mention it, just in case.
Are you looking for an asset store. Godot does not have an asset store, because it sells you nothing. Instead it has an asset library, that you can access from the "AssetLib" button at the top of the editor. To reiterate, everything there is free, it sells you nothing. If you want some comercial assets, you will have to find them elsewhere.
Which reminds me, the preferred format for 3D models in Godot is GLTF (which is an open standard - not a proprietary format like some others).
Godot has a way
Some times when people go from one tool to another they try to stick to how they used the old tool. For an easy example, you don't need to make complex math to position an object relative to another, you just make it a child… But if you can't make it a child? There is RemoteTransform node that can do that. No code involved.
Godot is full of features hiding just below the surface, and there is value in discovering them. And if you are struggling with something, perhaps there is a Godot way. And if there isn't, it can be added.
I'll tell you one that is particularly powerful: the AnimationPlayer node can animate any exported property. In fact, it can call methods. It can also start animations in other AnimationPlayers.
By the way, it goes without saying, but: for whatever code you find online, try to understand the reasoning behind it. It will save you trouble when it does not work and you have to figure out how to fix it.
The base node class is invisible (gray) so you cannot see if they were added or not. You can switch from the local to the remote tab in the scene tree while running to see only one invisible node added.
If you change the code to AddChild(copynode).Duplicate(); you can see it adds all 5 invisible nodes.
I am here because I have a program and some features in my mind.
But I am not sure what these features are called in programming terms. So I am unable to even do a proper google search regarding the same. I am keen to identify what this is called, so I can progress my Analysis and Research.
I have developed a program, with C# and Windows Forms. Currently it interfaces with YouTube API and monitors the chat. I am also raising some events, when chat messages arrive and when the message follows a certain format/syntax. Everything is working fine so far.
What I want to do is:
If someone using my software, who has access to just the binaries. But want to write their own logic, which handles some of the events I am raising. How do they do that?
I want the user to write their own program/class, put it in a specific folder. I will expect it to have a Start() and End() method. Inside the methods, they can write the code to subscribe to any event of their choice and do what they need to.
I already have written code inside my main loop, which will loop through the folder which is supposed to contain the user programs, and tries to invoke the Start/End method of their programs/classes.
For me, as the original author of the project, I can just go ahead and start writing the code inside the folder. Once I build and execute. Everything works fine. The main program triggers the Start/End inside the program/class that I added. And the events are also handled fine.
But how about someone using my software, who wants to handle it's events, without having to re-compile my code. How do they do that?
You have the following options
Option 1
Create a template project with all required references and a code file (.cs) with the Start() / End() methods.
Add comments to the start() / end() methods or add a code sample of how they can work with the additional events.
The project should compile fine without any source code for your main project.
If you expect the users to use Visual Studio Code, give them instructions to compile using VS code.
If they are going to use any text editor, you need to provide them with a msbuild command line to compile their code.
Finally they can put the .cs code file in the specific folder along with your main project binary and try it out.
Option 2
The above option will work only if your users are also programmers.
If they are semi-techies, you could provide a simpler format for them to provide the additional events.
For example, create a json or xml format where they can specify the event name and how they want to handle it - either a script or choose from some options. For example -
{
"myevents": [
{
"event": "chatUpvote",
"handler": "ThankYouHandler"
},
{
"event": "chatDownvote",
"handler": "TellMeMoreHandler"
}]
}
TL;DR: How can I createTFS work items as a specific state?
I am trying to import our work items from our old system (Rational Team Concert). There aren't any suitable automagic tools, so I'm doing it manually. I exported everything I need into a neutral format and plan on importing them with a simple-ish C# program (Json data that has all the attributes from RTC). I've already decided how to map the info from RTC to TFS.
My problem is, how can I import TFS work items as a specific state? There is only one valid initial state. I'm not above programatically moving the state through the workflow, but that seems a bit crazy.
Thanks. I'm hoping I've missed something.
The TFS Integration Platform (which I don't recommend using) has an option called EnableBypassRuleDataSubmission (see here for more info: http://blogs.msdn.com/b/willy-peter_schaub/archive/2009/11/10/tfs-integration-platform-what-is-the-enablebypassruledatasubmission-in-the-configuration-file-question-answer-7.aspx)
This is what allows it to create WI's directly into the desired state. You should be able to use the same API's to do the same thing yourself. Note: TFS Integration Platform is Open Source I believe, so you can track down it's source and see exactly how it accomplishes it.
I've been wanting to create a simple text-manipulating extension for Visual Studio for a while, and now I've finally found some time to look into how extensions are written. What I have in mind could be accomplished through VBA macros, but I'd rather implement it as a "real" extension; as a learning process, and because I honestly can't stand VBA.
After a fair amount of googling, blog reading, digging into MSDN and browsing StackOverflow posts, I think I've gathered enough information that I can implement it - but I'd like some feedback on whether I'm approaching things right before I start hacking away :)
What I'd like is:
Registering Commands that users can bind hotkeys to via Tools->Options->Keyboard.
Modify the text buffer of the active window when Commands are invoked.
I don't really care about menus or toolbars, but know how to add it via .vsct files (are there better options?)
For #1, it seems I have to do a full VSPackage, .vsct file et cetera - there's no nice-and-easy MEF extension point I can handle instead? (Perhaps exporting a IWpfTextViewCreationListener and fiddling around with manual keyboard shortcut handling - but that'd be a major hack).
For #2, I'm unsure how to get an ITextBuffer for the active document. I could go through DTE.ActiveDocument, but I'm not sure how to obtain an ITextBuffer from that. Alternatively, I could do something along the lines of...
var txtMgr = (IVsTextManager)ServiceProvider.GetService(typeof(SVsTextManager));
IVsTextView textViewCurrent;
txtMgr.GetActiveView(true, null, out textView);
IWpfTextView wpfViewCurrent = AdaptersFactory.GetWpfTextView(textView);
ITextBuffer textCurrent = wpfViewCurrent.TextBuffer;
...but that sure does look like a roundabout way of doing things?
For both of these, take a look at the Align Assignments extension source. It's a package/MEF component that adds a command and handles it in the active window.
Your answer to #1 is correct. The best way to do commands is with a .vsct file, which requires a package. However, all a package means is that your project will be producing a dll with embedded resources (from the .vsct file) and a .pkgdef file, which adds registry keys according to the attributes you supply on your package. It (hopefully) isn't too much overhead.
For your second question, there is a cleaner way. Take a look at the command filter, which listens for commands in the active view, instead of listening for them globally and then finding the active view. It lets the shell handle the command routing and just concentrates on the implementation.
Not entirely sure what you mean by "the text buffer" but assuming you mean either the current text file that is open or the current selection, here is some code I have in a package to access those:
EnvDTE.DTE app = (EnvDTE.DTE)GetService(typeof(SDTE));
if (app.ActiveDocument != null && app.ActiveDocument.Type == "Text")
{
EnvDTE.TextDocument text = (EnvDTE.TextDocument)app.ActiveDocument.Object(String.Empty);
if (!text.Selection.IsEmpty)
{
//work with text.Selection.Text
}
}
Of course if you're doing an editor extension it would be different.
We have a pair of applications. One is written in C# and uses something like:
string s = "alpha\r\nbeta\r\ngamma\r\ndelta";
// Actually there's wrapper code here to make sure this works.
System.Windows.Forms.Clipboard.SetDataObject(s, true);
To put a list of items onto the clipboard. Another application (in WinBatch) then picks up the list using a ClipGet() function. (We use the clipboard functions to give people the option of editing the list in notepad or something, without having to actually cut-and-paste every time.)
In this particular environment, we have many users on one system via Citrix. Many using these pairs of programs.
Just one user is having the problem where the line delimiters in the text are getting switched from CRLF to LF somewhere between the SetDataObject() and the CLipGet(). I could explain this in a mixed Unix/Windows environment, but there is no Unix here. No unix-y utilities anywhere near this system either. Other users on the same server, no problems at all. It's like something in Windows/Citrix is being "helpful" when we really don't want it, but just for this one guy.
Ideas?
Have you tried clearing their profile on Citrix? That seems to be the solution to many many user specific Citrix problems.
Does Environment.NewLine behave differently on Citrix environments? If so, it may give you a good option that works for all users instead of \r\n.