A fledgling engineer is steadily as part of self-study ... For your information.
Framework for Java unit testing (unit testing)
Tests to validate programs for classes and methods
--Design a test case that can confirm whether branching etc. is functioning correctly, considering the internal logic of the target function or method. --Often the programmers who understand the code itself do the testing themselves.
--Design test cases only from external specifications without considering internal logic ――It is necessary to be able to judge whether the program meets the requirements rather than understanding the code itself.
There are two types of techniques for black-box testing:
A test technique in which values that produce similar results are grouped together and test data is selected from each group.
A test technique that focuses on values that produce different results and selects test data near the boundary values.
The test class name is generally "class name to be tested + Test"
//Tested class(Target.java)
public class Target {
}
//Test class(TargetTest.java)
public class TargetTest {
}
TargetTest.java
@Test
public void Test() throws Exception {
//Validation of the class or method to be tested
}
--Public method -Give @ org.junit.Test --The return value is void and has no arguments.
The mechanism for verifying whether or not the measured value (actual value) and the expected value (expected value) match is called ** assertion **.
//Test code
String expected = "xxx";
String actual = yyy.zzz();
assertThat(actual, is(expected));
Recommended Posts