package Ġorg . jetbrains . dok ka . gradle Ċ Ċ import Ġorg . gradle . test kit . runner . Task Outcome Ċ import Ġorg . junit . Test Ċ import Ġjava . io . File Ċ import Ġjava . nio . file . Files Ċ import Ġkotlin . test . assertEquals Ċ Ċ class ĠAndroid App Test Ġ: ĠAbstract D ok ka Gradle Test () Ġ{ ĊĠĠĠ Ġoverride Ġval Ġplugin Classpath : ĠList < File > Ġ= Ġandroid Plugin Classpath Data . to File (). read Lines (). map Ġ{ ĠFile ( it ) Ġ} ĊĊĠĠĠ Ġfun Ġprepare TestData ( testData RootPath : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠtestData Root Ġ= ĠtestData Folder . resolve ( testData RootPath ) ĊĠĠĠĠĠĠĠ Ġval Ġtmp Root Ġ= Ġtest Project Dir . root . to Path () ĊĊĠĠĠĠĠĠĠ ĠtestData Root . resolve (" app "). copy ( tmp Root . resolve (" app ")) ĊĠĠĠĠĠĠĠ ĠtestData Root . resolve (" build . gradle "). copy ( tmp Root . resolve (" build . gradle ")) ĊĠĠĠĠĠĠĠ ĠtestData Root . resolve (" settings . gradle "). copy ( tmp Root . resolve (" settings . gradle ")) ĊĊĠĠĠĠĠĠĠ Ġandroid Local Properties ?. copy ( tmp Root . resolve (" local . properties ")) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġdata Ġclass ĠAndroid Plugin Params ( val Ġplugin Version : ĠString , Ġval Ġbuild Tools Version : ĠString , Ġval Ġcompile Sdk : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġas Arguments (): ĠList < String > Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"- P ab t _ plugin _ version =$ plugin Version ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"- P ab t _ version =$ build Tools Version ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"- P sdk _ version =$ compile Sdk " ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġprivate Ġfun Ġdo Test ( gradle Version : ĠString , Ġkotlin Version : ĠString , Ġandroid Plugin Params : ĠAndroid Plugin Params ) Ġ{ ĊĠĠĠĠĠĠĠ Ġprepare TestData (" android App ") ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġconfigure ( gradle Version , Ġkotlin Version , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġarguments Ġ= ĠarrayOf (" dok ka ", Ġ"-- stack trace ") Ġ+ Ġandroid Plugin Params . as Arguments ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġprintln ( result . output ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( Task Outcome . SUCCESS , Ġresult . task (": app : dok ka ") ?. outcome ) ĊĊĠĠĠĠĠĠĠ Ġval Ġdocs Output Ġ= Ġ" app / build / dok ka " ĊĊĠĠĠĠĠĠĠ Ġcheck Output Structure (" android App / file Tree . txt ", Ġdocs Output ) ĊĊĠĠĠĠĠĠĠ Ġcheck NoError Classes ( docs Output ) ĊĠĠĠĠĠĠĠ Ġcheck NoUn resolved Links ( docs Output ) ĊĊĠĠĠĠĠĠĠ Ġcheck External Link ( docs Output , Ġ"< span Ġclass =\" identifier \"> Activity </ span >", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ""" < a Ġhref =" https :// developer . android . com / reference / android / app / Activity . html ">< span Ġclass =" identifier "> Activity </ span ></ a > """) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test Ġfun Ġ` test Ġkotlin Ġ 1 _ 1 _ 2 - 5 Ġand Ġgradle Ġ 4 _ 0 Ġand Ġab t Ġ 3 _ 0 _ 0 - alpha 3 `() Ġ{ ĊĠĠĠĠĠĠĠ Ġdo Test (" 4 . 0 ", Ġ" 1 . 1 . 2 - 5 ", ĠAndroid Plugin Params (" 3 . 0 . 0 - alpha 3 ", Ġ" 2 5 . 0 . 2 ", Ġ 2 5 )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test Ġfun Ġ` test Ġkotlin Ġ 1 _ 1 _ 2 Ġand Ġgradle Ġ 3 _ 5 Ġand Ġab t Ġ 2 _ 3 _ 0 `() Ġ{ ĊĠĠĠĠĠĠĠ Ġdo Test (" 3 . 5 ", Ġ" 1 . 1 . 2 ", ĠAndroid Plugin Params (" 2 . 3 . 0 ", Ġ" 2 5 . 0 . 0 ", Ġ 2 4 )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test Ġfun Ġ` test Ġkotlin Ġ 1 _ 0 _ 7 Ġand Ġgradle Ġ 2 _ 1 4 _ 1 Ġand Ġab t Ġ 2 _ 2 _ 3 `() Ġ{ ĊĠĠĠĠĠĠĠ Ġdo Test (" 2 . 1 4 . 1 ", Ġ" 1 . 0 . 7 ", ĠAndroid Plugin Params (" 2 . 2 . 3 ", Ġ" 2 5 . 0 . 0 ", Ġ 2 4 )) ĊĠĠĠ Ġ} Ċ }