How to Run scripts in vm from local machine browser - virtual-machine

I am able to execute the vbs files in VM (UFT Installed).Now I want to execute the vbs files in VM from my local machine (UFT Not installed).Can any one please help me how can i connect the QTP in VM from local machine and execute scripts.
I am using below code to connect to ALM/QTP in VM . Its working good because UFT is installed in VM. But in my case i want to host that code and get URL. So that every one from my team can use that scripts from there local machines (without installing UFT).
Dim qtApp
Set qtApp = CreateObject("QuickTest.Application")
If qtApp.launched <> True then
qtApp.Launch
End If
qtApp.Visible = True
If Not qtApp.TDConnection.IsConnected Then
qtplch.TDConnection.connect "QCLink","CERNATECH","EDUTRACKER","kiran.goud","kiran123",true
End If
qtApp.Open "[QualityCenter] Subject\filePath", False
qtApp.Test.Run
qtApp.TDConnection.Disconnect
'Close QTP
qtApp.quit
'Release Object
Set qtApp = Nothing

VBS is always executed locally --> You need to keep this script on the machine where UFT is installed and provide a different way of triggering it remotely....
OR and this is a Big OR with some COM remoting use such a way:
Set qtApp = CreateObject("QuickTest.Application", "NameOfTheMachineWithUFT_Installed")
The only difference is when you create the Automation Object, you tell the system that it should be created on an other machine and not locally.
However this is a High Security Risk and in most Enterprise Networks forbidden.
I would propose a simple wrapper around your script, eposed by a URL or as already suggested, Jenkins

Related

WinAppDriver: Unable to connect to the remote server in Local Session

I am attempting to use WinAppDriver to test a classic Windows form control application on a local PC. This test is to run all on the same PC executing the code, not remotely.
However, when attempting to launch the application with WinAppDriver, the following ex occurs:
Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
I found where, for WinAppDriver, that Windows must be set to "Developer Mode", and I already have that turned on.
Here's the code I have so far, just using the Notepad.exe example for now:
Dim appCapabilities As DesiredCapabilities = New DesiredCapabilities()
appCapabilities.SetCapability("app", "C:\Windows\System32\notepad.exe")
Dim NotepadSession As New WindowsDriver(Of WindowsElement)(New Uri("http://127.0.0.1:4723"), appCapabilities)
The ex is thrown on the third line.
WinAppDriver was not actually running at the time of executing this code. I was incorrectly assuming that it was already running.
Running it beforehand resolved the error completely, and Notepad launched.

block internet access with Test Complete

Are there any way, to prevent the internet access of the tester application under the test whit Test Complete? I'd like to test the application's reaction of the lost of the internet connection, but I have to perform this whith a CI tool, which means the Test Complete have to block and unblock to connection.
You can do this using WMI directly from a script (see Working With WMI Objects in Scripts) or by executing a PowerShell script (see Running PowerShell Scripts From TestComplete).
For example, see this question to get a sample PS script:
Command/Powershell script to reset a network adapter

How to handle Outlook's "Outlook is using an old copy of your data file (.ost). Exit outlook and blablabla" error at an API level using VBScript?

I have created some automated scripts in VBS to execution some tasks automatically on a remote virtual machine. However, whenever I want to email the result to the people that it concerns, Outlook, on start, gives me this error, preventing me from sending any email. The script could not send anything until I manually dismiss this message (but I did not have to actually solve this). The client machine that sends email is a remote virtual machine. It is managed by a driver machine (another remote virtual machine) in such way that every time a new build comes out the client machine gets restored to a checkpoint and downloads the build and installs it and then tests it. It seems that since it is using a snapshot, the outlook data file will have to be out-of-sync with what's on the server, possibly causing the aforementioned error.
Does anyone know how to handle this error in VBScript? Thank you in advance!
You could try to avoid the use of outlook.ost at all. Turn off cached mode (for Exchange) or turn off any Send/Receive settings for folders. Close Outlook and rename outlook.ost to .old.
Open Outlook and check too see if outlook.ost is not created again.

Remotely control a graphical vb.net program through a command prompt

I have created a VB.NET program using windows forms. The program runs on a remote PC and displays information on a screen. The computer does not even have a mouse or keyboard connected to it. The program shows the information based on the file that is loaded.
I want to be able to change this file remotely to another file that is already on the remote PC. I can't use a graphical remote desktop client as we have very limited bandwidth.
So, my idea is to change the file using the command prompt (I think I'll need something like SSH). I'm not sure how to do this. Should I use something like this and load DosModule first:
Module DOSModule
Public Sub Main()
Console.Write("First, start with Command Prompt processing ...")
Dim myWinForm As New WinForm
Application.Run(myWinForm)
End Sub
End Module
How would I then read commands that is send to the program? I also only want one instance of the program running.
Thanks
You have 2 options. The first is a custom program that WILL require some network programming, like it or not. I would suggest creating either a Command-Line batch file or else a PowerShell script, then creating a program to transfer the script to the remote computer and execute the script.
The second option and the one better suited for you would be to download an SSH server. An SSH server will essentially open a command window and pipe the input and output over to a telnet client running on your machine. If you are running a version of Windows Server, an SSH server comes with Windows Server. Otherwise, you can download one for free here: http://www.freesshd.com/
Once you install the SSH server, you simply use telnet, from a command prompt, to link up with your remote SSH server

SSH "Framework" to write programs that will keep a connection open and feed commands to the servers

I am looking for some kind of framework that will allow me to do connect to multiple servers using SSH and keep the connection open, reopen it if it dies, and allow me to run commands to it and report back. For example, check disk space on all the machines right away, so I'd do results = object.run("df -h") and it returns an array with the response from all the machines (I am not looking for a monitoring system).
Anyone have any idea?
I would use Python and the Fabric framework. Lets you easily execute commands on a set of servers - like doing deployment
with Fabric you could do
from fabric import run, env
def getSpace(server):
env.host_string
run("df -h")
>>> fab getSpace("234.24.32.1")
One way to do this would be to use Python and the paramiko library. Writing the functionality that runs a given command on a specified set of servers is then a simple matter of programming.