Report Progress Of Unit Test?
Oct 5, 2010
Is there currently any possible way to report progress of my unit test? I have a test that could take up to a hour, and I don't want to sit there not knowing what % it is done with. I have tried writing with debug.print and trace.writeline, neither of which seem to work.
View 1 Replies
ADVERTISEMENT
Sep 20, 2011
Probably a dumb question, but can you write a unit test project in one language to test against another project in a different language?I'd like to translate one of our VB assemblies into C#, but want to build unit tests to verify the results. I've tried to set a unit test project up to do this, but I can't seem to access the VB code within a unit test... I can't figure out if I'm just missing/doing something stupid, or it really isn't allowed.
View 2 Replies
Apr 18, 2012
I tried to make an unit test for this method which is pretty simple only add an object into the data base and if it works well returns true
[Code]...
View 1 Replies
Sep 10, 2009
I created some string resources in My.Resources. I want to use those resources in my unit tests.How do I expose these resources to my unit test project?I tried simply setting the Access Modifier to "Public" for the resources. This made it so that I can compile the code, but it is ignoring the culture setting.
Bo.My.Resources.Culture = New CultureInfo("en-GB", False)
LocaleTest(Bo.My.Resources.Yes, "Yea")
View 2 Replies
Mar 3, 2010
I am writing a test unit (in MSTest) that consumes an XML file located in the testing project. I have this (solution name is BusinessLogic, project name is BusinessLogicTest):
Public TestContext As TestContext
<TestMethod()>
<DeploymentItem("BusinessLogic.BusinessLogicTestTestData.xml")>
<DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML",
"|DataDirectory|TestData.xml", "Row", DataAccessMethod.Sequential)> _
Public Sub ConvertIntToRoman_DataDrivenTest
[Code] .....
However, when I run the test I get an error: The unit test adapter failed to connect to the data source or to read the data. I belive it's something to do with my DeploymentItem and/or DataSource, however, I cannot find an example (in VB) that works anywhere.
View 2 Replies
Jun 3, 2009
I am having a problem with a unit test I have created. First time doing this so I am not sure why I am getting this error [code]Test method ETDS_Unit_Tests.LoginTest.ValidateUserNameTest threw exception: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server).This is the same connection that my software is using, and the software runs fine, only the unit test is failing. What I am doing wrong? It Seems to fail one time for each datarow in the table.Also, I am using a Linq Query in the method that I being tested. I believe that this may be what is causing my error.
View 2 Replies
Mar 12, 2009
I have a constructor that looks like this:
Public Sub New()
MyBase.New()
ws.Url = My.Settings.WebServiceURL
End Sub
(ws is private)
Is there any point in unit testing this?
The class did not previously have this constructor.
View 1 Replies
Mar 24, 2010
Usually when you add one (in Visual Basic), it pops up a message asking if you want to enable an option that lets the test access things like private methods etc.
However, I am editing a solution that does not have this enabled. I'd like to enable it so my unit tests will work, but I can't find the setting.
Can anyone tell me how to enable it after the project has been created?
View 1 Replies
Mar 30, 2011
I have the following code in vb.net that calculates the amount before tax was applied:
Public Shared Function CalculateRateBeforeTax(ByVal rate As Decimal, ByVal tax As Decimal) As Decimal
Dim base As Decimal = rate / (1 + (tax / 100.0))
Return Math.Round(base,2)[code]....
I put the above scenarios into some unit tests using c# and using the nunit testing framework. The first scenario passes, but the other fails and I am not sure how I can get it to pass. Here is are my tests:
[TestFixture]
class TaxTests
{[code].....
As I said before, the first test passes, but the results of the other tests are:
Second Test expected 305.1600000000000003d But was: 305.1643192488263d
Third Test expected 95.54999999999997 But was: 95.55555555555555557d
View 4 Replies
Apr 11, 2011
How can create a unit test for the the Page_Load function in ASP.net?
I am using build in Visual Studio Unit test frame work. I want to create a unit test that check the Elements of the web page and their values.
I know about selenium and its abilities in unit testing.
This is the web Page to test WebPageControl.ascx.vb:
Public Class WebPageControl
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
[Code].....
View 3 Replies
Apr 22, 2010
How can I write a unit test to test the actualWidth property to a userControl in Silverligh 4? I hoped that this method would pass, but it fails. I am using the Silverlight ToolKit april 2010, and VS 2010.
<TestMethod()> _
Public Sub TestAcrtualWidth()
Me.MyUserControl.Width = 100
Me.MyUserControl.UpdateLayout()
Assert.IsTrue(Me.MyUserControl.ActualWidth > 0)
End Sub
View 1 Replies
Mar 20, 2012
I wish to run a unit test on a particular dictionary in my code, trying to get a value I don't expect to be in the database (in this case, key=1).
I have written the following code:
Try
Dim s As String = myDict(1)
[code].....
View 3 Replies
Aug 14, 2009
I have a simple unit test which tests that a validation function picks up a specific validation issue. The validation item returns a simple object with Item & Message properties. I've written a unit test for this function but this always fails even though I know the function works as expected.
<TestMethod()> Public Sub ContractNote_ValidateForManualInputTest_TradeOrderValueComparison()
'Can't get this test to work even though validation works!
Dim CN As ContractNote = New ContractNote
Dim Trade As New TradeOrder
[code].....
I've implemented IComparable on ValidationItem (I have a separate unit test which confirms this works). Am I Using CollectionAssert correctly?
View 1 Replies
May 12, 2009
I am trying to create a unit test similar to how I would have done one in C# but am struggling with the lambdas in vb. Bascially I am trying to mock a class and then create a stub and return. In C# I would have done something like;
MockedPersonRepository
.Stub(x => x.Find(id))
.Return(person)
[code].....
View 2 Replies
Dec 7, 2010
I just bought the MCTS Self-Paced Training Kit (Exam 70-561): Microsoft.NET Framework 3.5 - ADO.NET Application Development, and am trying to do the Lab Exercises now. Allready at the first exercise (point 8), where I am supposed to make an "UNIT TEST",[code]
View 5 Replies
Aug 13, 2009
I am writing a winforms application and eventually I would like to write unit test for this application from the DAL, and Biz Objects layers etc.
Does someone know of a FREE tool that can recieve the path to an assembly and then output unit test stubs with matching signatures for the assembly.
Any configurable options like "public interfaces only", "test framework choice", "language choice" would be a plus.
View 4 Replies
May 16, 2011
One of my unit tests seems to randomly pass or fail when I run it. The only thing that makes sense to me for why this is happening is if the data in the database is getting into a different state each time the test is ran, but I use transactions to rollback the database in each test - unless it's not working right. Here's my base unit test class and the unit test class that's having the problem. Can you see anything I might be missing or what else I should look for?
This happens with TestDriven.Net and the Visual Studio Unit Test Framework.
[Code]...
View 3 Replies
Aug 18, 2011
As I develop code, I often want to unit test some of the building blocks of a class even if they are normally private. If my unit tests are inside the project, I can use "Friend" to accomplish this and still keep the functions private for normal use. But I would rather move my NUnit tests into their own separate project(s). How do I achieve the effe vb.net 2005?
View 11 Replies
Aug 12, 2009
I'm using WatiN to run IE inside a VB .NET function:
[Code]...
View 1 Replies
Dec 20, 2010
Public Class Class1[code]...
Granted this example is pretty weak, but how could I write a test method that to prove that CallThis() gets called everytime that the input parameter s = "S"?
View 5 Replies
Jul 1, 2009
I'm trying to implement unit tests for my NHibernate data access layer. The first test, which I drew from an example I found on the web [URL] is just trying to recreate the database using my domain classes/mappings. I've been able to get this sample working in C# (Product table is created in database) but not when I implement it in VB.NET.I have two projects, Todd.Core (containing Product class and Product.hbm.xml mapping) and Todd.Core.Test (containing Test Fixture and NHibernate configuration). When I attempt to run this test using MBUnit GUI I get this message (line 10 is the call to the .Configure method):
Message: Could not compile the mapping document: Todd.Core.Product.hbm.xml
Type: NHibernate.MappingException
Source: NHibernate
TargetSite: Void LogAndThrow(System.Exception)
HelpLink: null
[code].....
View 1 Replies
Mar 15, 2009
As I develop code, I often want to unit test some of the building blocks of a class even if they are normally private. If my unit tests are inside the project, I can use "Friend" to accomplish this and still keep the functions private for normal use. But I would rather move my NUnit tests into their own separate project(s).
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
Aug 26, 2010
I have a solution with two projects within:
Company.Project.vbproj
Company.Project.Tests.vbproj
Within the Company.Project.vbproj assembly, I have a class FriendClass.vb which scope is Friend (internal in C#).Now I wish to test this FriendClass.vb from within the Company.Project.Tests.vbproj assembly. I know about the InternalsVisibleToAttribute, but that is not an option in Visual Basic .NET 2.0, as it is only available with C#, in .NET 2.0 (see here).I would like to create myself a proxy class using this internal FriendClass from within my testing assembly, so that I could instantiate it and do the testings accordingly.
View 1 Replies
Feb 14, 2012
I am trying to implement a BGW and want to report progress to a progress bar for my TextFieldParser program, sometimes if your opening very large files it takes a while and I would like the user to be able to see the progress and have some interaction so they know the program is still running I am a little hung up on what to in the reportprogress
I have:
worker.ReportProgress(0, myReader.ReadFields())
and its not doing anything, I didnt expect it too since ReadFields is an array
parser
Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim worker As System.ComponentModel.BackgroundWorker = DirectCast(sender, System.ComponentModel.BackgroundWorker)
[code]....
View 6 Replies
Jun 1, 2011
We have a WCF service hosted in IIS that currently calls a VB6 DLL to do part of its job. This works fine, but we can't deploy the service to a 64-bit target environment without configuring IIS to run it in a 32-bit worker process.I am currently investigating ways around that restriction. Porting the VB6 DLL to .NET is not possible for various reasons, so I created an ActiveX EXE wrapper around the DLL in VB6, so that the service can run in 64-bit and the VB6 parts in 32-bit.
When I tested the service I got this error:
Type: System.UnauthorizedAccessException
Message: Retrieving the COM class factory for component with CLSID {9AE7303B-D159-43F6-B1A5-52D297581820} failed due to the following error: 80070005.
After some Googling I found that this is due to either:
Calling an MS Office component
DCOM permissions not being configured
NTFS file permissions not allowing read/exec access to the IIS worker process identity (ASPNET in my environment)
Of these:
Definitely not applicable Also not applicable; I am not hosting the EXE in DCOM or COM+, just a simple COM out-of-process activation
This looks likely; however, I checked the permissions, and NTFS reports that the Users group (which ASPNET is a member of) does indeed have read/exec access to the file I tried calling the EXE from a unit test fixture, which is executed in my admin-level account rather than the IIS worker process account, and it worked fine, so the error is definitely something to do with permissions. I'm not sure what to do next.
UPDATE:The IIS virtual directory is configured for Anonymous+Windows access; the WCF service uses only Anonymous authentication, the Windows authentication is for the VS debugger. Task Manager reports that the aspnet_wp.exe process is definitely running in the ASPNET account.I explicitly granted Read and Execute access to the ASPNET and IUSR_<machine> accounts on all the COM exes and dlls involved. This made no difference.
I explicitly granted Local Launch and Local Activation access to the ASPNET and IUSR_<machine> accounts on the relevant interfaces in the DCOM configuration. This made no difference either.Keep trying to get this working somehow.Go the whole hog and host the EXE in COM+.Give up. Tell users that the WCF service must be configured to run in a 32-bit app pool on 64-bit Windows.
View 1 Replies
Jul 21, 2010
I have written one application which communicate with one data logger unit (temperature monitoring unit) and download records after some interval. Unit continuously send current temperature which I have to show on screen and after each one hour I have to download log (all records saved inside unit at max 1024) from unit.
Now problem is after downloading log, application get hang or what we called working in background and resume after some time. If I pause debugger in visual studio 2008 it show control at application start (sub main) with message as "application will resume here after completing execution of current function". There is nothing in output window. So how can i trace is there any events got spool or what actually application doing in background.
View 1 Replies
Apr 12, 2011
Does anyone have a nice sample of a unit convertor handling multiple unit types that I can integrate in my application? I have found this one, but it is only handling one type of unit. For example I want to convert weight as well as volume from and to imperial units.
View 8 Replies
Mar 9, 2012
i have problem with the reportprogress / progress changed.i use the backgroundworker in a form class named frame menu. the do work sub of the backgroundworker calls a sub X in a public module.
from the backgroundworker do work sub i am able to use the backgroundworker.reportprogress / backgroundworker progress change method and this is displayed on my form.
when i am using the backgroundworker.reportprogress / backgroundworker progress change method from the sub X it does not display on my form.
when i debug the code it calls the backgroundworker.reportprogress / backgroundworker progress change method correctly in the sub X but just does not display it on the form.
[Code]...
View 5 Replies
Jan 6, 2010
I am using backgroundworker thread in my app. I also have a class in my project and am able to updated the user UI from the form, but most of my time consuming operation happens in the class so I tried to do an update like this Form1.BackgroundWorker1.ReportProgress(4, strname), but I get an error that say that the backgroundworker is not set to report progress.
I have this set in the load event for the app.Are you not able to call form items like this from a class?
View 4 Replies