Auto install setup in virtual machine - unit-testing

I have a build system, it makes me the build of my c# software, and then runs a build to make my setup and deploys it into a repository.
Now, what I need is, after this deployment, I need this setup installed on a virtual machine or sandbox.
How can I do that? Is there any software that does this for me?
For example, after the build of setup is done, this software with my own configuration, takes my setup and install in silent mode in this VM/ sandbox, and then if I want I can run also tests.
The main idea is, whenever a build is deployed, it's automatically installed in a machine for me, to quickly see the result/ run tests, otherwise I need always, after build, open machine, install and test.

You can look into the use of Vagrant with VirtualBox for such a setup.
Once you finish the build and have the installer ready, you can mount/copy it into a new VM you provision with Vagrant.
You then add the installation command to your Vagrantfile (file describing your VM configuration and setup).
This is a very common setup for automated build, install and test scenarios.
I hope this helps.

Related

How to create a Windows VM in GCP such that we can use it in Jenkins for automated tests

I am looking for a help on GCP where I want to create a Windows VM and which will have Java and some browsers like say Chrome. Once this is done I wanted to integrate this VM to Jenkins such that whenever a automated build runs in Jenkins it will run those automated tests say Selenium on VM machine and creates the reports and so on. Is it possible via GCP. Please let me know and guide me on this and please share any tutorial for sample.
Thanks a lot.
I don't think any of the images provided by GCP have that software installed, I mean you need to install manually or you can use startup-script to automate some of this task,
this is a quick information to get you started:
Create Windows Instance
Install java or JDK
Install chrome
Install jenkins
Automate the task with jenkins and windows
As alternative you can deploy from Marketplace, find the Jenkis which is installed on a Windows VM and then install the other components(chrome & java)
considers that some marketplace solutions has an additional cost

Node.JS native addons on LINUX [duplicate]

I'm using AWS Lambda, which involves creating an archive of my node.js script, including the node_modules folder and uploading that to their infrastructure to run.
This works fine, except when it comes to node modules with native bindings (using node-gyp). Because the binding was complied and project archived on my local computer (OS X), it is not compatible with AWS's (Amazon Linux) servers.
How can I cross-compile/install a node module (specifically, node-sqlite3) so when I upload it to another server arch it runs?
While not really a solution to your problem, a very easy workaround could be to simply compile the native addons on a Linux machine.
For your particular situation, I would use Vagrant. Vagrant can create virtual machines and configure them within seconds.
Find an OS image that resembles Amazon's Linux distro (Fedora, CentOS, others that use yum as package manager - see Wiki)
Use a simple configuration script that, when run by Vagrant on machine startup, will run npm install (optionally it might also remove the node_modules folder before to ensure a clean installation)
For extra comfort, the script can also create the zip file for deployment
Once the installation finishes, the script will shutdown the VM to avoid unnecessary consumption of system resources
Deploy!
It might require some tuning if the linked libraries are not at the same place on the target machine but generally this seems to me like the best and quickest solution.
While installing the app using Vagrant might be sufficient in some cases, I have found it necessary to build the app on Linux which is as close to Lambda's Amazon Linux AMI as possible.
You can read the original answer here: https://stackoverflow.com/a/34019739/303184
Steps to make it work:
Spawn new EC2 instance. Make sure it is based on exactly the same image as your AWS Lambda runtime. You can review Lambda env details here: http://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html. In our case, it was Amazon Linux AMI called amzn-ami-hvm-2015.03.0.x86_64-gp2.
Install nvm and use it to install the same version of Node.js as on the AWS Lambda. At the time of writing this, it was v0.10.36. You can refer to http://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html again to find out.
You will probably need to install git & g++ compiler on the EC2. You can do this running
sudo yum install git gcc-c++
Finally, clone your app to your new EC2 and install your app's dependecies:
nvm use 0.10.36
npm install --production
You can then easily download the node_modules using scp or such.
Same lines as Robert's answer, when I had to work on my MAC in a different OS I use vm ware like Oracle's free virtualizer VirtualBox to get a linux on my mac, no cost to me. Or sign up for a new AWS account, you get a micro for a year free. Use that to get your linux box, do whatever you need there.
AWS has a page describing how to deal with native NPM modules: https://aws.amazon.com/blogs/compute/nodejs-packages-in-lambda/

Selenium cloud execution on a machine without code or IDE

I set up my Selenium project (Maven, Java, TestNG) in GitHub repo and it is connected to Jenkins. I am able to execute the Maven project via Jenkins and do the testing. This requires all dependant tools (Maven,Java,Jenkins) set up in my local machine.
But we have a requirement to do this in the cloud. I know we can use Selenium Grid-Docker, BrowserStack or GCP to execute the tests in the cloud but what we need is to have everything installed in the cloud and any external user with access being able to execute any test via UI or executable file without installing anything in user's local machine.
Is this possible at all? If yes,how?
I searched a lot and couldn't find anything. One of my friends said it can be done using AWS but doesn't know how. I just need guidance on the path to take here and I'm willing to learn and implement it myself.
Solved this my deploying code to AWS-EC2.
Here's what I did.
I created a TestNG-Maven project and uploaded to GitHub. Then created a AWS-EC2 t2.micro linux instance and installed Chrome and Jenkins in it. I accessed Jenkins from my local machine and connected it to GitHub repo. From Jenkins when I build the project everything was getting downloaded in EC2 and execution happened in EC2. This will be chrome-headless execution.

Does beaker support run job without re-install operating system?

beaker is a automation tool: https://beaker-project.org/. Does beaker support run job/task without re-install operating system in a machine?
In a scheduled job Beaker will always re-install the machine, there is currently no way to avoid that. (I would like to implement optionally skipping the installation for a recipe, one day.)
If you want to run Beaker tasks on some existing system without re-installing it, maybe because you are testing some changes to a task and you don't want to wait for Anaconda over and over again, you can use the restraint harness. It has a client mode command where you can give it a Beaker recipe XML file and it will run it.
Restraint can also fetch task source from git directly, which is particularly handy if you are testing your own patches for a task.
You can grab pre-built restraint packages from the Beaker harness yum repos.

How to automate installer testing

I'm wondering if anyone has any best practices for automating the testing of installers on various machines with potentially different hardware / software profiles and by specifying various options to the installer. The idea would be that I could write "unit test like" code to set up a machine, run the installer, then test that certain things are true. Tests might look similar to:
Test:
Boot Machine without IIS
Run Installer
Assert Installer Had Errors
Test:
Boot Machine with IIS
Run Installer
Assert Installer Ran
Test_Fixture:
SetUp:
Boot Machine with IIS
Test:
Run Installer without IIS install
Assert Website Not Installed
Test:
Run Installer with IIS install
Assert Website Installed
I know I could create lots of VMs, but waiting for a VM to boot for each functional test sounds like way more work than I want. What I really want is a way to virtualize the installer environment. Any suggestions?
We have created a set of VMs and find it is very easy to manage. We run the tests for 13 different Windows installers over night. The VMs we have created our very bare bones, so it is possible to run a number of tests in parallel.
If you have the installer runnable from the command line, it's easy to have a script to call it automatically.
Then you can use a web app testing tool to see it the install was successful, like this one http://seleniumhq.org/ For this you will need an unique way to test a new install - like a page with the current version.