From 51995776d4ddf0c075e06e4879306304f39ff059 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Thu, 17 Dec 2020 05:05:23 -0800 Subject: [PATCH] Combine client testing documentation Summary: There was one public page for testing client plugins, and two internal ones. Combined it into a one pager, that has tabs per target, with separate content for internal versus external (didn't combine those as the testing frameworks recommended differ) Reviewed By: nikoant Differential Revision: D25588058 fbshipit-source-id: afa151ec0c3a5de26142938d3d389627716f1ff7 --- docs/extending/testing.mdx | 24 ++++++++++++++++++++---- website/sidebars.js | 2 -- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/extending/testing.mdx b/docs/extending/testing.mdx index 40dd6c945..c21681bea 100644 --- a/docs/extending/testing.mdx +++ b/docs/extending/testing.mdx @@ -3,10 +3,18 @@ id: testing title: Testing --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import {FbInternalOnly, OssOnly} from 'internaldocs-fb-helpers'; +import FbIosTesting from '../fb/ios-plugin-development-testing-ios-plugins-0.mdx'; +import FbAndroidTesting from '../fb/android-plugin-development-testing-android-plugins-0.mdx'; + Developer tools are only used if they work. We have built APIs to test plugins. -## Android + + + Start by creating your first test file in this directory `MyFlipperPluginTest.java`. In the test method body we create our plugin which we want to test as well as a `FlipperConnectionMock`. In this contrived example we simply assert that our plugin's connected status is what we expect. ```java @@ -46,8 +54,14 @@ public void myTest() { .build())); } ``` + -## C++ + + + + + + Start by creating your first test file in this directory `MyFlipperPluginTests.cpp` and import the testing utilities from `fbsource//xplat/sonar/xplat:FlipperTestLib`. These utilities mock out core pieces of the communication channel so that you can test your plugin in isolation. @@ -93,7 +107,9 @@ TEST(MyFlipperPluginTests, testDummy) { EXPECT_EQ(successfulResponses.back(), expectedResponse); } ``` + -## Testing the Flipper Desktop Plugin + -See the [tutorial](../tutorial/js-custom#testing-plugin-logic) + + diff --git a/website/sidebars.js b/website/sidebars.js index b23a6cf94..966a87184 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -105,13 +105,11 @@ module.exports = { { Android: [ 'fb/android-plugin-development-Android-interacting-0', - 'fb/android-plugin-development-testing-android-plugins-0', ], }, { iOS: [ 'fb/ios-plugin-development-sending-data-to-an-ios-plugin-0', - 'fb/ios-plugin-development-testing-ios-plugins-0', ], }, ]),