Assert.Fail Within A Try Block?
Jun 23, 2011
My understanding of assert.fail was that if the line is executed, the test will fail.owever, I have found an instance where the assert.fail is executed, but the test passes.If the Assert.Fail statement is within a try block, the test will ALWAYS pass, even if the code execution executes the assert.fail. For example, the following test will always pass, even if the sub fails to throw an exception.
View 2 Replies
ADVERTISEMENT
Jun 25, 2012
This is probably a very simple Object Oriented Programming question. What I am trying to do is take 2 empty objects, use a query to pull data from a database, populate the empty objects with the data returned from the query, and then assert against them. See the code below:
[Code]...
I wrote a very similar test method in VB following the same patterns and the VB code executed just fine.However whilst transitioning from VB to C#, I run into issues such as these. The compiler says "Use of unassigned variable" at the assert. However, I thought I was assigning to a value within the code block above. What am I doing wrong?
View 2 Replies
Feb 18, 2011
I'd like to add a message to be displayed in Visual Studio 2010 test results.I can post a message out if the test fails, but not true. Is there anyway to do this? For example:
dim quoteNumber as string = Sales.CreateQuote(foo)
assert.IsTrue(quoteNumber <> "")
'I would like to make this something like this:
assert.isTrue(quoteNumber <> "", falsepart, "Quote number " & quoteNumber & " created")
View 3 Replies
Jan 20, 2009
I am doing regression testing using NUnit, WatiN and VB.net. What I am doing is opening an IE page, selecting some data, making a registration and then on view registration page testing the registration by assertion. Any good way to use try and catch on every assert. i am using it because if some assert fails it will stop executing the rest of the statement and quits without running rest of the tests. Now I have put try and catch on every assert and writing the fail message in log file.
For instance If I am checking for some airline reservation booking. After creating a booking, On view Booking Summary Page I am testing weather it is displaying cancel booking button or not. For this I am using the following code:
Try Assert.IsTrue(_internetExplorer.Button(Find.ById(New Regex("CBooking"))).Exists)
Catch ex As Exception d_logger.LogResultTextFile("Cancel Button does not Exist", True, False) End Try
I am checking this by running this in a loop for no of bookings created. I want to keep running the test even if in one booking it wont finds the button but keep checking for other bookings.
View 1 Replies
Sep 20, 2011
I'm surprised to get a compile error in release mode with the following code.I have a DEBUG only function declared
#If DEBUG Then
Private Function DEBUG_Check() As Boolean
'Do some checks[code]....
I get a compilation error "DEBUG_Check is not declared"I thought calls to Debug.Assert were completely removed from Release compile?
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
Jun 7, 2011
I wan to create a program that can get the application name.i can start the program but cant get the program name[code]...
View 1 Replies
Jun 5, 2012
Concerning this code... Dim i1 As Integer = Nothing
[Code]...
View 12 Replies
Sep 9, 2010
I have a VB windows Form project that connects to several DataTables in an Access DB. On my form I have several textboxes, comboboxes and datetimepickers that are bound to those sources. With one table in particular when I try to update the tableadapter after editing one of the textboxes the update method fails. No exceptions are thrown, but the update method returns a zero value and the data is not updated. The update will work when just the comboboxes or datetimepickers are edited, but as soon as a textbox is edited also, update will not work.
Other DataTables within the project are set up in the same manner but are not having update issues. I can't figure out what about this one particular table is causing an issue. Can anyone give me any thoughts on where or what to troubleshoot?
View 1 Replies
May 26, 2009
I am currently trying to write a little wrapper around post-review to automatically post however this function fails when it comes to Dim results As String = sOut.ReadToEnd() and I can;t suss out why,
Edit: It doesn't produce an error it just seems to go into ReadToEnd() never to return
Function postReview() As String
Dim psi As ProcessStartInfo = New System.Diagnostics.ProcessStartInfo("cmd.exe")
psi.UseShellExecute = False
[code]....
Further Info: The actual command is working as I can see it posting to Review Board. But it just seems to get stuck in a loop while waiting on the Stream to complete. I have tried with Read and Readline with no luck?
View 3 Replies
Nov 13, 2009
I have a dropdown list that I am binding to a datatable. Here is the code I am using to do it:[code].....
Unfortunately, the line ddlBuildAddr.SelectedIndex = addressId is failing. Looking at this line through the debugger, the SelectedIndex goes to -1, while addressId goes to 2. What gives? Why would the assignment operator flatout not work?
View 6 Replies
May 30, 2011
I'm trying to convert the following algorithm from C# to VB.NET and the VB.NET I have is not producing the same results as my C# algorithm, can someone tell me where I've gone wrong in my conversion?
public static IEnumerable<T[]> Combinations<T>(this IEnumerable<T> elements, int k)
{
List<T[]> result = new List<T[]>();
[code]....
View 4 Replies
Jan 7, 2010
I am working on a mdi project and I have a few different xml files that I need to read in and I would really like to use multiple datatables, but only one dataset. I have always struggled to get a datatable.readxml(filename) call to work without an invalidoperationexception b/c of the schema stuff. I don't understand it very well and in the past my workaround was just to make another dataset. I am trying to avoid doing that from now on. I have written a routine called readxml which will take a xml file name, xml schema file name, and a datatable name and return to you a populated datatable..but I can't get it to work.
Here is my call to the read xml method (comes from my main mdi form class during form load)
Dim dt As DataTable = globals.xml.readxml("SqlConnectionString.xml", "SqlConnectionString.xsd", "sqlConnection")
Here is my readxml routine, I will post two versions of what I tried attempt #1: use a string of raw xml and a xmlreader
[CODE]...
View 1 Replies
May 13, 2011
I do an dns test before i send mail to ensure i dont get errors.But there is a problem, when i try to send an email to an adress xxxxx@eco-log.sei get an error from the dns function. when i try to delete the "-" in the mail adress it works.at first i tohught it was because of the "-", but i made an email at zzzzzz@eh-design.se and it works like a charm, what could be the problem then? It is 100% sure that "xxxxx@eco-log.se" is an existing email/dns.The error message im getting is "No such known source"(freely translated)
Heres the dns check code:
Public Function testDNS(ByVal dnsstring As String) As Boolean
Dim email As String = dnsstring
Dim host As String() = email.Split("@")
Dim hostName As String = host(1)
[code]....
View 2 Replies
Oct 3, 2009
I have this protocol for getting a favicon: (I stole it from Thomas Maxwell, and adapted it, but still)
Public Shared Function GetFaviconSilent(ByVal IconURL As String)
On Error Resume Next
Dim oIcon As Icon
[code].....
View 6 Replies
Jun 22, 2010
[code]did anyone know what wrong with my code..i've fail to insert in table USERID in access..actually,i've use the same code to insert before this and it succeed..
View 19 Replies
Oct 8, 2011
I have binded the accdb to combobox but it can not bind the data currently, it can only bind the first character of first record of the table for example, if the records are:
abcd
xyz
ijkl
the combobox will display
a
[Code]...
View 1 Replies
May 22, 2009
I have an ASP.net table. In several cells I have two dropdown lists. The item selected in each dropdownlist is supposed to be populated from an SQLServer 2005 database. To do this in my code behind I step through the controls in each table cell. The code sees the first dropdown and populates it and then goes to the next cell.
[Code]...
View 1 Replies
Dec 7, 2011
I am having an issue with the SQLCommand query update handling apostrophes. I have a gridview that accepts edited text which might have apostrophes and other such accent characters.The UPDATE keeps throwing errors on the apostrophes in the text entered causing the SQL UPDATE to fail.
Here is the code:
Dim lbl1 As Label = GridView3.Rows(e.RowIndex).Cells(0).FindControl("Label1")
IDVal = lbl1.Text
[code].....
View 3 Replies
Apr 16, 2009
I have textboxes which is placed inside accordian (ajax control).In pageload event i have written the code to load values in textboxes. But onload event one error is coming as object not set to instance of a object. Values are not coming in textboxes.
Then i tried to initialize controls in textboxes .Then the error cleared. But
Values are not coming in textboxes. What may be the reason for this?
View 2 Replies
Feb 18, 2011
Question: I'm looking up the account name and SID for each WellKnownSidType enum member as shown below.
Why does it fail sometimes?And why does it sometimes fail in converting the WellKnownSidType to a sid?As far as I understand it, only the conversion from sid to accountname should sometimes fail, and even that only when the account isn't local and not in the domain.
For example, when translating the enum LogonIdsSid to a SID, i get:
Bekannte SIDs des Typs LogonIdsSid können nicht erstellt werden.
(Known SIDs of type LogonIdsSid cannot be created.)
[Code]...
View 1 Replies
Jan 21, 2010
I am trying to do the following process in the method of BackgroundWorker.DoWork()
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
For x = 0 To 100
[Code].....
View 5 Replies
Mar 20, 2012
Visual Studio 2010 I am trying to learn Caliburn Micro. The sample project is presented in C# only (and runs OK) I have tried several on-line C# to VB converters, without success. Well the conveersion runs without error - - - but the Visual Studio editor chokes on the results. The principal problem seems to be with (what looks to me like) a Lambda. Advanced code conversions are really tough in any case, - but when you do not know C# nearly impossible.
[Code]...
View 10 Replies
Dec 1, 2009
I have encountered an error whenever i try to run my SendEmail method, the method will actually loop through a folder of files and attach the files to the mail. I am able to send email for "Records", but when the method reaches "Lists", it throws a "NullReferenceException" on the line which i have bold.[code]...
View 4 Replies
Jan 28, 2009
I'm using the following code to fetch a mac address
Try
Dim cls As New ManagementClass("\" & IP & "
ootcimv2", "Win32_NetworkAdapter", New ObjectGetOptions(Nothing, TimeSpan.MaxValue, False))
Dim col As Object
[Code]...
It is working as expected. My problem is that it seems to wait far too long for devices which do not respond, and when the output of GotMac is "The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)" How do I shorten the wait time for these types of events?
View 5 Replies
Mar 15, 2012
I want to create a pass or fail integer into my multiple choice radiobutton quiz.
View 6 Replies
Mar 29, 2012
My app is basically console based but I need a Form to run in background. Adding a form in the app works but using Form1.Show didn't work, so I used VB.NET Application.Run(New Form1) However, in Form1_Load Me.Hide didn't work. I have no idea why. It works in buttons or other components in the same form.
View 1 Replies
May 15, 2010
I take this code from Crazypennie and the code is working very well.i try put the second Listbox2 on my form and try to save again but fail
Private Sub SaveValue(ByVal Path As String)
Dim ToSave(1) As String
Dim index As Integer = 0[code].....
View 4 Replies
Jun 20, 2012
Here is the codes:
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
Dim attachment As System.Net.Mail.Attachment
SmtpServer.Credentials = New _
Net.NetworkCredential("administrator@company.com", "1234")
SmtpServer.Port = 25
[Code]...
View 1 Replies
Aug 21, 2010
I have rather large project and I get an 6 errors during the build process. They are each of this form:
[Code]...
View 3 Replies