Ran into a problem recently with VS/MSTest and wondering if anyone has had a similar issue.
I'm currently working on a UI framework in c# using MSTest and over the past few weeks I've been implementing selenium grid/Jenkins for CI.
Selenium grid facilitates parallel test running but the running is done by MSTest. in the past few weeks parallel test running with VS has stopped working.
No changes have been made to how the tests are structured or created but when multiple driver instances are created Driver A works until Driver B is created then Driver B runs while Driver A stops executing steps.
I'm beginning to think it's a bug with WebDriver or MSTest itself as it's weird for something that was working to stop working without any code changes. Wondering if anyone else has had similar problems.
It had been working for me for months and I had found some issues by running in parallel so it's strange that it has suddenly stopped working with no changes. It was last working around 2 months ago.
I tried changing every static method/variable in the solution to not being static as I've read statics can cause problems but it didn't help.
setup is
Unit Test solution using Seleno (Webdriver Nuget Package)
Tests written as unit tests using in MSTest. Page Object approach.
Driver:Chromedriver 2.33
Chrome version: Version 62.0.3202.75 (Official Build) (64-bit)
Parallel test running enabled using a .Testsettings file in the solution
same thing happening with latest version of IE/IEDriverServer which makes me think it may be WebDriver that is an issue.
Any help or thoughts would be much appreciated.
Thanks,
G
I'm having exactly the same issue. In my case, it's the first time I implement Selenium grid and try to run tests in parallel. They run sequentially.
I've found this:
http://colinsalmcorner.com/post/parallel-testing-in-a-selenium-grid-with-vsts
Apparently the only way to solve it is putting tests in separate .csproj files, or maybe running multiple mstest processes with appropriate list of tests as arguments on each one (with some utility you can create). Please keep me posted.
The issue here ended up being the javascript executor had been made static to add a feature one of the in house teams wanted. Every time a new instance was opened the executor was assigned a new value and inputs happened only in the console of this window.
Implemented feature in a way that didn't require executor to be static and all worked well
Related
I would like to say thanks to everyone here ,because i am learning many things from stackoverflow...every time i am living with new energy ..its all here.
yes of course ,i need oxygen to breath again...all helping hands i want ...may be my questions are silly but really day to day am brushing and growing as kid of stackoverflow school.
i have little knowledge on working with c# project and unit test(Nunit/xunit)..where i use Nunit test to debug my code which i have written in c# project.
now i got a new challenge to do WCF service automation in BDD approach using specflow.
i tried by adding spec-flow features and steps for couple of scenarios into Nunit unit test project and was able to run and identified tests.
where as if i create same set of features and steps ,not identified any test and not run anything .even not recognized [Test] or [TestFixture].
let me explain what i have in mind, i want create all spec-flow features and steps in c# project and should be run this solution through nunit.exe/console by passing "REGRESSION" or "SMOKE" tests(by configuring environment details) in command prompt.
and for debugging purpose i want call these spec-flow features (in c# project) from my unit test project...is this approach possible?
if possible ,please let me know with few sample and possible explanation/details to implement.
Issue: 1. I am not able to run any Spec-flow feature from c# project (since not test is identified)
2. Don't know how to call feature from unit test to do debug or to test my code before i integrate to team-city.
please consider all these my basic doubts and make me to learn.
Thanks In Advance,
In regards to your issue 1 and 2, I guess you are not able to see features in runlist and hence not able to execute.
if you are not able to discover specflow features in run list. You can try installing "Specflow for Visual Studio 2013" in extensions and updates. Please note this is in addition to "Specflow" package that you might have installed.
You will see such features that can be added and you will have to add steps implementation. Its not related or part of Unit tests.
I'm currently using Selenium Webdriver with C#. I've successfully executed my test in remote webdriver as well using selenium GRID.
I just configured 5 instances of FF, Chrome and IE in my Grid settings and when I ran my test project on chrome browser, I noticed that just only one instance of chrome is picked. Is this the expected behavior? I was initially in an assumption that the number of tests in a single project will be distributed across multiple browser instances based on the maxinstance and maxsessions. But not sure why it is using just one browser instance for the whole project. Please do let me know if I need to do anything to use more than one browser instance to share/run the test.
Unfortunately the standard NUnit runner doesn't support parallelization out of the box.
There are a few alternative unit testing frameworks that you might want to look into that do support parallelized runs like MbUnit or PnUnit.
One workaround is to split up your test. Some common ways are by DLL, namespace, test name, or category. You could then run your NUnit test in parallel using a MSBuild script.
The final command would look something like this c:\proj> msbuild /m:8 RunTests.xml
Check out the answers to this question for more details: How can I run NUnit tests in parallel?
as posted here:
http://connect.microsoft.com/VisualStudio/feedback/details/748493/missing-funtionality-of-creating-a-new-unit-test-from-editor
there is no automatic way to add UT to existing code
Posted by doronneu on 6/14/2012 at 4:53 AM So How do I add new tests
to an existing testing project without coding them manually? Posted by
Microsoft on 6/14/2012 at 4:48 AM Hi,
.
The Test-> New Test menu was intentionally removed. In Visual Studio
2012, we have rearchitected the Unit Test framework to make it more
extensible. Thus we have adapters for nUnit/xUnit etc built already
along with the in-box mstest.
The 'New Test' menu does not have any extension points where 3rd party
adapters can plug-in. Therefore we decided to remove it. We moved all
the New Test Project types into the File -> New -> Project dialog.
Is there any workarround (resharper?) that enable adding UT to existing methods?
The best workaround I've found for Unit Testing in VS2012 is to go back to VS2010!
They are generally project-compatible, so jumping back and forth between the two versions of VS generally works very well (for C# projects).
The unit testing support in VS2012 has been butchered and is totally unfinished - how it was released in this terrible state is beyond me. (given how much we pay per licence, it's outrageous!) In 2010 you could easily get it to create all the boilerplate code you needed for a unit test, but that has all gone from 2012. In 2010 you could run your tests and see the progress. Gone, all gone - in 2012 you have no idea what is happening (if anything). In 2010 you would get results from the test run and have some idea of what happened. In 2012 it gives you an incomplete list of lies and then you check in your "passing" code and start swearing when your build server falls over with many failed tests that 2012 just swept under the carpet. In conclusion: my opinion is simply "Don't do unit testing in 2012, use 2010".
Hopefully VS 2013 is not long off, and they will have had a chance to implement unit testing support in it.
Now that I re-read your question and looked at the "MS Issue Post" it does look like they've moved the standard menu layout a bit. Also according to it there is no workaround and you need to contact MS support site regarding this.
However, there is enough information here to install a NUnit and start writing your tests. This still does not mean automatic though.
Currently using VS2010 Ultimate. In a prior version of VS there was a utility that you could use to test methods while you were coding (Some sort of test bench, I think). The benefit of this, was in the case of a large web app, you didn't need to spin up and wait for the entire application to be ready before testing your method.
What sorts of tests / jigs do you use to test static and instance methods in your apps w/o firing up the entire application?
LINQPad works great for running small bits of code.
Using the MSTest Project and have it reference your app you are trying to test.
VS2010 comes with a system that allow you made unit tests... and let you run each tests individually if you want. You may be interested in this channel9 video about unit testing with vs2010: http://channel9.msdn.com/blogs/visualstudio/test-driven-development-with-visual-studio-2010
I think the question here is how to start your method from anywhere, to have an entry point to quickly test something.
If I remember correctly, TestDriven.Net allowed you to do this.
I am trying to automatically open an NDepend Project when the Solution builds in an automated build in TFS2010.
This stems from this previous question. The aforementioned post is where I tried (and failed) to integrate NDepend's code metrics software with an automated Team Build via messing with the XML of my solution.
I decided since I wasn't getting anywhere in messing with the XML, that I would try a different route. In another program I have developed, I used
System.Diagnostics.Process.Start("blah.txt");
to trigger Notepad to run and open the text file "blah.txt."
I figured I could use the same concept to possibly help me with this NDepend integration. So I researched MSDN to see if I can find out more about the Process.Start method. And using this example
Process.Start("IExplore.exe", "C:\\myPath\\myFile.htm");
I substituted in my own paths to what I believe should open the project file "myProj.ndproj" inside the VisualNDepend application like this
System.Diagnostics.Process.Start("C:\\tools\\NDepend\\VisualNDepend","C:\\myProj\\myProj.ndproj");
I may be taking that example and tweaking it out of context, I'm not sure, but it seemed to me that what I tried should work. The solution built fine without any errors, but VisualNDepend didn't run.
It finally hit me that I was trying to use this code that would only execute when the program ran when I really need it to execute when the program builds within TFS and Visual Studio.
I asked my coworkers if they knew of any built-in ways within TFS or VS that would recognize whether or not the solution was being built or not. And they didn't really know of anything in particular. I tried "Googling" this topic and couldn't find any information that was useful to me.
Does anyone know of how to accomplish this? Or am I chasing a lost cause by trying to execute some C# code behind the solution? In which case, is my best bet trying to tweak the XML like I had previously been attempting?
I would recommend writing a custom build task (or tasks). You can essentially make the task do anything you'd like -- run a process, spit out results, etc., and it can be invoked directly from your MSBuild script.
I'm not sure if I'm answering your question (or if I even have a grasp on what you're trying to do), but that's probably the area I'd be looking to find my solution.