Skip to content

yogjeet/Projectsubmission

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

DevOps lab 4.1 Test Driven Development (TDD)

Setup a TDD environment.

Step 1

You will need a VNC client if you haven't already got one.

If you are using an Apple Mac where is already one installed which can be accessed from Safari.

It you are using Windows and need a VNC viewer go to https://www.realvnc.com/download/viewer/windows/ and download the VNC viewer.

Step 2

We need to change the firewall rules to allow a VNC connection.

Open the Cloud Platform Console at https://console.cloud.google.com.

Go to the triple bar icon at the top left and select Networking. Then select Firewall Rules.

Select Create Firewall Rule.
Fill in the form:
Name: default-allow-vnc
Source IP: 0.0.0.0/0
Allow protocols and ports: tcp:5901
Hit Create

Go to Compute Engine and VM Instances. Start the VM if it isn’t running and connect using SSH.

Step 3

Check out the code for the lesson.

cd
git clone https://github.com/simplilearn-devops/devops-lesson-4
cd devops-lesson-4/lab-4.1

Step 4

Start the vncserver.

vncserver

Start the VNC client. You will need the external IP address of your virtual machine. Enter the following into the VNC client replacing x.x.x.x with your IP address.

x.x.x.x:5901

If you are using a Mac enter the following into Safari replacing x.x.x.x with your IP address.

vnc://x.x.x.x:5901

Dismiss any warnings about insecure connections.

The password is simplilearn.

You will be connected to the graphical desktop of the virtual machine.

Step 5

Start and use Eclipse.

In your VNC window start the File System from the desktop icon.
Select Student in the left column.
Open the eclipse folder.
Open the java-neon_ folder.
Open the eclipse folder.
Start eclipse from the diamond shaped icon.
Accept the default workspace location.

Select File->New->Java Project.
Uncheck Use default location.
Hit the Browse button. Select Home.
Open the devops-lesson-4 folder.
Open the lab-4.1 folder.
Select the FizzBuzz folder and hot OK at the bottom of the dialog.
Hit the Finish button at the bottom of the dialog.

You should see the FizzBuzz project on the left. The test folder is marked in red as there is a mising dependency.

Select the FizzBuzz project and right click. A mnu will appear. Select Properties at the bottom.

Select Java Build Path.
Select the Libraries tab.
Hit the Add Library button.
Select JUnit then hit Next.
Make sure that JUnit 4 is selected and then hit Finish. Hi OK the project errors should disappear.

Open up the soure and test folders and the devops packages. Double click on FizzBuzz.java and FizzBuzzTest.java. Editor windows will open.

Step 6

Select FizzBuzzTests.java and right click.

Select Run as then JUnit Test.

The unit tests should run successfully.

Implement the numberThreeReturnsFizz() test and run it. It should fail.

Implement the code and run it making changes until the tests pass.

If you have time implement more tests.

Step 7

Exit eclipse by slecting File->Exit.

Close the VNC viewer.

About

This is to submit numbers project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages