Automated testing of InstallAnywhere wizard - java

I need to automate installation process of some product, but it has to be exactly installation through passing InstallAnywhere wizard (it's kinda GUI testing of installation process, so silent install won't work).
Any suggestion how to do this?
I guess the main problem is that installation file (*.exe) is just extractor which extract required files to temp folder and then run java application.

You may try pywinauto to test it on Windows. Java part of the installer may require new "UIA" back-end which will be released in March. For early testing you may try the following steps:
Install pyWin32 and comtypes by pip install pypiwin32 and pip install comtypes.
Install UIA branch of pywinauto by python setup.py install.
Try the following code:
import pywinauto
pywinauto.backend.activate('uia')
app = pywinauto.Application().start('your_installer_path.exe')
app.ApproximateMainWindowName.Wait('ready', timeout=15)
app.ApproximateMainWindowName.PrintControlIdentifiers()
PrintControlIdentifiers output is a hint for further steps. There are possible access names for the controls on the window. Only basic functionality like ClickInput() and TypeKeys('something') should work for now.
Available methods for the control can be advised here:
app.MainWindow.OKButton.WrapperObject(). # methods list can be displayed here in IDLE or Visual Studio Python Tools
app.MainWindow.OKButton.WrapperObject().ClickInput() # code for debugging
#app.MainWindow.OKButton.ClickInput() # it works the same way, for production code
Feel free to ask more help if something doesn't work.
Python scripts may require running as Administrator to have an access to the GUI. Or add manifest for python.exe with uiAccess="true".

Related

How to import FFMPEG Library in my maven project?

I have a Spring-boot project, where I am using the ffmpeg library, I am executing the ffmpeg commands through a ProcessBuilder(in the terminal/cmd) and everything works fine, because I have already installed the ffmpeg on my macOS. When I try to generate a jar and run it on an another machine, where ffmpeg is not installed, it is executed, everything works fine, except the ffmpeg comamnds. Is there any change to import the library to my maven project or somehow to use it?
Is it a good idea to add an external jar of the library?
Thank you in advance!
Is the server you're deploying to Mac (same as your desktop) or Windows/Linux? The reason I ask is because ffmpeg is a binary app and has to be compiled to the specific platform.
You could include ffmpeg in maven, but before it runs it will need to be compiled. I found one maven repository here, though I do not know how well this will work: https://mvnrepository.com/artifact/com.tagtraum/ffmpeg/4.0.0. You could also try compiling from source (particularly if there's some non-standard encoding/decoding you're trying to do), which is a much more involved installation.
What I would do is install ffmpeg through a separate installation package, ideally through the OS's package management system; for linux this would be something like:
(Ubuntu)
sudo apt-get install ffmpeg
(CentOS)
sudo yum install epel-release
sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm
sudo yum install ffmpeg ffmpeg-devel
More info on installation here:
https://www.ostechnix.com/install-ffmpeg-linux/
Sometimes these packages may be not be the latest or missing something you're trying to do, in which case you may need to compile from source.
Edit: You say you're using Windows. I'm not as familiar with deploying to Windows, but there are ffmpeg Windows packages available on this site (linked from the main ffmpeg page): https://ffmpeg.zeranoe.com/builds/ . I recommend installing separately rather than trying to package with your Java app. This page can help: https://windowsloop.com/install-ffmpeg-windows-10/
I’m not sure if Maven have a plug in for that, but I’d add a shell script to install ffmpeg, let’s call it resources/scripts/myscript.sh, in the script first validate it’s not installed already, then use wget to download what you need , install it , and continue with you app.
You can call this script from your app as the first thing to do

Could not find or load main class com.nabinbhandari.lam.Main

I've read a lot of troubleshooting for similar occurrences of this error, but what is causing it for this particular .jar?
https://download.cnet.com/android/nabin-bhandari/3260-20_4-10982661-1.html
It works on Windows, but when attempting to run the file on a raspbian (linux) system running java version 1.8.0_65 with the command java -jar Local\ Area\ Messenger\ Desktop.jar it throws the error about not being able to find or load the main class.
The MANIFEST.MF defines Main-Class: com.nabinbhandari.lam.Main and there doesn't appear to be any issues with case sensitivity.
What am I missing? Do I need to install something more than Java Runtime Environment?
Edit: In case it is not clear, I am not the developer of this file. I am simply a user trying to run the file. This question has nothing to do with Eclipse and I don't understand why people are linking to that other question. I am not running Eclipse. Please stop linking to that. Please examination the .jar file I have provided.
Edit 2: I have followed the instructions and in this answer:
https://stackoverflow.com/a/1238173/2407742
It gives the error no main manifest attribute, in test.jar
Is there something missing from my java runtime environment? It seems like nothing works.
The Local Area Network Messenger application was developed using JavaFX, which is not included in the Oracle Java build for Rasperry Pi. I had to reinstall Java and then openjfx by doing the following:
sudo apt-get purge openjdk-8-jre-headless
sudo apt-get install openjdk-8-jre-headless
sudo apt-get install openjdk-8-jre
sudo apt-get install openjfx
It runs fine now.
The solution to this was the following:
Close Eclipse/STS
Use a file explorer on your operating system to navigate to your workspace (In my case, I'm on Windows so I used Windows Explorer)
Delete the .metadata directory (or to be safe, copy the directory somewhere else to be safe, then delete it)
Restart Eclipse/STS
Is there a more improved answer than this? I don't want to look like I'm trying to boost my own reputation points, so if someone can provide a better answer then please do so.

install selenium via command or website?

I need help with knowing whether the best way to install selenium is via command line on Mac, or via the selenium website. Same for chrome or IE.exe, should that be installed via command line or the actual website?
If you recommend installing via the website how would that work out for running tests via CI (Jenkins) on other machines - we would practically need to install selenium/ or browser.exe on every machine right? Which is why I thought it may make more sense to install all this via command line.
Either way, any opinions would be greatly appreciated.
1) For run by Jenkins, the better way it's to setup a selenium grid follow guide: https://github.com/SeleniumHQ/selenium/wiki/Grid2
with seleniu grid, you not need to setup selenium on each jenkins salve. because
grid will supply browser machine for your test.
2) For run/debug on local, i recommend a way to setup selenium and chrome.exe/IE.exe by webdriver-manager, which is a Nodejs package.
so you need to install NodeJS firstly.
a. install nodejs:https://nodejs.org/en/download/package-manager/#macos
b. execute 'npm install -g webdriver-manager' in terminal
c. execute 'npm config get preifx', it will print out a path in terminal
d. export above path in PATH environment
e. execute 'webdriver-manager version' to check PATH evnrionment work as expect
3) the command to install selenium stuffs like:
webdriver-manager update --verions.standalone=3.4.0 --versions.chrome=2.30 --versions.ie=
or just webdriver-manager update , this will install latest version of selenium server jar and chromedriver.exe for chrome and geckodriver.exe for firefox.
A reminder: latest version may not compatible with your local browser. so I think you need use options: --versions.xxxx=xxxxx to install certain version.
if latest version not caompatible with your local browser, and you want to start a selenium server, you also need to append the versions options like used in update:
webdriver-manager start --versions.chome=xxxxx (if you need run with chrome)
--versions.gecko=xxxx (if run with firefox) --version.ie=xxxx (if run with ie)
all avaiable options you can get by execute webdriver-manager help as below:
webdriver-manager update --ie

How to execute Carrot2 Document Clustering server

I downloaded the Carrot2 Document clustering server build 3.15.0 for Mac. The read me file says:
The DCS requires a Java Runtime Environment (JRE) version 1.7.0 or later. To
run the DCS, execute the 'dcs' script and point your browser at
http://localhost:8080 for further instructions.
Mac OS Sierra doesn't make it easy, but I got 1.8.0_112 installed.
The problem is that I don't know how to execute the 'dcs' script.
There are .cmd, .sh, .war, and .jar files. I wasn't sure which of those to work with. I thought .jar looked promising, so I followed some of this thread and tried this in a terminal window:
java -jar invoker.jar
I cd-ed to the correct directory, but it just says Provide main class, but I'm not sure what or where that is.
Can anybody provide instructions or a link to how to do this?
Use the dcs.sh (on Linux/Mac) and dcs.cmd (on Windows) to start the server. The scripts will set some extra options for the JVM and then start the DCS. In case of any problems, append the -v option to see diagnostic output.

Creating a Native OSX Executable for Java from Windows

I have a program written in java that I'd like to provide native-style wrappers for. My target platforms are OSX, Windows, and Linux.
I have Windows and Linux working "good enough" right now. It'd be nice to provide a windows installer, a linux rpm, and a linux .deb, but for now I'm relatively satisfied with the package I provide to the user on those two platforms. I think it is relatively intuitive, feels native, and is easy to use.
For Windows
I use launch4j to create a native executable.
I package the native executable, jars, stripped JRE, and resource files in .zip
The user downloads the zip, extracts the folder inside, and double clicks the executable.
While this method doesn't have an installer, I feel it's "native-enough".
For Linux
I have a simple C++ program serving as a native 32-bit executable, which launches java targeting my jar file.
I package the native executable, jars, stripped JRE, and resource files in .tar.gz
The user downloads the .tar.gz, extracts the folder inside, and double clicks the executable (or calls it from the console).
While I think it would be nice to distribute via .rpms and .debs, and to provide native icon support for at least KDE and gnome, I'm also happy with this result for the time being.
Here is the native executable code, for anyone who is interested.
/*Compile this on a linux machine to create a local nix executable
g++ -m32 -o executable-name this-file-name.cpp
-m32 forces 32 bit mode, which should help compatibility
*/
#include <stdio.h>
#include <cstdlib>
int main() {
int result = system( "java -jar TARGET_JAR.jar 2> /dev/null > /dev/null " );
if ( result != 0 ) {
printf ( "PROGRAM_NAME requires Java, but Java isn't in your path. Please make sure Java is installed and 'java' is visible in your path. Once you've done that, please run this executable to run PROGRAM_NAME!\n" );
}
}
I intend to modify this for the upcoming release to also use an embedded jre, but that is a trivial change.
For OSX
I don't have a working system yet. Here is what I'd like:
User downloads a .dmg file, which contains an .app.
I'd like for the .app to:
Have an embedded JRE
Be double clickable
Build can be automated with ANT.
My previous attempts at creating this app failed miserably. I tried:
Appbundler: I could not get the examples to work. I believe the source of the problem was working in a windows environment, but perhaps I was just doing things wrong.
Rolling my own .app: This failed, as you can see in the thread.
javapackager (included with java 8): I similarly could not get this to work. As it's a new tool, there is a sparsity of examples in the wild, and the tool seems immature and focused on webstart; the windows installer I got when trying to create the native windows package was primitive and I could not get it to include other non-jar resources.
webstart: I don't want .jnlps. I can't have icons or embedded jres.
I feel like there should be an easy way to roll my own .app. As far as I can tell, apps are just directories with special structures and a Info.plist.
However, I'm open to any suggestions that work. In the end, as long as I get a package that feels native on OSX and can be automated with ANT, I'll be very happy.
Thank you!
You will need a Mac computer with Xcode installed in order to do this.

Categories

Resources