One of my colleague working in java write test cases for his development. As he rebuild, all his testcases will execute on his code and result either fail or passed.
I am workin in .NET, I would like to do similar approach for my application (TDD). Which will perform this automated testing of my code.
What is best approach for writing test cases for window service. We have VS2010 testing, Nunit and CSUnit?
Can anyone give examples for it as I never done this before?
I am fetching some WMI data in service and performing some rest calls, what would be testcases for such operations?
Thanks
There is a lot of discussion on the web concerning unit test frameworks. It seems that it's matter of personal taste and what you need to get done. The functionality between the frameworks is usually very similar. Here are a couple of links about comparing available unit test frameworks.
Unit Testing Frameworks - What are the key features
.NET Unit Testing packages?
NUnit vs Visual Studio 2008's Test Projects for Unit Testing?
Personally i recommend NUnit. It has been around for a long time and it's very mature. And it's free! You can find detailed documentation on the project's homepage. Here is a quick start article.
It's probably not a good idea to test against the running windows service, because that would be an integration test ... That includes: Does the service run with the right permissions, is the deployment complete etc.
It's better to test the functionality of your windows service classes directly by referencing the DLLs from your testing framework.
Therefore it doesn't matter if you use NUnit, Visual Studio Testing or what ever. That depends on your favors.
Related
I would like to perform automated unit tests on my web-api project after publish it on IIS but I don't know how ? I can launch tests in Visual Studio, no problem for that.
I have some unit tests in a different project, must I generate the unit tests project an deploy it in the api-web site, and use another soft to perform tests ?
Thanks for your response.
Firstly, what you are proposing here does not sound like Unit tests. They are integration tests that test the entire integration and end to end working across application layers.
Regarding the automated execution, you can easily set that up using CI/CD. You can use VSTS or TeamCity like solutions to run your test cases at a particular schedule. Or, you can run your tests using command line from a system, that has Visual Studio installed.
How to import my test files into the NUnit-GUI? When I open my myfile.csproj the run state is Not Runnable.
You don't say, but it sounds as if you are talking about the new NUnit GUI that is under development at https://github.com/NUnitSoftware/nunit-gui
The GUI depends on the nunit engine to load and run tests. The bare engine does not support loading project files but requires installation of an extension in order to do so. In the case of console execution, there are packages that bundle some of the extensions and you may be familiar with that.
For the GUI there is no such easy way to install extensions yet but it is under development. Bear in mind that the NUnit 3 GUI is software under development in a pre-alpha stage.
Hopefully, this helps you, even though it's not a very positive answer.
I want to perform automated test with Selenium,Nunit,TFS and MTM.
As i'm trying to find a way to run my selenium code using Nunit with MTM, i've searched alot regarding this but didn't find required solution as most of the people gave solution using MStest not with nunit after this i want to see my test case result on MTM.
Answer will be highly appreciated.
Based on my experience (lots of trial and error), you can only Associate Automation with an MSTest Test Method, to test cases in MTM.
A solution I've used with Selenium, NUnit and TFS is to use the VNext builds to run my tests, and use the build status to track the test results (including widgets on the dashboard).
I'm trying to figure out how to make it work. The documentation is slim to say the least on this important topic.
The small amount of tutorials I found make reference to options not even present when I open the tool. I don't see the Unit Test Runner, just the Integration Test runner. (version 5.3.1f1)
How to add a test? How to run it?
Integration Test runner allows you to add a test, but I was unable to find how to write the actual test.
It's sad that there's almost no documentation on this anywhere, or at least I haven't found it.
The Unity Test Tools are already included in Unity starting with Version 5.3. Even without downloading the Unity Test Tools from the Asset Store you should be able to find the "Editor Test Runner" in the Window menu. This is basically the Unit Test runner. For other features such as Assertions, Integration tests etc. you still need the Unity Test Tools bundle from the Asset Store.
The test tools use NUnit internally, so you can write tests using the standard NUnit API as described here http://www.nunit.org/index.php?p=quickStart&r=2.6.3.
There is also a Unity tutorial video here: https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/test-tools.
Make sure to put your Tests into an Editor folder.
Also note that some features like Assertions are not supported for Windows Store Apps and you won't even be able to build for this platform as long as you have those libraries in your project.
In Visual Studio Team Edition there is a load test tool where you can select unit tests, integration tests etc... to form scenarios which are then used in a load test session with different configurations for example varying usage levels.
Looking at for example the NUnit framework, it would be possible to develop a form of such a tool, along with a base load testing code base, but I was interested if anyone knows of any open source project which has has already done a similar thing which could then be of use for this situation and possibly extended?
Cheers for now,
Andrew
Does this help?
http://www.webload.org/
It's only a load tester, not also built with Unit Tests, Integration Tests, etc - However how about a Continuous Integration setup with CruiseControl.NET as your CI Server which would run automated builds and carry out the tests and then use Webload for your load testing? You can certainly get CruiseControl.NET to run external tools - but IDK whether or not Webload has a console which could automatically run the load tests for you - but it probably could ;)