Had a chance to set up cucumber tests to run via Jenkins on a Windows 10 Amazon EC2 server last week. It’s been a while since I installed everything from scratch, so that was good practice. I ran into some problems, which was a bit expected since my local setup was on Windows 7, so this post serves as a guide for possible future installations.
- Install desired browsers where the tests will run.
- Install Java and the latest JDK. Include the JDK path to Window’s system environment variables. This is necessary for running the selenium server.
- Install the latest Ruby and DevKit versions, required for installing ruby gems and running the test suite.
- Install Jenkins, which will take care of scheduling and test results reporting. Also install Jenkins as a service, to run automatically after the server boots up.
- Install Git on the machine, and setup the credentials for retrieving the test code from the remote repository.
- Check out the test code from the remote repository.
- Set the selenium server to run automatically after the machine boots.
- Install the required ruby gems using bundler.
- Check if cucumber tests run properly by running a sample via the command line interface.
- Create/Import Jenkins jobs for the cucumber tests. Install the Jenkins plugins necessary for test results reporting. Possibly set up Jenkins to pull the latest test code from the remote repository.
- Run cucumber tests via Jenkins.
Some reminders for future installs:
- Install the 32-bit version of Ruby’s DevKit instead of the 64-bit because the latter version creates problems with gem installs.
- Windows 10 has trouble installing ruby gems (using the bundle install command) from the default HTTPS source. To fix this, replace the gems source list in the Gemfile from HTTPS to HTTP.
- Install Jenkins using the MSI-based Windows installer on its own directory on the C drive, then install it as a service afterwards.
- Do not install all suggested Jenkins plugins at first, especially the ones related to Git. These will break Jenkins on Windows so install only those that are actually needed for cucumber tests to run.
- Via Jenkin’s Configure System module, set the shell executable to the location of the command line’s executable file (i.e., C:\Windows\system32\cmd.exe) so that Jenkins can run cucumber tests via the default Windows command line interface. In addition, each Jenkins job Build needs to be set as “Execute Windows Batch Command” instead of “Execute Shell”.
- Remember to change the timezone of the machine to the proper timezone.
- Test a sample basic cucumber project first to see if cucumber is properly running on the machine before retrieving the actual test suite from the Git repository.
- In saving the machine’s generated public SSH identification (via Putty or the ssh keygen command using Cygwin), do not include a name for the file to be saved so that the system generates the default id_rsa.pub file.