Presentation is loading. Please wait.

Presentation is loading. Please wait.

GIT and JUnit Dr. Andrew Wallace PhD BEng(hons) EurIng

Similar presentations


Presentation on theme: "GIT and JUnit Dr. Andrew Wallace PhD BEng(hons) EurIng"— Presentation transcript:

1 GIT and JUnit Dr. Andrew Wallace PhD BEng(hons) EurIng andrew@cs.umu.se

2 Overview Version control Git JUnit

3 Version Control Managing change Cooperation between people within a team Problem correction Alternative versions

4 Version Control Repository Check in Check out File locking Merging Labels and tagging Branching

5 Git Distributed version control Own copy of source directory Snapshot of the source directory Eclipse comes with GIT It needs setting up

6 Git Set up an account on a Git server GitLab Set up a new Git repository Generate an SSH key and add it GitLab Eclipse Commit code to GitHub

7 Git Set up an account CS servers Use CS account

8 Git

9

10 Now create a project Use to deposit code

11 Git

12

13

14 Now you need to copy in a key from Eclipse If you don’t have one, create one

15 Git

16

17

18

19 Now set up a remote connection so Eclipse can talk to GitLab You will need the info from GitLab

20 Git

21

22 Now set up windows You need to set an environment variable

23 Git

24

25 Now you can create a repository in on your local machine Then add the code to GitLab

26 Git

27

28

29

30

31

32

33

34

35

36 Now you can use Git Commit your code

37 Git

38

39

40

41

42

43

44 Team Push Pull Merge tool Branching Advanced -> tag Project and file Different Team menus.

45 JUnit Test your code in parts! Create a JUnit test case Write the test code Use asserts Run the test case

46 JUnit

47

48

49

50 import org.junit.Assert.*; public class TestMyClass { @BeforeClass public static void setUpClass() throws Exception{} @Before public static void setup() throws Exception{} @Test public void testMethod(){} } Also @After and @after class

51 JUnit

52 Asserts assertEquals(boolean expected, boolean actual) assertTrue(boolean expected, boolean actual) assertFalse(boolean expected, boolean actual) assertNotNull(Object object) assertSame(Object object) assertNotSame(Object object) assertArrayEquals(Object object)

53 JUnit Use asserts to check for things that should never happen Array over runs Null pointers Wrong values Divide by zero Check your assumptions Use exceptions for things that can go wrong! IO errors Memory errors User inputs

54 JUnit Sunny Day Test for what you expect As specified What can go wrong?

55 Questions?


Download ppt "GIT and JUnit Dr. Andrew Wallace PhD BEng(hons) EurIng"

Similar presentations


Ads by Google