I am using Visual Studio 2019, and the WinAppDriver to run Unit Tests on a simple WPF Application.
For that i use the Test Explorer integrated in VS.
Problem: When i run my test via Test Explorer it opens my desired window in the background (behind Visual Studio); then it performs the clicks` on the correct locations but the mouse is clicking in my Visual Studio and not on my desired application window because it wasn't brought to the front.
When i start the Test in Debug mode everything works fine. Window opens focused and in front. Clicks hit right buttons etc. So my Code can't be the issue?!
I tried waiting for it to be ready (Clickable) before clicking like that:
private void WaitFindClick(string id, string wpf_type)
{
var wait = new DefaultWait<WindowsDriver<WindowsElement>>(session);
wait.Timeout = TimeSpan.FromSeconds(5);
wait.PollingInterval = TimeSpan.FromMilliseconds(100);
wait.IgnoreExceptionTypes(typeof(InvalidOperationException));
wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath($"//{wpf_type}[#AutomationId=\"{id}\"]")));
session.FindElementByAccessibilityId(id).Click();
}
Summarising, Test Explorer works fine in Debug mode, but not in normal mode it opens the App correctly but doesn't bring it to front, so the Click will hit Visual Studio and not the desired App.
What is going wrong? How to fix Test Explorer to automatically bring the Test App to the front?
I hope i'm right here. This is my first question ever so if i missed sth please tell me.
Have a good day and thanks in advance!
EDIT:
I found a Workaround by setting the Window.Topmost = true; property in my MainWindow()-Constructor but its not really what i am looking for.
Related
I have VS 15.3.4 and ReSharper 2017.2.1
Whenever I try to run xunit test it shows after run "Inconclusive: Test not run" or "Aborted". Same tests run in VS TestExplorer just fine.
Start Visual Studio in logging mode:
devenv.exe /ReSharper.LogFile C:\temp\resharper.log /ReSharper.LogLevel Verbose
If your log file contains “System.FormatException: String was not recognized as a valid DateTime”, then you have to exit Visual Studio and to change Windows datetime format in control panel to US and try again. If tests run fine, then you can switch dateformat back.
This is kind of similar problem described here: https://resharper-support.jetbrains.com/hc/en-us/community/posts/206702965-Cannot-get-Resharper-to-work-with-VS-2015
Well some additional information would be great.
But I had this problem one time myself in a testclass with over 30,000 lines of code - so my solution was to "Disable Analysis" for this file.
You can do this by right clicking at the top of the scrollbar on the right.
There should be some Symbol, like a blue circle or a green button - if it´s disabled you see a circle with "II" in it.
Edit:
Make sure to have an open Test Session Window, because the "Run" symbols on the left side will disappear.
I am developing a Windows 8 metro app where the main screen just has a button. On clicking the button, the app navigates to another frame where all the work is done (which includes reading from files in local storage).
The app works perfectly when I hit run on local machine from Visual Studio 2013. However, if I try running it from the start menu, the main screen opens, but clicking the start button does not cause the app to navigate to the 2nd frame.
*This app was working fine (even when I ran it from start menu) for the last month. I changed some code (things that happen in the 2nd frame and should not affect main screen) and now I am having this issue.
*I am pretty sure that clicking the 'start' button causes the code on the 2nd frame to run,even though it appears to do nothing. I suspect this because if the file that is to be read in the 2nd frame is not in the directory, the app crashes.
I would greatly appreciate any help. I am pretty new to this and am not even sure how to debug an application that's not being run from an IDE.
Is there a possibility to start/stop the visual studio (Professional 2012+) profiler from code? I know you can start it paused, but to start the profiling, you have to click on a button in the visual studio.
In my case, I would like to start it when clicking on a button in my application, which switches to a new view, and automatically stop it when the UI was loaded. I would like to see why there is such a large delay until the UI shows up.
I've not used it before, but it seems you're looking for Profiling API.
DataCollection.StartProfile and DataCollection.StopProfile looks like the methods you're interested in.
I'm new to Visual Studio, I just started using it for my programming class. I downloaded C# 2010 from the website, and every time I try to debug the code the form window doesn't show up as the black box with the output, rather it displays a blank gray box. I have no clue how to check my code, I haven't been able to find anyone else with this problem, someone please help!
As you are assuming a black box - mean you want to start with a Console Application
and your are getting a gray box - mean you had chosen the Windows Form Application.
So What to do you is :
Select a Console Application.
Like File -> New -> Project -> Console Application.
Put breakpoints on your code. and press F5 to run your application in debug mode.
Put a debug point in the code on the left side where you have a empty column.. Then click F5 to run the code with debugging.. It will stop when the break point is hit..
Check this tutorial
Are you sure you have the solution configuration set to Debug ? Or is it Release? Read this for details.
I have both the VB and C# versions of Visual Studio 2008 Express. When I run a console application in either version, instead of the console opening in an old DOS style command window like it does in VS 2005, it actually blacks out both monitors attached to my computer and treats the entire screen real estate as the console.
Anyone know how to get the app to run in a small command-type window when I run it?
Update:
It's like the console is running Full Screen. If I set a break point, switch from the IDE t the console and then hit Alt+Enter it switches to the small window that I want, but I still can't figure out how to make the app start with the console that way.
I could post a screenshot but it would look like a big black square...no window, no frame, just the inky blackness of frustration.
Try this: Press your windows key + R to open a Run dialog. Type cmd and hit enter. This will open a command prompt. If it opens maximized, then un-maximize ("restore") it. Then close it. Now see if it starts maximized.
I think it's due to Windows saving the default size and placement of windows, and hopefully this will reset the default.
-Edit- Okay try this then: CMD Full Screen Visual Studio
Try pressing Alt+Enter to get out of full screen mode.