Getting SetUp method failed. System.Runtime.InteropServices.COMException - windows-7

I am running tests that needs to open a new instance of IE everytime for new test.
My first test passes and closes the IE at the end and then my next test has to open a new IE but It failing at that point and giving me following error
SetUp method failed. System.Runtime.InteropServices.COMException : Creating an instance of the COM component with CLSID {0002DF01-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 800704a6.
at WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri, LogonDialogHandler logonDialogHandler, Boolean createInNewProcess)
at WatiN.Core.IE..ctor()
I am currently running them using teamcity v5.1.4, nunit 2.5.5, watin 2.0 on a windows 7 machine with .net framework 3.5
Following is the code where its failing.
<TestFixtureSetUp()> _
Public Sub Setup()
System.Threading.Thread.Sleep(100)
_internetExplorer = New IE()
LoginUser()
CheckForDataBase()
End Sub
<TestFixtureTearDown()> _
Public Sub TearDown()
Logout()
_internetExplorer.Close()
End Sub
Any idea what could be reason for this

800704a6= error ERROR_SHUTDOWN_IS_SCHEDULED from win32. Is a reboot pending?

I suggest you have a look at this Q&A session. There are lots of informations concerning your problem. It can be related to the fact that updates are scheduled on your server.

Related

ACR Reactive BluetoothLE Plugin Invalid State when starting server

I am building an iOS app with Xamarin and MvvmCross the required the use of Bluetooth LE. I am trying to use this plugin:
https://github.com/aritchie/bluetoothle
Here is my code:
var server = CrossBleAdapter.Current.CreateGattServer();
await server.Start(new AdvertisementData()); // throws exception
It throws an exception when trying to start the server:
{System.ArgumentException: Invalid State - Unknown at
Plugin.BluetoothLE.Server.GattServer.Start
(Plugin.BluetoothLE.Server.AdvertisementData adData) [0x0005f] in
<4281c4bd57f24525b20baae1afdf610b>:0
Apparently this plugin is easy to use so I must be missing something obvious?
That Exception indicates that the hardware is in invalid or initializing state and can be seen here: https://github.com/aritchie/bluetoothle/blob/master/Plugin.BluetoothLE.Apple.Shared/Server/GattServer.cs#L74
if (this.manager.State != CBPeripheralManagerState.PoweredOn)
throw new ArgumentException("Invalid State - " + this.manager.State);
I believe this is a bug in the code as it does not wait for the delegate to signal that the State has changed.
I found a solution. Instead of placing the code in my Core project, I placed it inside the iOS project itself, in a ViewDidAppear function, and placed a global variable in my UIViewController class:
private IGattServer server = CrossBleAdapter.Current.CreateGattServer();
I think you need to access the adapter with the appropriate thread, or at the appropriate time (after other initialization), hence why it was crashing before. I couldn't find an appropriate place to put this in my Core project, so I'm not sure if I have to put this code in each platform. Anyhow here's a solution for anyone else with this problem.

UFT API-test execution via vbScript

I am trying to run my API test via a vbscript file based on Automation Object Model. I am able to launch, open and run my GUI tests but for API tests I get an Error "cannot open test" code: 800A03EE.
I have read somewhere that my testcase is probably corrupted, so I saved the test as a new one but still doesn't work.
Following is my vbscript:
testPath = "absolute address to my API-test folder"
Set objUFTapp = CreateObject("QuickTest.Application")
objUFTapp.Launch
objUFTapp.Visible = TRUE
objUFTapp.Open testPath, TRUE '------> throws the error
Set pDefColl = qtApp.Test.ParameterDefinitions
Set rtParams = pDefColl.GetParameters()
Set rtParam = rtParams.Item("param1")
rtParam.Value = "value1"
objUFTapp.Test.Run uftResultsOpt,True, rtParams
objUFTapp.Test.Close
objUFTapp.Quit
For some unknown reason, I was also facing similar issue.
As a workaround, I created one GUI test from which I was calling API test like this:
RunAPITest "API_Test_Name"
To do so:
1. Create new GUI test
2. Go to Design -> Call to existing API test
3. Provide path to your API test in Test path
4. Select <Entire Test> for Call to
5. You can pass any Input or Output parameter from this screen
5. Click OK
Now, you can use your own VBScript to call this GUI test which will run your desired API test.
I know it's not good idea to do so, but it will get the job done.
By time of UFT installation we can opt for an additional automation tool, LeanFT.
As the main feature of LeanFT, we can have the test environment right next to our development environment, either in Java(Eclipse) or C#.net(Visual Studio). Also we are provided with an object identification tool (GUI spy) which makes it possible to develop GUI test not in VBScript anymore but in one of the most powerful modern languages (Java or C#). With this very short summary, let's have a look at how actually we can execute API tests outside of UFT IDE.
After a successful installation of LeanFT tool, we can create a LeanFT project in our Eclipse or Visual Studio. Create a new LeanFT project
C# code:
using HP.LFT.SDK;
using HP.LFT.SDK.APITesting.UFT;
......
[TestMethod]
public void TestMethod1()
{
Dictionary<string, object> InputParameters = new Dictionary<string, object>();
InputParameters.Add("environment", "TEST");
APITestResult ExecutionResult = APITestRunner.Run("UFT Test Path" , InputParameters);
MessageBox.Show(ExecutionResult.Status.ToString());
.....
}
For sure above code is just to give you an insight although it works pretty fine. For better diagnistic, we can take advantage of other libraries like "HP.LFT.Verifications" for checking the result
Important: You cannot use UFT and LeanFT at the same time as your runtime engine!

Session state service failed - UWP

I am working on UWP application, using Prism 6.0
My application is working totally fine in both Debug and Release modes but when i am running Windows App Certification Kit on the app packages, I keep getting this Application error - "Session state service failed". I have never seen this exception when I am installing the app packages and running the app. But I get this exception every time when WACK is running the packages.
Because of this,
I am getting error in Windows App Certification Kit - Test Results.
The error are:
FAILED
Crashes and hangs
•Error Found: The crashes and hangs test detected the following errors:◦Executable C:\Program Files\WindowsApps\10486username.SongApp_1.1.0.0_x86__5q2wmk4fv784y\SongApp.exe was detected by Windows Error Reporting and experienced a crash or hang.
◦Application 10486username.SongApp_1.1.0.0_x86__5q2wmk4fv784y was detected by Windows Error Reporting and experienced a crash or hang.
•Impact if not fixed: An app that stops responding or crashes can cause data loss and is a poor user experience.
•How to fix: Investigate and debug the app to identify and fix the problem.
FAILED
Direct3D trim after suspend
•Error Found: The Direct3D Trim after Suspend test detected the following errors:◦Application App was not running at the end of the test. It likely crashed or was terminated for having become unresponsive.
•Impact if not fixed: If the app does not call Trim on its Direct3D device, the app will not release memory allocated for its earlier 3D work. This increases the risk of apps being terminated due to system memory pressure.
•How to fix: The app should call the Trim API on its IDXGIDevice3 interface anytime it is about to be suspended.
I've built a repro with the Prism sandbox app creating a new type as model, have it serialized on suspension and watch it crash through hitting Suspend and shutdown as application lifecycle event in the Debug location toolbar.
namespace HelloWorld.Models
{
public class MyModel
{
public MyModel() {}
public MyModel(string someText)
{
SomeText = someText;
}
public string SomeText { get; set; }
}
}
In the viewmodel:
[RestorableState]
public MyModel MyModel
{
get { return _myModel; }
set { SetProperty(ref _myModel, value); }
}
After some research, I managed to solve the crash by adding following lines in the runtime directives (Default.rd.xml) file:
<!-- Add your application specific runtime directives here. -->
<Namespace Name="HelloWorld.Models" Serialize="Required PublicAndInternal">
<Type Name="MyModel" Browse="Required Public" DataContractSerializer="Required Public"/>
</Namespace>
DataContractSerializer
Optional attribute. Controls policy for serialization that uses the System.Runtime.Serialization.DataContractSerializer class.
Source: MSDN

Database access issue with Visual Studio application

I has been created a program that works with MS Access 2010 (.accdb)extension. The program is fully works fine.
The issue is:
When the program is installed into another PC that has no MS Office installed, then the Exception that defined in the program returns connection error. Yes of course because the program can't read the (.accdb) file without office installed.
Need solution:
Is there any way to import this (.accdb) in order to read and modify it. Or is there any other simple solution that works when the application is installed to any non office installed PC?
The Demo of My program Code is:
Connection String:
Imports SpeechLib
Imports System.IO
Module MdlIPray5ve
Public con As OleDb.OleDbConnection
Public cmd As OleDb.OleDbCommand
Public sql As String
Public speaker As New SpVoice
Public Function connection() As String
Try
connection = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=azan_time.accdb; Persist Security Info=False;"
Catch ex As Exception
MessageBox.Show("Could not connect to the Database. Check your Connection!")
End Try
End Function
Something that Accesses the Database:
Private Sub UpdateAlarmTone()
Try
Dim cmdText = "UPDATE alarm_tone SET subhi= #subhi1, zuhur =#zuhur1, aser = #aser1, megrib = #megrib1, isha = #isha1"
Using con As New OleDb.OleDbConnection(connection)
Using cmd As New OleDb.OleDbCommand(cmdText, con)
con.Open()
cmd.Parameters.AddWithValue("#subhi1", txtSubhi.Text)
cmd.Parameters.AddWithValue("#zuhur1", txtZuhur.Text)
cmd.Parameters.AddWithValue("#aser1", txtAser.Text)
cmd.Parameters.AddWithValue("#megrib1", txtMegrib.Text)
cmd.Parameters.AddWithValue("#isha1", txtIsha.Text)
Dim infor As String
infor = cmd.ExecuteNonQuery
If (infor > 0) Then
MsgBox("Alarm Tone record updated successfuly")
Else
MsgBox("Update failed!")
End If
End Using
End Using
Catch ex As Exception
MessageBox.Show("There is a problem with your connection!")
End Try
End Sub
create the Access database via ODBC, that comes with Windows itself.
You can also use other databases (eg., MySQL, Firebird, SQLite, and others) that are available that wouldn't necessarily cost your client anything if they installed it (or, for some, if you included it in your installation for them).
Using the MS Office COM automation requires that the MS Office product be installed on the machine running the automation.
There are third-party code libraries that replace that functionality with their own code, meaning your app could create it's own Access-compatible files. However, your users would still need Access to use them

"There is already an open DataReader..." error when using the Database.SetInitializer in the Global.Asax ApplciaitonStart

I am wondering if anyone else has had an issue with running the DB initializer from the global asax?
I have this in the ApplicationStart:
Database.SetInitializer(new MyInitializer());
That runs fine, after that once my application has started I try a login Method i created in my services. It fails when it tries to open the context.
My test application is setup almost the same way and doesn't have an issue.
Any thoughts?
Update:
I tried adding the MultipleActiveResultSets=True and now I am getting this error:
The underlying provider failed on Open.
Update 2:
Well, it turns out that my application loads while the initializer is still finishing. That is why I was getting those errors. So, what I figured out is that part of the app loads and then it must request something from the DB (at which point it created the DB and seeds it). At that point part of the application has loaded, but you don't know that the initializer is still running.
Like I sad in my updates, the DB wasn't getting created until after most of the application had run already. It was still running even though, as a user, you wouldn't know it. So I created an initialization project and added this class:
public static class InitializeAndSeed
{
public static void Initialize()
{
Database.SetInitializer(new MyContextInitializer());
using (var db = new MyContext())
{
db.Database.Initialize(false);
}
}
}
In my Applicaiton_Start() I call the InitializeAndSeed.Initialize(). Worked perfectly.
This article helped me figure that out.

Resources