Download presentation
Presentation is loading. Please wait.
Published byNigel Skinner Modified over 9 years ago
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
10
Now create a project Use to deposit code
11
Git
14
Now you need to copy in a key from Eclipse If you don’t have one, create one
15
Git
19
Now set up a remote connection so Eclipse can talk to GitLab You will need the info from GitLab
20
Git
22
Now set up windows You need to set an environment variable
23
Git
25
Now you can create a repository in on your local machine Then add the code to GitLab
26
Git
36
Now you can use Git Commit your code
37
Git
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
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?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.