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
This commit is contained in:
Michel Weststrate
2020-12-17 05:05:23 -08:00
committed by Facebook GitHub Bot
parent a9ad932955
commit 51995776d4
2 changed files with 20 additions and 6 deletions

View File

@@ -3,10 +3,18 @@ id: testing
title: 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. Developer tools are only used if they work. We have built APIs to test plugins.
## Android <Tabs defaultValue="android" values={[{label: 'Android', value: 'android'}, { label: 'iOS', value: 'ios'}]}>
<TabItem value="android">
<OssOnly>
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. 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 ```java
@@ -46,8 +54,14 @@ public void myTest() {
.build())); .build()));
} }
``` ```
</OssOnly>
## C++ <FbAndroidTesting />
</TabItem>
<TabItem value="ios">
<OssOnly>
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. 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); EXPECT_EQ(successfulResponses.back(), expectedResponse);
} }
``` ```
</OssOnly>
## Testing the Flipper Desktop Plugin <FbIosTesting />
See the [tutorial](../tutorial/js-custom#testing-plugin-logic) </TabItem>
</Tabs>

View File

@@ -105,13 +105,11 @@ module.exports = {
{ {
Android: [ Android: [
'fb/android-plugin-development-Android-interacting-0', 'fb/android-plugin-development-Android-interacting-0',
'fb/android-plugin-development-testing-android-plugins-0',
], ],
}, },
{ {
iOS: [ iOS: [
'fb/ios-plugin-development-sending-data-to-an-ios-plugin-0', 'fb/ios-plugin-development-sending-data-to-an-ios-plugin-0',
'fb/ios-plugin-development-testing-ios-plugins-0',
], ],
}, },
]), ]),