I am doing on a project to built automatic GUI testing for graphical application in .NET. I will use C# but i am trying to reading to get some ideas. But I don't have any idea on how to record and replay back. So can you give me your ideas.
Here's a blog from the visual studio team that goes over this exact topic. It's about how they tested pre-wpf and post-wpf.
This post covers an overview of techniques that we used to create and maintain automated user interface regression tests for Visual Studio. Regression tests are a type of software test that, collectively, aim to be an oracle of expected functionality for the target application, run often against new builds of product – they aim to uncover regressions in behavior introduced in a new build.
Visual Studio Blog
Selenium RC!
There is also the TFS Test that has web tests, which tie into load test. Nice platform, but if you are not already using TFS then it is not worth it.
Frankly, I don't think there is a good answer out there for this. There are two options, however, that work okay:
Visual Studio Test Edition (as durilai suggested)
Telerik's Web Testing (both a free version and a version with a cost but depending on your UI, this may or may not work)
A good (commercial) C#-based product is Ranorex, it may do what you need.
Have you updated your Visual Studio to 2010 version? It has a build-in coded-ui automated testing feature, which could be used to record and replay back the test for win form.
Selenium
Watin
are some options that come to mind
To test C# apps there are a few things we have had success with:
PowerShell
TestPlant
and possibly would be the new VSTS 2010 features, though we haven't tried them
Related
I am currently looking into UI testing with alternatives for Selenium, recently i made the switch to VS2013 from VS2012 and the first thing i notice is that, the Coded UI Test project template is missing.
Anyone has a clue why this is missing and / or i need to install something in addition or if some workaround exists to make it available again?
Visual Studio 2013 Ultimate and Premium Editions have CodedUI test. See here for all the supported configuration details:
http://msdn.microsoft.com/en-us/library/dd380742.aspx
I am not sure if you can add it to Professional(I see no downloads listed for CUIT)
As Aniket mentioned, Coded UI is only available for the Ultimate and Premuim editions. There is also a Test pro edition that has a limited number of Testing tools. Some of them can be used to initially describe your tests and the later automate them with Coded UI.
The following links provides a feature comparison between the editions. Go to the Testing tools section, which specifies the availability of Coded UI in the specific editions:
http://www.visualstudio.com/en-US/products/compare-visual-studio-products-vs
I'm currently working on a large project, and am about to make some large changes, and was looking for a way to 'backup' my prior work. Is there built in functionality in Visual Studio to work with version control?
This project is developed only by me, and doesn't use Team Foundation Server (which is what most of my googling seems to give me answers on). Ideally, I would like to identify and restore all the different versions of my program as it evolves, without having to worry about totally messing something up...
Cheers and thanks in advance!
---EDIT---
With a version control system though, would that be stored on a seperate server? Or is it possible to store it locally? I'm more just concerned that I will just seriously mess up my code and not be able to undo it at some point...
There are several third-party source control integration tools, such as AnkhSVN or VisualSVN for SVN repositories (I use the former and can gladly recommend it). As far as "built-in", Visual Studio supports Team Foundation Server and Visual Source Safe out of the box, but those are both paid products and VSS should be avoided (in my opinion) for any new work.
Personally, I use TortiseSVN (for Windows integration) and AnkhSVN (for VS integration) with our SVN repository. There are free SVN servers as well, so you can get by with a very good solution while paying $0.
Well, there are a number of free source control alternatives out there and there are plug-ins (free ones) into Visual Studio that will allow you to hook right in. Take a look at those links and pick one that works for you!
Visual Studio has the ability to work with many source control providers. You simply have to hook them up.
Use "Tools->Options->Source Control->Plug-in Selection".
You may be able to use git with VS which means you don't need another dir/server etc for the repo. Consider Using Git with Visual Studio
TFS is really expensive, especially for just you. You can use VisualSVN.
it is a free download to us ANkhsvn. It is a plugin for visual studio that connects to various source control severs. You would first have to have a subversion server setup somewhere. Which is easy enough to do.
There is no built-in Version Control System in VS.NET, however, VS.NET supports multiple version control systems, like TFS, Visual Sourcesafe, SourceGear vault , etc...
As you state, you need a version control system. Look at this answer on selecting a Version Control System.
There are many version management systems. A lot of them are expensives, but... the are many others that are free! Take a look here:
http://producingoss.com/en/vc-systems.html
You can use SVN (Subversion) - one of the most used widely.
I'm looking for sample solution(s) that demonstrate various kinds of unit tests in C# using best practices. Also I require the examples to use the Visual Studio test tools. I know that there are a number of books and web sources on unit testing, but they don’t use the Visual Studio tools for writing their unit tests. I don’t want really basic examples such as can be found here. I am looking to move to the next level of unit-testing and I can’t find advanced examples of unit testing that use Visual Studio 2010 or even VS 2008.
EDIT: To be more clear; I am working on a project where I have to use the testing tools that are built in to Visual Studio. I am not looking for info on any 3rd party testing tools.
Visual Studio unit testing intro and TDD: Test-Driven Development with Visual Studio 2008 Unit Tests may be more to what you are wanting to find perhaps.
nUnit's adoption before Microsoft put built-in unit test support is my guess for why the built-in testing abilities are shunned to some extent. nAnt/nUnit and CI tools may be used outside of the Team System that has a substantial cost in some cases I'd think. Though for those open to 3rd party ideas, here are a couple of other examples:
Using NUnit in Visual Studio 2010 may be a blog example that shows you nUnit + VS2010 as it is possible to do that.
Easy Debugging of NUnit Tests from Visual Studio 2008 Professional would be an example for 2008.
By advanced do you mean things like Rhino Mocks?
Have you considered nUnit?, there are plenty of advanced testing examples if you take a poke around google.
Edit:
Just stumbled across another Unit Testing suite, MbUnit which seems to be aimed at more advanced testing.
The closest thing that I have found so far is the Enterprise Library; although it is not written as a unit test tutorial it does have a large number of unit tests and code written using best practices.
If no one else comes up with something better, I will mark this as the answer.
I come from a Java/Eclipse background and I fear that I am spoiled by how easy it is to get JUnit and JMock running in Eclipse, and have that GUI with the bar and pass/fail information pop up. It just works with no hassle.
I see a lot of great options for testing in C# with Visual Studio. NUnit looks really nice because it contains unit and mock testing all in one. The trouble is, I can't figure out how to get the IDE display my results. The NUnit documentation seems to show that it doesn't automatically show results through the VS IDE. I found http://testdriven.net/, which seems to trumpet that is makes VS display these stats and work with multiple frameworks, but it isn't open source.
Is there anyway to get unit and mock testing working with the VS IDE like it does in Java with Eclipse?
On installing NUnit you get an NUnit.exe - use this to open and run your tests. It has an UI and shows pass/fails and shows output.
You can add a build action in Visual Studio that on a specific testing configuration will build, then immediately invoke NUnit on that dll.
EDIT: (more details)
In test project:
Project Properties -> Debug (set a build configuration - I use "NUnitDebug")
Start Action -> "Start external program": C:\Program Files\NUnit 2.5.3\bin\net-2.0\nunit.exe (use your own path)
Start Options -> Command line arguments: MyTestProject.dll (replace with the name of your DLL)
EDIT2: As brendan said, Moq is a good mock framework that can be used.
Resharper will let you do this and has a nice UI. I believe the core of it is NUnit. For the mock stuff you'll want to use Moq.
Resharper is not free/open source but is so worth the price.
If you are looking for something like Eclipse/JUnit, you shouldn't have tried Microsoft product line.
But the good news is that SharpDevelop has such nice integration with NUnit and it is open source. However, it aims as an alternative to VS, not an addon for VS.
You could read ASP.NET MVC Test Framework Integration Walkthrough and run your tests from the VS test runner.
Have you tried using the Testing projects in Visual studio? They're practically identical to nUnit, and can be run simply by hitting F5.
For mocking, chose whichever suits you, We're looking at Moq for Silverlight support.
I'm developing an ASP.NET 2.0 app using Visual Studio 2008.
If I want to run a really quick test on a method that's way in my back-end, is there a way for me to just call a main function in that class via command line?
Thanks
Short answer: NUnit. You may not know how to use it, but you should. It's not hard to use and learn. It's fast and has a GUI.
That's what a test project is made for.
You should get TestDriven.NET add-in (free for personal use). Basically, it's a bundle of Test Driven Development tools such as NUnit, which integrates with your Visual Studio. One thing I discovered about it, is that it allows you to run any method in your code, just by right-clicking on it and choosing the menu item "Run Test(s)", or "Test With -> Debugger" if you want to debug the method.
Hope that helps.
The answer is no, You cannot do that. You can only have one main function per assembly.
The fact is, you shouldn't do testing like that. C# is not Java, regardless of its origin in Java.
Use NUnit or MSUnit and build unit tests instead. They'll test your methods for you without needing deployment to a website or anything like that. That's the best way to test a method. Here are some links:
NUnit
MSUnit
Simply create a test project and test it from there. If not you can create a console application and test it from there by referencing the proper project(considering your code to test is in an assembly), which in a way will be your test project.