Difference Between NUnit Testing And Unit Testing In VSTS?
Aug 25, 2009
I use VS team system 2008. At the moment i need to test some business classes, i have found two kinds testing NUnit and the unit testing provided by the VS team system. what are there differences?
View 1 Replies
ADVERTISEMENT
May 15, 2009
I'm looking into adding some unit tests for some classes in my data access layer and I'm looking at an update routine that has no return value.It simply updates a row based on the id you provide at whichever column name you provide.Inside of this method, we collect the parameters and pass them to a helper routine which calls the stored procedure to update the table.Is there a recommended approach for how to do unit testing in such a scenario?
View 4 Replies
May 13, 2010
I'm building an Active Directory wrapper in VBNET 2.0 (can't use later .NET) in which I have the following:
IUtilisateur
IGroupe
IUniteOrganisation
These interfaces are implemented in internal classes (Friend in VBNET), so that I want to implement a façade in order to instiate each of the interfaces with their internal classes. This will allow the architecture a better flexibility, etc.Now, I want to test these classes (Utilisateur, Groupe, UniteOrganisation) in a different project within the same solution. However, these classes are internal. I would like to be able to instantiate them without going through my façade, but only for these tests, nothing more.
[Code]...
View 1 Replies
Oct 18, 2011
I am retrofitting unit testing into a fairly complex system designed and written by other developers in VB.net. I am trying to develop unit tests for the GUI forms using NUnit and the NUnit Forms extension. (I've been looking at c# examples that are fairly easy to port over if you have a solution but don't know VB syntax as long as it uses NUnit classes)
I will try and explain what I am doing but first a brief description of the program. It basically monitors server activity. You need to connect to a server via a modal form with IP and Port fields(amongst others). Once you have connected to a server other parts of the program unlock and become usable (such as configuration of the server).
Desired process: Load program > click connect button > modal connect form loads > enter details > click OK to connect > main form updates to logged-in state > other functionality
The problem is that I cannot test the functionality of the connect form and then the logged-in functionality of the program. I can test that it loads the modal connect form correctly; enters the details and clicks OK (all fine so-far) but it does not appear to logically progress the program. The modal form just closes again seemingly without running the connect code from the program back-end and I'm back at the main menu not logged in to anything.
I have a feeling that I've either missed something really obvious or that it's simply not doable in NUnit.I have trawled the internet in search of anything similar but the closest was another SO thread that was really generic. Without being able to actually test the logged-in version of the program, I'm at a major hurdle.Another issue is handling message boxes that don't have unique identifiers (e.g. "are you sure you want to exit?"); these also seem to be a major pain in the arse with NUnit (If it makes any difference, I'm running the tests as a stand-alone project using a reference to the executable file of the built project, not the actual source)
View 2 Replies
Jun 10, 2012
I am retrofitting unit testing into a fairly complex system designed and written by other developers in VB.net. I am trying to develop unit tests for the GUI forms using NUnit and the NUnit Forms extension. (I've been looking at c# examples that are fairly easy to port over if you have a solution but don't know VB syntax as long as it uses NUnit classes)I will try and explain what I am doing but first a brief description of the program. It basically monitors server activity. You need to connect to a server via a modal form with IP and Port fields(amongst others). Once you have connected to a server other parts of the program unlock and become usable (such as configuration of the server).Desired process: Load program > click connect button > modal connect form loads > enter details > click OK to connect > main form updates to logged-in state > other functionality
The problem is that I cannot test the functionality of the connect form and then the logged-in functionality of the program. I can test that it loads the modal connect form correctly; enters the details and clicks OK (all fine so-far) but it does not appear to logically progress the program. The modal form just closes again seemingly without running the connect code from the program back-end and I'm back at the main menu not logged in to anything. I have a feeling that I've either missed something really obvious or that it's simply not doable in NUnit. I have trawled the internet in search of anything similar but the closest was another SO thread that was really generic. Without being able to actually test the logged-in version of the program, I'm at a major hurdle.Another issue is handling message boxes that don't have unique identifiers (e.g. "are you sure you want to exit?"); these also seem to be a major pain in the arse with NUnit(If it makes any difference, I'm running the tests as a stand-alone project using a reference to the executable file of the built project, not the actual source)
View 1 Replies
Mar 1, 2012
I'm working with .NET 3.5 and Nunit 2.5.10. I'm attempting to write some tests to validate our role-based security enforcement through the PrincipalPermissionAttribute at a class-level. The test appears to succeed (it gets a green checkmark) and the Assert.Throws call properly catches the exception, and all my other assertions about the exception pass. However, once TearDown is complete after a test has run, the exception is re-thrown by NUnit. So even though the test "passed", every one of the tests shows that an exception was unhandled exception was thrown 'while executing' the test run.
I'm guessing I'm doing something wrong, but can't figure it out. My test is:
Public Sub New_TheForm_NoRoles_DeniesAccess()
' attempt to create a new instance of the form, but it should throw an exception with an inner SecurityException
Dim ex As TypeInitializationException = Assert.Throws(Of
[Code]....
Basically, Initialize is normally called in the application with Nothing so that we use the Windows Principal. During unit testing, we instead initialize it with a GenericPrincipal that has no roles, so that we can test that a SecurityException is thrown.
The tests are passing, but NUnit just seems to be re-throwing the exception post-Teardown.
View 2 Replies
May 20, 2011
I have written my and in a test class for vb.net and it works as follows:
A stored procedure is executed and the result is saved in an xml file with the help of a dataset. What I need to do now is , Information of this dataset should also be redirected to a textbox in a form so that I can copy this information in clipboard and create dynamic assert statements for instance I want
datatable.rows.count,
datatable.columns.count,
datatable.columns(i).ColumnName,
and same to get columnType. All of this info would be shown in the form but I am unable to open a form in NUnit test class.
View 2 Replies
Dec 29, 2010
I have been assigned a task of exploring unit testing using tools available in the market.My question is how do i write an API that would help in writing unit test cases.Example i can use nunit to write something like this to check whether file exists in the given location.
<Test()> _
Public Sub CheckOutputFileInfo()
ReportPath = "D:temp est.txt"
[code].....
View 3 Replies
Aug 29, 2009
In the project that i;m currently working on i;m not allowed to touch GUI for anyreason that includes program testing. I'm in bit of s frustration becuase prior to this all must application were developed and tested using GUI. Typicvally it wold take a me a week to develop an app now it taking more than that. Especially the TDD with Unit testing. The documentation kills more time too......
View 4 Replies
Apr 28, 2009
I really like the moq mocking framework. I've used it on several projects. Unfortunately, one of my customers is demanding we use VB.Net. Not my preference, but hey, .Net is .Net, right?I've heard that moq has some trouble with VB. Is this true? Is so, what sorts of trouble? I would expect it to work fine given the language agnostic nature of .Net.
Should I look into using some other mocking framework for use with VB?
View 2 Replies
Sep 1, 2011
I have a unit test project and a project A that refers to the dll B. When make changes to the dll B and build my solution again I get an error meassage: could not load dll B or one of it's dependencies when i try to run the test project. The dll B does not exists in the references of the test project.
View 11 Replies
Sep 18, 2011
Doing some homework on unit testing and in all honestly i just don't get why i get this error.
i got a simple method that select all text when tab and testing if the actually textbox1 is selected. I just don't get why i'm getting a nullReferenceException at target.txtbox1_Enter(sender, e)
Private Sub txtbox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtbox1.enter
Dim txtBox As TextBox
[Code].....
View 1 Replies
Apr 1, 2011
I'm wanting to create a load of unit tests to make sure my stored procedures are working, but i'm failing (i'm new to tests in visual studio).Basically I want to do the following:
<testclass()>
Dim myglobalvariable as integer
<testmethod()>
[code]....
The problem is because the tests don't run sequentially, tests 2 and 3 fail because the global variable isn't set.
View 4 Replies
May 4, 2009
Can anyone point me towards a complete scenario using MSTest,vb.net, with or without mocks,MVP (supervising controller)
View 1 Replies
Jul 21, 2009
I am trying to unit test a controller action that uses the membership provider to update user details. I am using Moq which so far has been easy to use. The problem is I can't seem to get it to mock calls to methods that don't return anything.
[Code].....
View 4 Replies
Jun 5, 2009
I have a lump of code that looks a bit like this:
If mode = DiaryMode.Admin Then
modeObject = DBNull.Value
ElseIf mode = DiaryMode.Academy Then
modeObject = ApplicationSettings.Academy
ElseIf mode = DiaryMode.Scouting Then
modeObject = ApplicationSettings.Scouting
Else
Throw New NotSupportedException()
End If
The idea of the check is to prep some values for passing into a database call. There are two questions, is the Else worth the effort? The intention is to prevent future extensions of the enum causing the code to return squify results. If the code is valid, I'd like to be able to unit test the behaviour, if it's worth having it's worth testing. How might I go about doing that?
View 3 Replies
Nov 19, 2010
What are some easy and simple unit testing frameworks to use with Visual Studio 2010 Express vb.net?
Are there any good tutorials geared towards this?
View 2 Replies
Jun 16, 2010
I am porting over some C++ assembly to VB that performs demodulation of various waveforms.I decided to go the unit test route instead of building a test app to get a feel for how testing is performed.The original demodulation code accepts an array that is the waveform along with some other arguments. How should one go about performing a test on something that has an array as an argument? Is it acceptable to generate fake data in a file and read it in at the beginning of the test?
On a side note - The original C++ code was written because we were performing math that we couldn't do in VB6 so we had to cross boundaries between C++ and VB6 and arrays were used. Is there a "better" way of handling large amounts of data in the .NET world that us VB6 programmers may not yet be privy to? Or if we aren't crossing that managed/un-managed boundary, should we be representing our data as objects instead?
View 2 Replies
Jun 24, 2009
I downloaded nUnit and TestDriven.net. I have a legacy Web Site application and I would like to implement some unit testing. I created a class in the app_code folder and added Imports NUnit.Framework etc... After writing a basic test, I get the "Can't execute tests in 'Web Site' application." error. I guess the Web Site project is not supported. Converting to a Web Application is not an option at this time. I have Visual Studio Test Edition, so I tried that route. I created a test project, wrote a couple tests in my test class etc... only to find out I cannot reference the classes in the app_code folder of the Web Site project.
View 2 Replies
Oct 5, 2011
Was wondering how you do this?As it's very annoying to click "ok" everytime a message box pops up.
View 2 Replies
May 20, 2010
I have been reading some articles on unit testing but I still have some questions.
- What should be tested if we want to test if an entity can be saved or not?
- Should we test each and every property of the entity?
- If I have a solution consisting or 3 projects, will the unit test go become the 4th project?
View 2 Replies
Feb 19, 2009
I'm running some unit tests for a large VB.Net application I help maintain and am running into problems with tests timing out. The test run is set up so that there's no timeout limit on the overall test run, but a limit of 2 minutes per individual test. However, a couple of the tests take a lot longer than this to run, so we tried adding the timeout attribute to the test's declaration, i.e
<TestMethod(), Timeout(15 * 60 * 1000)> Public Sub DoSomething()
for a 15 minute timeout. However, the 2 minute timeout set in the test run properties seems to be taking precedence, even though it says that the timeout attribute should override it.
View 1 Replies
Aug 10, 2010
Unit test method that has Public Read Only property, how do I set the public read only property?target.MyReadOnlyProperty = MyObject
View 1 Replies
May 13, 2010
In my most recent question: Unit Testing Best Practice? / C# InternalsVisibleTo() attribute for VBNET 2.0 while testing?, I was asking about InternalsVisibleToAttribute.I have read the documentation on how to use it, and everything is fine and understood. However,I can't instantiate my class Groupe from my Testing project.I want to be able to instantiate my internal class in my wrapper assembly, from my testing assembly.
EDIT #1
Here's the compile-time error I get when I do try to instantiate my type:
Erreur 2 'Carra.Exemples.Blocs.ActiveDirectory.Groupe' n'est pas accessible dans ce contexte, car il est 'Private'. C:OpenProjectsExemplesSrcCarra.Exemples.Blocs.ActiveDirectoryCarra.Exemples.Blocs.ActiveDirectory.TestsGroupeTests.vb 9 18 Carra.Exemples.Blocs.ActiveDirectory.Tests
(This says that my type is not accessible in this context, because it is private.) But it's Friend (internal)
EDIT #2
Here's a piece of code as suggested for the Groupe class implementing the Public interface IGroupe:
#Region "Importations"
Imports System.DirectoryServices
Imports System.Runtime.CompilerServices[code]........
View 3 Replies
Jun 22, 2009
I've set up a test database to begin unit-testing an app that I've recently been added to. It is a 3-tier design (presentation layer, BOL and DAL) and this is my first time writing unit tests. I've decided to start at the BOL and I figure the best way is to swap out the ConnectionString (which has been passed along as a Shared String) with one that points to my new test database. However, I don't wish to change any production code. I simply wish to somehow redirect the app to the test database during unit tests.
View 4 Replies
Mar 11, 2010
We are looking to make a final decision on our Mocking framework. After trying several, I have fallen in love with Moq. I also love TypeMock - but because we are in the early stages of implementing TDD across the team, we do not want to make such a large investment quite yet. We are using VS 2008 now and are going to move to 2010 as soon as it is released.
So after doing much research I have decided on Moq because it's nearly as good as TypeMock and has super clean syntax, etc. Now here's the problem/question: we are mainly a VB.NET shop but are using C# for all of our CRM implementation code (plugsins, etc). It seems Moq only fully supports C# due to VB.NET lacking Lambda sub routines. Can anyone confirm that when VS2010 comes out Moq will work fully with VB.NET in its current version?
Is anyone here using Moq with VB.NET? w/ 2010? We need to make this decision asap, as we are under tight deadline and do not want to change frameworks again (went from NMock to TypeMock and now want to make final decision and move to Moq) or have 2 separate ones per language...
View 1 Replies
Feb 1, 2011
I'm wondering how to evaluate an expression using the assert object. The idea is to check if a string is longer then what is minimally acceptable. For example, Assert.AreEqual(stringName.length, >5). I know this method doesn't work but the concept is what I'm trying to get across. Is there a way to test this?
View 1 Replies
Feb 9, 2011
Consider the following method that stops a service:
Public Function StopService(ByVal serviceName As String, ByVal timeoutMilliseconds As Double) As Boolean
Try
Dim service As New ServiceController(serviceName)
Dim timeout As TimeSpan = TimeSpan.FromMilliseconds(timeoutMilliseconds)
[code]....
I agree that for domain model code that using the "traditional" unit testing approach makes the most sense as this would lead to a design that is easiest to maintain. However, for code that deals with the .net implementation of Windows API related stuff (file system, services, etc), is there really an advantage to going thru the extra work to get "traditionally" testable code?
It's hard for me to see the disadvantages of using Microsoft Moles for things such as ServiceController (or the File object). I really don't see any advantage of doing the traditional approach in this case.
View 2 Replies
May 17, 2012
In my project developed for using asp.net with vb.net coding. Now we need to performace testing using the Jmeter tool. we can't able to test because in my application lot of session variable used, Jmeter tool does not support session variables i think.Check with debugging:1.Assign the session(userName) ="abc" then goes to next page, then check value same session vaule as nothing.
View 1 Replies
Jan 18, 2012
I have a Do loop that I want to exit once it goes through without making any changes to an object I created. I figured the best way to do this was to create a temporary copy of the object at the beginning of the loop and then compare that to the actual object at the end of the loop to determine whether any changes were made to it. The problem occurs when variables are accessed and copied by reference. I have tried to use some of the methods such as .Clone and .Equals (maybe I shouldn't be using these, but I didn't see any better built-in methods), but I seem to be doing some stuff wrong. Can somebody give me an example of a good way to copy an object for later equality testing, and how to do the equality testing?
View 5 Replies