{"action":"created","comment":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/comments/73537899","id":73537899,"diff_hunk":"@@ -0,0 +1,187 @@\n+# Testing in mbed OS 5\n+\n+The way tests are ran and compiled in mbed OS 5 is substantially different than in previous versions of mbed. Previously tests were located in one known location and a python file was kept (`tools/tests.py`) keeping track of their dependencies, capabilities, and configurations. mbed OS 5 has adopted a more distributed approach to testing. Now test code lives alongside the test code, and these are dynamically discovered by the test tools.\n+\n+## Table of Contents\n+\n+- [Using tests](#using-tests)\n+  - [Test code structure](#test-code-structure)\n+    - [Test discovery](#test-discovery)\n+    - [Test names](#test-names)\n+  - [Building tests](#building-tests)\n+  - [Running tests](#running-tests)\n+  - [Writing tests](#writing-tests)\n+- [Debugging tests](#debugging-tests)\n+- [Known issues](#known-issues)\n+\n+## Test code structure\n+\n+Tests can exist throughout mbed OS and your project's code. They are located under a special directory called `TESTS` (case is important!).\n+\n+Placing code under this directory means it will be ignored when building applications and libraries. This code is only ever used when building tests. This is important since all tests require a `main()` function, and building it with your application would cause multiple `main()` functions to be defined.\n+\n+In addition to being placed under a `TESTS` directory, test sources must exist under two other directories: a \"test group\" folder and a \"test case\" folder. The following is an example of this structure:\n+```\n+myproject/TESTS/test_group/test_case_1\n+```\n+\n+In this example, `myproject` is the project root and all the source files under the `test_case_1` directory will be included in the test. Any other source files from the OS, libraries, and your project that apply to your target's configuration will also be included in the build of your test.\n+\n+### Test discovery\n+\n+Since test cases can exist throughout a project, the tools must find them in your project's file structure before building them. This is done by searching for paths that match the pattern detailed above in the [Test code structure](#test-code-structure) section.\n+\n+Test discovery also obeys the same rules that is used when building your project. This means that tests that are placed under a folder with a prefix like `TARGET_`, `TOOLCHAIN_`, or `FEATURE_` will only be discovered, built, and ran if your current configuration matches this prefix.\n+\n+For example, if a test was placed under the folder `FEATURE_BLE` with the following path:\n+\n+```\n+myproject/mbed-os/features/FEATURE_BLE/TESTS/ble_tests/unit_test\n+```\n+\n+This test case would only be discovered if the target that was being testing supported the BLE feature. Otherwise, the test will be ignored.","path":"docs/testing_mbed_OS_5.md","position":42,"original_position":42,"commit_id":"78b9c39f9d6c608e0b7209b0765cb3e91aed3529","original_commit_id":"78b9c39f9d6c608e0b7209b0765cb3e91aed3529","user":{"login":"iriark01","id":10846349,"avatar_url":"https://avatars.githubusercontent.com/u/10846349?v=3","gravatar_id":"","url":"https://api.github.com/users/iriark01","html_url":"https://github.com/iriark01","followers_url":"https://api.github.com/users/iriark01/followers","following_url":"https://api.github.com/users/iriark01/following{/other_user}","gists_url":"https://api.github.com/users/iriark01/gists{/gist_id}","starred_url":"https://api.github.com/users/iriark01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iriark01/subscriptions","organizations_url":"https://api.github.com/users/iriark01/orgs","repos_url":"https://api.github.com/users/iriark01/repos","events_url":"https://api.github.com/users/iriark01/events{/privacy}","received_events_url":"https://api.github.com/users/iriark01/received_events","type":"User","site_admin":false},"body":"\"will only be\"\r\n\"being tested\"\r\n\"supports\"\r\n","created_at":"2016-08-04T14:55:22Z","updated_at":"2016-08-04T14:55:22Z","html_url":"https://github.com/ARMmbed/mbed-os/pull/2364#discussion_r73537899","pull_request_url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/2364","_links":{"self":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/comments/73537899"},"html":{"href":"https://github.com/ARMmbed/mbed-os/pull/2364#discussion_r73537899"},"pull_request":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/2364"}}},"pull_request":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/2364","id":79994385,"html_url":"https://github.com/ARMmbed/mbed-os/pull/2364","diff_url":"https://github.com/ARMmbed/mbed-os/pull/2364.diff","patch_url":"https://github.com/ARMmbed/mbed-os/pull/2364.patch","issue_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2364","number":2364,"state":"open","locked":false,"title":"Adding docs for the testing process for mbed OS 5","user":{"login":"bridadan","id":3123977,"avatar_url":"https://avatars.githubusercontent.com/u/3123977?v=3","gravatar_id":"","url":"https://api.github.com/users/bridadan","html_url":"https://github.com/bridadan","followers_url":"https://api.github.com/users/bridadan/followers","following_url":"https://api.github.com/users/bridadan/following{/other_user}","gists_url":"https://api.github.com/users/bridadan/gists{/gist_id}","starred_url":"https://api.github.com/users/bridadan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bridadan/subscriptions","organizations_url":"https://api.github.com/users/bridadan/orgs","repos_url":"https://api.github.com/users/bridadan/repos","events_url":"https://api.github.com/users/bridadan/events{/privacy}","received_events_url":"https://api.github.com/users/bridadan/received_events","type":"User","site_admin":false},"body":"This adds documentation describing how tests are built and ran within mbed OS 5.\r\nThis doesn't cover the mbed CLI commands, but rather the underlying build and test runner process that's occurring when making the calls to mbed CLI and the underlying scripts.\r\n\r\nIt also describes how to debug tests with IDEs in conjunction with the test tools.\r\n\r\nPlease review @iriark01 \r\nFYI @mazimkhan @adbridge ","created_at":"2016-08-03T23:07:33Z","updated_at":"2016-08-04T14:55:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe0ac2ec6e4d36b0418d0810e24ad683bb5a053d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/2364/commits","review_comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/2364/comments","review_comment_url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2364/comments","statuses_url":"https://api.github.com/repos/ARMmbed/mbed-os/statuses/78b9c39f9d6c608e0b7209b0765cb3e91aed3529","head":{"label":"bridadan:add-testing-docs","ref":"add-testing-docs","sha":"78b9c39f9d6c608e0b7209b0765cb3e91aed3529","user":{"login":"bridadan","id":3123977,"avatar_url":"https://avatars.githubusercontent.com/u/3123977?v=3","gravatar_id":"","url":"https://api.github.com/users/bridadan","html_url":"https://github.com/bridadan","followers_url":"https://api.github.com/users/bridadan/followers","following_url":"https://api.github.com/users/bridadan/following{/other_user}","gists_url":"https://api.github.com/users/bridadan/gists{/gist_id}","starred_url":"https://api.github.com/users/bridadan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bridadan/subscriptions","organizations_url":"https://api.github.com/users/bridadan/orgs","repos_url":"https://api.github.com/users/bridadan/repos","events_url":"https://api.github.com/users/bridadan/events{/privacy}","received_events_url":"https://api.github.com/users/bridadan/received_events","type":"User","site_admin":false},"repo":{"id":31221716,"name":"mbed","full_name":"bridadan/mbed","owner":{"login":"bridadan","id":3123977,"avatar_url":"https://avatars.githubusercontent.com/u/3123977?v=3","gravatar_id":"","url":"https://api.github.com/users/bridadan","html_url":"https://github.com/bridadan","followers_url":"https://api.github.com/users/bridadan/followers","following_url":"https://api.github.com/users/bridadan/following{/other_user}","gists_url":"https://api.github.com/users/bridadan/gists{/gist_id}","starred_url":"https://api.github.com/users/bridadan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bridadan/subscriptions","organizations_url":"https://api.github.com/users/bridadan/orgs","repos_url":"https://api.github.com/users/bridadan/repos","events_url":"https://api.github.com/users/bridadan/events{/privacy}","received_events_url":"https://api.github.com/users/bridadan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bridadan/mbed","description":"mbed libraries and tools","fork":true,"url":"https://api.github.com/repos/bridadan/mbed","forks_url":"https://api.github.com/repos/bridadan/mbed/forks","keys_url":"https://api.github.com/repos/bridadan/mbed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bridadan/mbed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bridadan/mbed/teams","hooks_url":"https://api.github.com/repos/bridadan/mbed/hooks","issue_events_url":"https://api.github.com/repos/bridadan/mbed/issues/events{/number}","events_url":"https://api.github.com/repos/bridadan/mbed/events","assignees_url":"https://api.github.com/repos/bridadan/mbed/assignees{/user}","branches_url":"https://api.github.com/repos/bridadan/mbed/branches{/branch}","tags_url":"https://api.github.com/repos/bridadan/mbed/tags","blobs_url":"https://api.github.com/repos/bridadan/mbed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bridadan/mbed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bridadan/mbed/git/refs{/sha}","trees_url":"https://api.github.com/repos/bridadan/mbed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bridadan/mbed/statuses/{sha}","languages_url":"https://api.github.com/repos/bridadan/mbed/languages","stargazers_url":"https://api.github.com/repos/bridadan/mbed/stargazers","contributors_url":"https://api.github.com/repos/bridadan/mbed/contributors","subscribers_url":"https://api.github.com/repos/bridadan/mbed/subscribers","subscription_url":"https://api.github.com/repos/bridadan/mbed/subscription","commits_url":"https://api.github.com/repos/bridadan/mbed/commits{/sha}","git_commits_url":"https://api.github.com/repos/bridadan/mbed/git/commits{/sha}","comments_url":"https://api.github.com/repos/bridadan/mbed/comments{/number}","issue_comment_url":"https://api.github.com/repos/bridadan/mbed/issues/comments{/number}","contents_url":"https://api.github.com/repos/bridadan/mbed/contents/{+path}","compare_url":"https://api.github.com/repos/bridadan/mbed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bridadan/mbed/merges","archive_url":"https://api.github.com/repos/bridadan/mbed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bridadan/mbed/downloads","issues_url":"https://api.github.com/repos/bridadan/mbed/issues{/number}","pulls_url":"https://api.github.com/repos/bridadan/mbed/pulls{/number}","milestones_url":"https://api.github.com/repos/bridadan/mbed/milestones{/number}","notifications_url":"https://api.github.com/repos/bridadan/mbed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bridadan/mbed/labels{/name}","releases_url":"https://api.github.com/repos/bridadan/mbed/releases{/id}","deployments_url":"https://api.github.com/repos/bridadan/mbed/deployments","created_at":"2015-02-23T18:09:54Z","updated_at":"2016-02-22T21:41:48Z","pushed_at":"2016-08-03T23:11:00Z","git_url":"git://github.com/bridadan/mbed.git","ssh_url":"git@github.com:bridadan/mbed.git","clone_url":"https://github.com/bridadan/mbed.git","svn_url":"https://github.com/bridadan/mbed","homepage":null,"size":55393,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ARMmbed:master","ref":"master","sha":"89962277c20729504d1d6c95250fbd36ea5f4a2d","user":{"login":"ARMmbed","id":8916057,"avatar_url":"https://avatars.githubusercontent.com/u/8916057?v=3","gravatar_id":"","url":"https://api.github.com/users/ARMmbed","html_url":"https://github.com/ARMmbed","followers_url":"https://api.github.com/users/ARMmbed/followers","following_url":"https://api.github.com/users/ARMmbed/following{/other_user}","gists_url":"https://api.github.com/users/ARMmbed/gists{/gist_id}","starred_url":"https://api.github.com/users/ARMmbed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARMmbed/subscriptions","organizations_url":"https://api.github.com/users/ARMmbed/orgs","repos_url":"https://api.github.com/users/ARMmbed/repos","events_url":"https://api.github.com/users/ARMmbed/events{/privacy}","received_events_url":"https://api.github.com/users/ARMmbed/received_events","type":"Organization","site_admin":false},"repo":{"id":8270972,"name":"mbed-os","full_name":"ARMmbed/mbed-os","owner":{"login":"ARMmbed","id":8916057,"avatar_url":"https://avatars.githubusercontent.com/u/8916057?v=3","gravatar_id":"","url":"https://api.github.com/users/ARMmbed","html_url":"https://github.com/ARMmbed","followers_url":"https://api.github.com/users/ARMmbed/followers","following_url":"https://api.github.com/users/ARMmbed/following{/other_user}","gists_url":"https://api.github.com/users/ARMmbed/gists{/gist_id}","starred_url":"https://api.github.com/users/ARMmbed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARMmbed/subscriptions","organizations_url":"https://api.github.com/users/ARMmbed/orgs","repos_url":"https://api.github.com/users/ARMmbed/repos","events_url":"https://api.github.com/users/ARMmbed/events{/privacy}","received_events_url":"https://api.github.com/users/ARMmbed/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ARMmbed/mbed-os","description":null,"fork":false,"url":"https://api.github.com/repos/ARMmbed/mbed-os","forks_url":"https://api.github.com/repos/ARMmbed/mbed-os/forks","keys_url":"https://api.github.com/repos/ARMmbed/mbed-os/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ARMmbed/mbed-os/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ARMmbed/mbed-os/teams","hooks_url":"https://api.github.com/repos/ARMmbed/mbed-os/hooks","issue_events_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/events{/number}","events_url":"https://api.github.com/repos/ARMmbed/mbed-os/events","assignees_url":"https://api.github.com/repos/ARMmbed/mbed-os/assignees{/user}","branches_url":"https://api.github.com/repos/ARMmbed/mbed-os/branches{/branch}","tags_url":"https://api.github.com/repos/ARMmbed/mbed-os/tags","blobs_url":"https://api.github.com/repos/ARMmbed/mbed-os/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ARMmbed/mbed-os/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ARMmbed/mbed-os/git/refs{/sha}","trees_url":"https://api.github.com/repos/ARMmbed/mbed-os/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ARMmbed/mbed-os/statuses/{sha}","languages_url":"https://api.github.com/repos/ARMmbed/mbed-os/languages","stargazers_url":"https://api.github.com/repos/ARMmbed/mbed-os/stargazers","contributors_url":"https://api.github.com/repos/ARMmbed/mbed-os/contributors","subscribers_url":"https://api.github.com/repos/ARMmbed/mbed-os/subscribers","subscription_url":"https://api.github.com/repos/ARMmbed/mbed-os/subscription","commits_url":"https://api.github.com/repos/ARMmbed/mbed-os/commits{/sha}","git_commits_url":"https://api.github.com/repos/ARMmbed/mbed-os/git/commits{/sha}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/comments{/number}","issue_comment_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/comments{/number}","contents_url":"https://api.github.com/repos/ARMmbed/mbed-os/contents/{+path}","compare_url":"https://api.github.com/repos/ARMmbed/mbed-os/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ARMmbed/mbed-os/merges","archive_url":"https://api.github.com/repos/ARMmbed/mbed-os/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ARMmbed/mbed-os/downloads","issues_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues{/number}","pulls_url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls{/number}","milestones_url":"https://api.github.com/repos/ARMmbed/mbed-os/milestones{/number}","notifications_url":"https://api.github.com/repos/ARMmbed/mbed-os/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ARMmbed/mbed-os/labels{/name}","releases_url":"https://api.github.com/repos/ARMmbed/mbed-os/releases{/id}","deployments_url":"https://api.github.com/repos/ARMmbed/mbed-os/deployments","created_at":"2013-02-18T15:23:11Z","updated_at":"2016-08-04T14:42:27Z","pushed_at":"2016-08-04T14:23:35Z","git_url":"git://github.com/ARMmbed/mbed-os.git","ssh_url":"git@github.com:ARMmbed/mbed-os.git","clone_url":"https://github.com/ARMmbed/mbed-os.git","svn_url":"https://github.com/ARMmbed/mbed-os","homepage":"","size":70057,"stargazers_count":695,"watchers_count":695,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":695,"mirror_url":null,"open_issues_count":310,"forks":695,"open_issues":310,"watchers":695,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/2364"},"html":{"href":"https://github.com/ARMmbed/mbed-os/pull/2364"},"issue":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2364"},"comments":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2364/comments"},"review_comments":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/2364/comments"},"review_comment":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/2364/commits"},"statuses":{"href":"https://api.github.com/repos/ARMmbed/mbed-os/statuses/78b9c39f9d6c608e0b7209b0765cb3e91aed3529"}}}}
{"actor":{"display_login":"iriark01"}}