03.01
- 3.1 Write scripted unit tests
- Learning Objectives
- EXERCISE: View and run unit tests
- EXERCISE: View and run unit tests (OPTIONAL)
3.1 Write scripted unit tests
Learning Objectives
By the end of this lesson you will be able to:
- View and run unit tests.
EXERCISE: View and run unit tests
- From the AWSCLI instance, go to the unit test directory of the continuous_integration_example project.
Open the BeerServiceUnitTest.java file
“` $ sudo vim BeerServiceUnitTest.java
“`
EXERCISE: View and run unit tests (OPTIONAL)
- If you haven’t done so already, run the TargetEnvironment job on your Jenkins instance.
SSH into this target environment instance. Your Public DNS will be different
“` $ ssh -i cd.pem ec2-user@IPADDRESS
“`
Go to the Rails deployment directory.
“` $ cd /var/www/rails
“`
Apply database tables
“` $ sudo rake db:migrate
“`
Prepare the tests using Rake
“` $ sudo rake test:prepare
“`
Run Bundler. Files to download are specified in Gemfile
“` $ sudo bundle install
“`
Run the RSpec tests
“` $ sudo rspec spec/
“`