Simple Visual Studio 2010 Question
-
Hello There, I have a winform application in Visual Studio 2010 and within a class I have a shared function with the following code Public Shared Function simplestFunctionEver() as Integer Dim myInteger1 As Integer = 1, myInteger2 As Integer = 2 simplestFunctionEver = myInteger1 + myInteger2 End Function While debugging or otherwise, How can I test this function in Visual Studio 2010 Regards & Thanks in advance to users who reply Farooq
You could: - single-step the code (not my favorite) - exercise the code by having it called, any way you like - execute unit tests (see NUnit) - have an external company validate your implementation against your requirement specifications - integrate it in a bigger app and observe (and maybe wonder why and how it is failing). :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
Hello There, I have a winform application in Visual Studio 2010 and within a class I have a shared function with the following code Public Shared Function simplestFunctionEver() as Integer Dim myInteger1 As Integer = 1, myInteger2 As Integer = 2 simplestFunctionEver = myInteger1 + myInteger2 End Function While debugging or otherwise, How can I test this function in Visual Studio 2010 Regards & Thanks in advance to users who reply Farooq
You can use the VSTS test project of VS2010 to create and execute to verify or call this shared function via some other method.
-
Hello There, I have a winform application in Visual Studio 2010 and within a class I have a shared function with the following code Public Shared Function simplestFunctionEver() as Integer Dim myInteger1 As Integer = 1, myInteger2 As Integer = 2 simplestFunctionEver = myInteger1 + myInteger2 End Function While debugging or otherwise, How can I test this function in Visual Studio 2010 Regards & Thanks in advance to users who reply Farooq
Member 3357336 wrote:
While debugging or otherwise, How can I test this function in Visual Studio 2010
You can only debug one thing at a time. What does "test" mean here? You could add a watch to show it's return value during debugging :)
Bastard Programmer from Hell :suss:
-
Why would you want to, it doesn't do anything. Testing a method that takes in no arguments and returns nothing while also not changing or calculating anything external from the method is pointless.
I wasn't, now I am, then I won't be anymore.
-
You can use the VSTS test project of VS2010 to create and execute to verify or call this shared function via some other method.
-
Member 3357336 wrote:
While debugging or otherwise, How can I test this function in Visual Studio 2010
You can only debug one thing at a time. What does "test" mean here? You could add a watch to show it's return value during debugging :)
Bastard Programmer from Hell :suss:
Thanks for replying. "Test" simply means that I want to call this function and debug it's guts. Please note that users in this forum are taking this function literally. It's not the attributes of the function I am interested in but the way this could be debugged in VS2010. I could have a very "Generic", (shared) extremely lengthy format or compute function that I want to debug I am still not sure on how to do this so please help Regards P.s. I really don't want to call this function while executing my complete program and calling with a button or anything similar. Simply go to a screen call the function and be able to debug it
-
Thanks for replying. "Test" simply means that I want to call this function and debug it's guts. Please note that users in this forum are taking this function literally. It's not the attributes of the function I am interested in but the way this could be debugged in VS2010. I could have a very "Generic", (shared) extremely lengthy format or compute function that I want to debug I am still not sure on how to do this so please help Regards P.s. I really don't want to call this function while executing my complete program and calling with a button or anything similar. Simply go to a screen call the function and be able to debug it
The accepted way to test functions is to write unit tests, which you can call using test harnesses. There are whole books out there on the subject; what you really want to look at is unit testing c# and test driven development.
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
The accepted way to test functions is to write unit tests, which you can call using test harnesses. There are whole books out there on the subject; what you really want to look at is unit testing c# and test driven development.
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
Thanks. This is exactly what I wanted to know. I simply created a unit test and that did it for me Regards & Thanks to all who replied
You're welcome. Glad to be of service.:thumbsup:
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
Hello There, Thanks for replying. Can you please clarify or guide me as to what VSTS Project is and how exactly can I call this type of function in there Regards & Thanks
These links would help you understand it better: http://www.microsoft.com/presspass/itanalyst/docs/03-01-09VSTS2010TA001626ADT.PDF[^] http://msdn.microsoft.com/en-us/library/ms182413(v=vs.90).aspx[^]