From 054ac65a9db100568c8ee043d00feeeb85751c8e Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 2 Aug 2011 09:12:44 -0700 Subject: [PATCH] Very basic unit test documentation Summary: This needs work but is better than nothing. Test Plan: Generated and read documentation, clicked links. Reviewed By: edward Reviewers: edward CC: aran, edward Differential Revision: 765 --- src/docs/developer/unit_tests.diviner | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/docs/developer/unit_tests.diviner diff --git a/src/docs/developer/unit_tests.diviner b/src/docs/developer/unit_tests.diviner new file mode 100644 index 0000000000..b8b58732b4 --- /dev/null +++ b/src/docs/developer/unit_tests.diviner @@ -0,0 +1,34 @@ +@title Writing Unit Tests +@group developer + +Simple guide to libphutil, Arcanist and Phabricator unit tests. + += Overview = + +libphutil, Arcanist and Phabricator provide and use a simple unit test +framework. This document is aimed at project contributors and describes how to +use it to add and run tests in these projects or other libphutil libraries. + +In the general case, you can integrate ##arc## with a custom unit test engine +(like PHPUnit or any other unit testing library) to run tests in other projects. +See @{article:Arcanist User Guide: Customizing Lint, Unit Tests and Workflows} +for information on customizing engines. + += Adding Tests = + +To add new tests to a libphutil, Arcanist or Phabricator module: + + - Create a ##__tests__/## directory in the module if it doesn't exist yet. + - Add classes to the ##__tests__/## directory which extend from + @{class:PhabricatorTestCase} (in Phabricator) or + @{class@arcanist:ArcanistPhutilTestCase} (elsewhere). + - Run ##arc liberate## on the library root so your classes are loadable. + += Running Tests = + +Once you've added test classes, you can run them with: + + - ##arc unit path/to/module/##, to explicitly run module tests. + - ##arc unit##, to run tests for all modules affected by changes in the + working copy. + - ##arc diff## will also run ##arc unit## for you. \ No newline at end of file