Peb puas tuaj yeem tsim qhov tseem ceeb tsis zoo hauv Testng?
Peb puas tuaj yeem tsim qhov tseem ceeb tsis zoo hauv Testng?

Video: Peb puas tuaj yeem tsim qhov tseem ceeb tsis zoo hauv Testng?

Video: Peb puas tuaj yeem tsim qhov tseem ceeb tsis zoo hauv Testng?
Video: Plab Plab Ntswg..(Pluav Pluav Ntswg) Maiv Twm New Song 2023-2024 2024, Kaum ib hlis
Anonim

Ua ntej yog ib qho khoom siv tsuas yog rau @Test annotated txoj kev. Ua ntej yuav tsum yog tus nqi integer. Nws ua tau ua tsis zoo , xoom lossis tus lej zoo. TestNG yuav ua cov txheej txheem kuaj los ntawm qis tshaj mus rau siab tshaj qhov tseem ceeb.

Ib yam li ntawd, kuv yuav teeb tsa qhov tseem ceeb hauv TestNG li cas?

Koj tuaj yeem khiav ib zaug lossis ntau qhov kev xeem hauv koj li Kev xeem code. Yog xeem qhov tseem ceeb tsis tau txhais thaum, khiav ntau qhov kev xeem, TestNG assigns tag nrho @Test a qhov tseem ceeb uas zero(0). Tam sim no, thaum khiav; qis qhov tseem ceeb yuav teem caij ua ntej.

Tsis tas li ntawd, peb puas tuaj yeem kho cov ntawv ceeb toom TestNG? Peb tau qhia TestNG ua ntej qhia html thiab xml cov ntaub ntawv hauv kab lus TestNG Report Piv txwv. Tab sis koj tej zaum yuav pom nws tsis txaus rau koj . TestNG muab IReporter interface uas koj ua tau siv nws los tsim ib qho kev xeem cov ntsiab lus mloog. Ces koj tuaj yeem kho cov ntaub ntawv hauv nws generateReport() method.

Hauv qhov no, dab tsi yog qhov tseem ceeb hauv TestNG?

Cov ua ntej qhov tseem ceeb ntawm kev xeem thaum tsis tau teev tseg yog integer tus nqi 0. Yog li, yog tias peb muaj ib qho kev xeem nrog qhov tseem ceeb 1 thiab ib yam tsis muaj qhov tseem ceeb tus nqi ces qhov kev xeem yam tsis muaj qhov tseem ceeb tus nqi yuav tau ua ntej (as ua ntej tus nqi yuav yog 0 thiab kev xeem nrog qis dua qhov tseem ceeb raug tua ua ntej).

Peb puas tuaj yeem tsim qhov tseem ceeb hauv Junit?

8 Teb. Feem ntau, koj ua tau ' tsis qhia meej qhov kev txiav txim uas cais chav ntsuas kev khiav hauv (tab sis koj ua tau qhia qhov tseem ceeb hauv TestNG thiab muaj qhov sib txawv qhov tseem ceeb rau txhua qhov kev xeem). Txawm li cas los xij, chav ntsuas yuav tsum muaj peev xwm ua tau nyob rau hauv kev sib cais, yog li qhov kev txiav txim ntawm qhov kev xeem yuav tsum tsis muaj teeb meem. Qhov no yog kev coj tsis zoo.

Pom zoo: