ВУЗ:
Составители:
Рубрика:
ɋɬɟɩɚɧɰɨɜ ȼ.Ⱥ. ɉɪɚɤɬɢɱɟɫɤɚɹ ɪɚɛɨɬɚ ɜ Eclipse 3.2
51
3. ɓɟɥɤɧɢɬɟ ɧɚ Finish ɞɥɹ ɫɨɡɞɚɧɢɹ ɤɥɚɫɫɚ ɬɟɫɬɚ.
Ⱦɨɛɚɜɶɬɟ ɦɟɬɨɞ ɬɟɫɬɢɪɨɜɚɧɢɹ ɜ ɤɥɚɫɫ
TestFailure. Ȼɵɫɬɪɵɣ ɫɩɨɫɨɛ ɫɨɡɞɚɧɢɹ
ɬɟɫɬɨɜɨɝɨ ɦɟɬɨɞɚ – ɩɪɢ ɩɨɦɨɳɢ ɲɚɛɥɨɧɚ
test. ɑɬɨɛɵ ɷɬɨ ɫɞɟɥɚɬɶ, ɜɜɟɞɢɬɟ
test ɢ Ctrl+Space ɞɥɹ ɚɤɬɢɜɢɡɚɰɢɢ ɤɨɧɬɟɧɬɧɨɣ ɩɨɦɨɳɢ ɢ ɜɵɛɟɪɢɬɟ ɲɚɛɥɨɧ
test. ɂɡɦɟɧɢɬɟ ɢɦɹ ɫɨɡɞɚɜɚɟɦɨɝɨ ɦɟɬɨɞɚ ɧɚ testFailure ɢ ɜɵɡɨɜɢɬɟ ɦɟɬɨɞ
fail(). Ɍɚɤɠɟ ɢɡɦɟɧɢɬɟ ɦɨɞɢɮɢɤɚɬɨɪ ɜɢɞɢɦɨɫɬɢ, ɱɬɨɛɵ ɷɬɨɬ ɦɟɬɨɞ
ɬɟɫɬɢɪɨɜɚɧɢɹ ɛɵɥ ɨɬɤɪɵɬɵɦ.
public void testFailure(){
fail();
}
8.1. ȼɵɩɨɥɧɟɧɢɟ ɬɟɫɬɨɜ
ɑɬɨɛɵ ɡɚɩɭɫɬɢɬɶ
TestFailure, ɚɤɬɢɜɢɡɢɪɭɣɬɟ ɜ ɩɚɧɟɥɢ ɢɧɫɬɪɭɦɟɧɬɨɜ ɢ
ɜɵɛɟɪɢɬɟ Run as > JUnit Test. Ɇɨɠɧɨ ɩɪɨɢɧɫɩɟɤɬɢɪɨɜɚɬɶ ɪɟɡɭɥɶɬɚɬɵ
ɬɟɫɬɚ ɜ ɩɪɟɞɫɬɚɜɥɟɧɢɢ
JUnit. ɗɬɨ ɩɪɟɞɫɬɚɜɥɟɧɢɟ ɩɨɤɚɡɵɜɚɟɬ ɯɨɞ
ɜɵɩɨɥɧɟɧɢɹ ɢ ɫɨɫɬɨɹɧɢɟ ɬɟɫɬɚ:
ɋɬɟɩɚɧɰɨɜ ȼ.Ⱥ. ɉɪɚɤɬɢɱɟɫɤɚɹ ɪɚɛɨɬɚ ɜ Eclipse 3.2 3. ɓɟɥɤɧɢɬɟ ɧɚ Finish ɞɥɹ ɫɨɡɞɚɧɢɹ ɤɥɚɫɫɚ ɬɟɫɬɚ. Ⱦɨɛɚɜɶɬɟ ɦɟɬɨɞ ɬɟɫɬɢɪɨɜɚɧɢɹ ɜ ɤɥɚɫɫ TestFailure. Ȼɵɫɬɪɵɣ ɫɩɨɫɨɛ ɫɨɡɞɚɧɢɹ ɬɟɫɬɨɜɨɝɨ ɦɟɬɨɞɚ – ɩɪɢ ɩɨɦɨɳɢ ɲɚɛɥɨɧɚ test. ɑɬɨɛɵ ɷɬɨ ɫɞɟɥɚɬɶ, ɜɜɟɞɢɬɟ test ɢ Ctrl+Space ɞɥɹ ɚɤɬɢɜɢɡɚɰɢɢ ɤɨɧɬɟɧɬɧɨɣ ɩɨɦɨɳɢ ɢ ɜɵɛɟɪɢɬɟ ɲɚɛɥɨɧ test. ɂɡɦɟɧɢɬɟ ɢɦɹ ɫɨɡɞɚɜɚɟɦɨɝɨ ɦɟɬɨɞɚ ɧɚ testFailure ɢ ɜɵɡɨɜɢɬɟ ɦɟɬɨɞ fail(). Ɍɚɤɠɟ ɢɡɦɟɧɢɬɟ ɦɨɞɢɮɢɤɚɬɨɪ ɜɢɞɢɦɨɫɬɢ, ɱɬɨɛɵ ɷɬɨɬ ɦɟɬɨɞ ɬɟɫɬɢɪɨɜɚɧɢɹ ɛɵɥ ɨɬɤɪɵɬɵɦ. public void testFailure(){ fail(); } 8.1. ȼɵɩɨɥɧɟɧɢɟ ɬɟɫɬɨɜ ɑɬɨɛɵ ɡɚɩɭɫɬɢɬɶ TestFailure, ɚɤɬɢɜɢɡɢɪɭɣɬɟ ɜ ɩɚɧɟɥɢ ɢɧɫɬɪɭɦɟɧɬɨɜ ɢ ɜɵɛɟɪɢɬɟ Run as > JUnit Test. Ɇɨɠɧɨ ɩɪɨɢɧɫɩɟɤɬɢɪɨɜɚɬɶ ɪɟɡɭɥɶɬɚɬɵ ɬɟɫɬɚ ɜ ɩɪɟɞɫɬɚɜɥɟɧɢɢ JUnit. ɗɬɨ ɩɪɟɞɫɬɚɜɥɟɧɢɟ ɩɨɤɚɡɵɜɚɟɬ ɯɨɞ ɜɵɩɨɥɧɟɧɢɹ ɢ ɫɨɫɬɨɹɧɢɟ ɬɟɫɬɚ: 51
Страницы
- « первая
- ‹ предыдущая
- …
- 49
- 50
- 51
- 52
- 53
- …
- следующая ›
- последняя »