Watin test hang application while uploading file - testing

I have an issue with watin test that should browse for pdf and upload it to a web page. This test runs smoothly on my machine, always find pdf, click submit and wait 30 sec for upload completed.
But when I try to run this test on build machine (teamcity), happens that test hang at the point when it should wait for upload. The problem is that test don't timeout, even if I set timeout at nunit on 1 minute for whole test, or trying to reload page. The test just froze whole site at upload step.
Testing this functionality is really important, but since those tests with uploading hang whole build we have to do it manually and that isn't really out idea of test automation.
Does anyone have idea how to solve this upload problem? Or at least manage to timeout this test.
stack trace = at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at mshtml.DispHTMLBaseElement.click()
at WatiN.Core.InternetExplorer.IEElement.ClickOnElement()
at WatiN.Core.Element.Click()
at WatiN.Core.FileUpload.Set(String fileName)

The issue was that WatiN used sendkeys to set the file(name) to upload. In WatiN 2.0 beta 1 this is changed to using some API calls. This solved the issue of hanging tests when automating a dialog which does require text input.

I think the problem here is that your unit test depends on too many external resources, such as your the file system of your development machine, the network, etc.
Ask yourself what the importance of the test is: is there any business logic involved you can put into a separate class? Then you can write tests for this class. What you basically need is to test all the logic of the upload process without actually uploading a file or going to the network.

Related

Serialization Exception when I upload .appxupload instead of .appxbundle to HockeyApp

When I upload a .appxbundle of my UWP app to HockeyApp, everything works fine. When I instead upload a .appxupload file, I get a Serialization error when I run my app, and try to serialize classes with the [DataContract] attribute.
The Exception I get is the following (on some machines, not all):
Value cannot be null.
Parameter name: format
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.SR.Format(String resourceFormat, Object p1)
at System.Runtime.Serialization.DataContract.GetDataContractFromGeneratedAssembly(Type type)
at System.Runtime.Serialization.DataContract.DataContractCriticalHelper.CreateDataContract(Int32 id, RuntimeTypeHandle typeHandle, Type type)
at System.Runtime.Serialization.DataContract.DataContractCriticalHelper.GetDataContractSkipValidation(Int32 id, RuntimeTypeHandle typeHandle, Type type)
at System.Runtime.Serialization.DataContract.GetDataContract(RuntimeTypeHandle typeHandle, Type type, SerializationMode mode)
at System.Runtime.Serialization.DataContractSerializer.get_RootContract()
at System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.WriteObject(XmlDictionaryWriter writer, Object graph)
at System.Runtime.Serialization.XmlObjectSerializer.WriteObject(Stream stream, Object graph)
at VungleSDK.DbTable_1`1.Serialize(T obj)
If I upload the .appxupload file to the Windows Store, I see no problems.
My question is, why is the happening? Is HockeyApp somehow modifying the .appx packages for .appxupload, but not for .appxbundle? Is something else going on?
Answering my own question:
Although HockeyApp will let you upload .appxupload files (like you can for the Windows Store), you should not. Instead, always upload the .appxbundle file.
I contacted support#hockeyapp.net, and quickly received the following response (thanks very much, HockeyApp support):
Hi Greg, thanks for getting in touch!
As the document How to sideload UWP applications indicates here it
seems we only support .appxbundle file, so please upload the
.appxbundle file instead of the .appxupload.
AppxUpload packages are meant only for the Store ingestion pipeline and I wouldn't expect them to work properly. I don't have the full rundown but they're the set of artifacts we need to properly do security patching of your application and aren't meant to be a container for execution.

InDesign server COM error

I am using InDesign server on windows. And developing application using Microsoft .Net web platform (ASP.NET).
I am generating Indd file using ImportXML() method provided by InDesign. I am getting following error randomly (sometimes more often):
System.Runtime.InteropServices.COMException (0x0000FFFF): Exception from HRESULT: 0x0000FFFF
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at InDesignServer.Document.ImportXML(String From)
There is no more information provided by InDesign about where it fails so am blocked there.
Can anyone help here. Thanks.
I am not familiar with ASP.NET, but in ExtendScript it is importXML (starts with low case and case-sensitive)
Also, check the file path you are passing to the importXML.
Make sure the document is created and initialised before you import xml
After a long time. But, I became active again on 'Stack'.
This was the error due to in-appropriate permission in DCOM config.
See steps below to check:
1. From the Start menu, click Run and type Dcomcnfg.exe
2. Select 'Computers'
3. Select 'My Computers'
4. DCOM Config
5. Find InDesign COM component and select properties
6. In this set appropriate security and identity.
COM exceptions are always vague, hard to answer by anyone!

Unhandle exception issue

We have a large app built using VB.NET VS2012. Every now and then when closing the app an unhandled exception occurs. Very random, sometimes it does it sometimes it doesn't.
The error is below.
System.InvalidOperationException was unhandled
HResult=-2146233079
Message=Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
Source=System.Windows.Forms
StackTrace:
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.BeginInvoke(Delegate method, Object[] args)
at System.Windows.Forms.WindowsFormsSynchronizationContext.Post(SendOrPostCallback d, Object state)
at System.Windows.Forms.AxHost.ConnectionPointCookie.Finalize()
InnerException:
We produce a dump file to try and find where this is originating but have had no luck. The debugger just shows No source code available. We are using some third-party controls. At this point we just want to find what is trying to create the control. If its a problem with the third party control and if we don't have that code, we can't fix it but maybe we can work around it. But we can't find what is trying to create control (when shutting down).
We have reviewed many web posts describing how to utilize the crash dump files but have had no luck identifying the control (or even the control type) that is generating this.. Just knowing the type would help narrow it down.
Any ideas how we can at least get the type of control or the originating caller or?
If enough info isn't provided please let me know and I will post what I can.
Posting code is not an option because we have no idea where the message is coming from.
Thanks in advance!
I should have added that we do use try catch blocks for just about everything. We also do have a logging procedure but we arent seeing any of these exceptions in the log file.

Unexpected end of file. Following elements are not closed: Cookie, SecurityContextToken. Line 1, position 2998

I have implemented ADFS authentication for an asp.net 4.0 application. I have hosted the application in the production environment with webfarm configuration. The website works well and all the images are rendered properly in the IE8 browser. But when I tried to browse the application in the Safari browser the website does not works some times and the images are also not rendered properly.
By using Fiddler I found that the sometimes that images are not rendered properly and it comes with the following error :
Exception information:
Exception type: XmlException
Exception message: Unexpected end of file. Following elements are not closed: Cookie, SecurityContextToken. Line 1, position 2998.
Thread information:
Thread ID: 12
Thread account name: CT\acmeweb
Is impersonating: False
Stack trace: at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
at System.Xml.XmlExceptionHelper.ThrowUnexpectedEndOfFile(XmlDictionaryReader reader)
at System.Xml.XmlBaseReader.MoveToEndOfFile()
at System.Xml.XmlUTF8TextReader.Read()
at System.Xml.XmlDictionaryReader.ReadContentAsChars(Char[] chars, Int32 offset, Int32 count)
at System.Xml.XmlBaseReader.ReadBytes(Encoding encoding, Int32 byteBlock, Int32 charBlock, Byte[] buffer, Int32 offset, Int32 byteCount, Boolean readContent)
at System.Xml.XmlBaseReader.ReadContentAsBase64(Byte[] buffer, Int32 offset, Int32 count)
at System.Xml.XmlDictionaryReader.ReadContentAsBytes(Boolean base64, Int32 maxByteArrayContentLength)
at System.Xml.XmlDictionaryReader.ReadContentAsBase64(Int32 maxByteArrayContentLength, Int32 maxInitialCount)
at System.Xml.XmlBaseReader.ReadContentAsBase64()
at System.Xml.XmlDictionaryReader.ReadElementContentAsBase64()
at Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(XmlReader reader, SecurityTokenResolver tokenResolver)
at Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(Byte[] token, SecurityTokenResolver tokenResolver)
at Microsoft.IdentityModel.Web.SessionAuthenticationModule.ReadSessionTokenFromCookie(Byte[] sessionCookie)
at Microsoft.IdentityModel.Web.SessionAuthenticationModule.TryReadSessionTokenFromCookie(SessionSecurityToken& sessionToken)
at Microsoft.IdentityModel.Web.SessionAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs eventArgs)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I then tried to follow the below mentioned link :
http://social.msdn.microsoft.com/Forums/en/Geneva/thread/ea00ec3f-ebdf-427c-929f-d4a196650552
But it also did not worked for me. I then tried to stop one server in the webfarm configuration and then found that the website is working fine in the IE8 and Safari browser. In IE8 browser it works all time and all the images are rendered properly but the Safari browser does not in case when both the servers in the webfarm are turned on.
On analysis I found that from ADFS I am getting some claims information in the form of cookie and the cookie length is more. For IE8 browser the cookie length is more and for Safari the permissible limit is 4097 characters.
Hence I thought of maximizing the limit of cookie for the Safari browser.
Can anyone please help me out to resolve this issue by providing any code sample.
Thanks & Regards,
Santosh Kumar Patro
The problem is now solved by enabling persistent cookies (Sticky Sessions) on the load balancer in the webfarm scenario.
I handled this issue by reducing the number of claims that are returned from STS. This will reduce the size of the cookie. I deduced another means to grab the data i needed via a service that i implemented.

VB.NET Queue constructor Error: Queue grow factor must be between 1 and 10

First some background:
VB.NET 2005 Application that accesses a MS-SQL back-end, using multiple Web Services for data gathering/publishing.
On to the error:
Our application mysteriously crashes on one of our clients computers, it works fine on the other computers in their office, but not on the big whigs' computer, which now makes it my problem. It appears to be a software conflict of some sort as they have replaced the computer (with the same software configuration I assume) but the error still persists. I'm currently waiting to hear back from their IT staff on whether there are any known differences between this user's setup and the others in that office.
What's even more annoying is the app just disappears. We can't easily debug it as no error messages are shown, even though we have specific code in there to catch unhandled exceptions and display a message, it just closes.
However, our exception handling code is being called (at least partially) because it successfully logs this following error (just does not show it to the user like other normal errors):
Error Message: Queue grow factor must be between 1 and 10.
Stack Trace: at
System.Collections.Queue..ctor(Int32 capacity, Single growFactor) at
System.Collections.Queue..ctor() at
System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous) at
System.Windows.Forms.Control.BeginInvoke(Delegate method, Object[] args) at
System.Windows.Forms.Form.OnLoad(EventArgs e) at
System.Windows.Forms.Form.OnCreateControl() at
System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at
System.Windows.Forms.Control.CreateControl() at
System.Windows.Forms.Control.WmShowWindow(Message& m) at
System.Windows.Forms.Control.WndProc(Message& m) at
System.Windows.Forms.ScrollableControl.WndProc(Message& m) at
System.Windows.Forms.ContainerControl.WndProc(Message& m) at
System.Windows.Forms.Form.WmShowWindow(Message& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at
System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Now the really curious part is that we're not using Queues at all in the code that should be running at this point. (User opens app, tries to login, bam, error happens) The only Queues referenced anywhere in code is in a very specific function that is only ever run in a testing mode in-house. And it has no problems there whatsoever.
I'm kind of at a loss as to where to proceed with this problem, so any input would be appreciated.
Edit: Ok I've finally been in contact with their IT department, he was running .NET 2.0 as I suspected. I had the IT guy repair the .NET install from Add/Remove Programs and after that the problem no longer existed. So it was in fact a .NET issue
Is it possible that this user doesn't have the appropriate .net framework? I'm guessing your application requires 2.0, but maybe he/she has 3.5? Is he running a different version of windows than the other users?
The problem is not happening with your code but the lower level .net BCL.
I had a similar problem - I found this question posted looking for answers. In my case, I'd been working along fine, then updated to latest from my source code control, and after a build all of a sudden I'm seeing this problem at program startup time. Whaaa...?? How could System.Collections.Queue..ctor() suddenly be calling System.Collections.Queue..ctor(Int32, Single) where the 2nd arg wasn't between 1 and 10?
System.ArgumentOutOfRangeException was unhandled
Message="Queue grow factor must be between 1 and 10.\r\nParameter name: growFactor"
Source="mscorlib"
ParamName="growFactor"
StackTrace:
at System.Collections.Queue..ctor(Int32 capacity, Single growFactor)
at System.Collections.Queue..ctor()
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.BeginInvoke(Delegate method, Object[] args)
at System.Windows.Forms.Control.BeginInvoke(Delegate method)
... my code below here ...
Reflector clearly shows this code:
public Queue() : this(0x20, 2f)
{
}
Turns out that prior to this code executing, I was P/Invoking to native code through a P/Invoke signature that did not match the native code (which had changed in SCM). (My build process did not properly copy the updated native DLL into the correct location.) So somehow the stack was corrupted at that point, leading to this unexplained badness.
That's one of the things I'm waiting to hear back from their IT staff about. Our app requires at least .NET 2.0, but I haven't personally done any testing with 3.5, I might have a chance to look into it later today..