{"id":19847068,"url":"https://github.com/polidea/the-missing-android-xml-junit-test-runner","last_synced_at":"2025-05-01T21:31:54.604Z","repository":{"id":16164140,"uuid":"18910287","full_name":"Polidea/the-missing-android-xml-junit-test-runner","owner":"Polidea","description":"Test runner that produces standard junit XML output file","archived":false,"fork":false,"pushed_at":"2016-08-03T13:32:46.000Z","size":121,"stargazers_count":22,"open_issues_count":2,"forks_count":10,"subscribers_count":10,"default_branch":"master","last_synced_at":"2023-04-01T06:23:05.422Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Polidea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-18T10:37:12.000Z","updated_at":"2023-04-01T06:23:05.423Z","dependencies_parsed_at":"2022-09-19T01:10:09.470Z","dependency_job_id":null,"html_url":"https://github.com/Polidea/the-missing-android-xml-junit-test-runner","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polidea%2Fthe-missing-android-xml-junit-test-runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polidea%2Fthe-missing-android-xml-junit-test-runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polidea%2Fthe-missing-android-xml-junit-test-runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polidea%2Fthe-missing-android-xml-junit-test-runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Polidea","download_url":"https://codeload.github.com/Polidea/the-missing-android-xml-junit-test-runner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224278376,"owners_count":17285080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T13:13:20.561Z","updated_at":"2024-11-12T13:13:21.082Z","avatar_url":"https://github.com/Polidea.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\n\n__This repository is no longer maintained. Issue reports and pull requests will not be attended.__\n\n---\n\n##Introduction\nStandard android test runner does not produce a very usable output from tests, if you want to process the output and produce some useful reports. \nThis is for example where you run android tests using Jenkins/Hudson/Bamboo. All these are capable of parsing standard XML junit output and presenting it in a nice way. \n\n##The runner\nThe missing junit test runner provides that capability. As opposed to some other projects, the runner is built as an Instrumentation Test runner, \nthanks to that you can use all the android standard command line parameters, that you would normally use. You can run only small or only big tests, \nyou can run emma coverage tests and whatever else android test framework lets you do.\n\n##Running\nThe test runner should be added to the test project. Either as a .jar file (added in libs directory) or as external library (standard android external library approach). \n\nIn order to use the runner you need to:\n\n1. add it to AndroidManifest.xml of your test project:\n  ```\n      \u003cinstrumentation android:name=\"pl.polidea.instrumentation.PolideaInstrumentationTestRunner\"\n                       android:targetPackage=\"pl.polidea.somepackage\"\n                       android:label=\"Tests for pl.polidea.somepackage\"/\u003e\n  ```\n\n2. run the tests by specifying the runner on command line, for example\n    ```\n        adb shell am instrument -w somepackage/pl.polidea.instrumentation.PolideaInstrumentationTestRunner\n    ```\n    or with extra parameters:\n    ```\n        adb shell am instrument -e junitSplitLevel class -w somepackage/pl.polidea.instrumentation.PolideaInstrumentationTestRunner\n    ```\n\nMore info about running test runners can be found [here](http://developer.android.com/guide/developing/testing/testing_otheride.html#RunTestsCommand).\n\nYou can also use standard android test tasks. Your build.xml might look like:\n```\n        \u003cproject name=\"Test\" default=\"help\"\u003e\n            \u003cproperty file=\"local.properties\" /\u003e\n            \u003cproperty file=\"build.properties\" /\u003e\n            \u003cproperty file=\"default.properties\" /\u003e\n            \u003cimport file=\"${sdk.dir}/tools/ant/pre_setup.xml\" /\u003e\n            \u003cproperty name=\"test.runner\" value=\"pl.polidea.instrumentation.PolideaInstrumentationTestRunner\" /\u003e\n            \u003csetup import=\"no\" /\u003e\n            \u003cimport file=\"${sdk.dir}/tools/ant/test_rules.xml\" /\u003e\n        \u003c/project\u003e\n``` \nand then you can execute \"ant run-tests\" or \"ant coverage\".\n\n##Supported parameters\nThe parameters supported by runner are:\n    \n| *Parameter* | *Description* |\n|-------------|---------------|\n| junitXmlOutput | boolean (\"true\"/\"false\") indicating whether XML Junit output should be produced at all. Default is true |\n| junitOutputDirectory | string specifying in which directory the XML files should be placed. Be careful when setting this parameter. TestRunner deletes all the files matching postfix and single filename before running from this directory. Default is the on-device local \"files\" directory for the TESTED application (not TESTING application!). Usually it is /data/data/`\u003c`package`\u003e`/files |\n| junitOutputFilePostfix | string specifying what is the postfix of files created. Default value is \"-TEST.xml\". The files are always prefixed with package name with the exception of top-level, root package |\n| junitNoPackagePrefix | string specifying what is the prefix in case test is in top-level directory (i.e. has no package). Default value is \"NO_PACKAGE\" |\n| junitSplitLevel | string specifying what splitting will be applied. The runner can split the test results into several files: either per class, package or it can produce a single big file for all tests run. Allowed value are \"class\", \"package\" or \"none\". Default value is \"package\" |\n| junitSingleFileName | string specifying what name will be given to output file in case the split is \"none\". Default value is ALL-TEST.xml |\n\n##Getting the JUnit results \nXML files are generated on the device (or emulator) in /data/data/`\u003cYOUR_APP_PACKAGE\u003e`/files/ and you need to download the files after test using adb pull in order to process them. \nThis can be done with command line or step similar to the following added to the build:\n```\n  \u003cexec executable=\"${adb}\" failonerror=\"true\" dir=\"junit-results\"\u003e\n    \u003carg line=\"${adb.device.arg}\" /\u003e\n    \u003carg value=\"pull\" /\u003e\n    \u003carg value=\"/data/data/${tested.manifest.package}/files/\" /\u003e\n  \u003c/exec\u003e\n```\n\nThere is one file generated per each package containing test case classes (potentially containing multiple test case classes).\n\n##Analysing the results\nThe XML produced by the runner is compatible with standard junit generated files. It can be displayed by various plugins of CI servers (Jenkins/Hudson/Bamboo). \nYou can also import it into Junit view of eclipse and display the results there (including ability to click-to-go-to-source code)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolidea%2Fthe-missing-android-xml-junit-test-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolidea%2Fthe-missing-android-xml-junit-test-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolidea%2Fthe-missing-android-xml-junit-test-runner/lists"}