kevingurney commented on code in PR #38459:
URL: https://github.com/apache/arrow/pull/38459#discussion_r1371852002


##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).

Review Comment:
   ```suggestion
   When adding new tests, it is recommended to, at a minimum, ensure that 
real-world workflows work as expected.
   
   ## MATLAB Class-Based Unit Testing Framework
   
   All tests for the MATLAB interface should use the [MATLAB Class-Based Unit 
Testing 
Framework](https://www.mathworks.com/help/matlab/class-based-unit-tests.html) 
(i.e. they should use 
[`matlab.unittest.TestCase`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html)).
   ```



##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  

Review Comment:
   ```suggestion
   The goal of this document is to provide helpful guidelines for testing 
functionality within the [`matlab` 
directory](https://github.com/apache/arrow/tree/main/matlab) of the 
[`apache/arrow`](https://github.com/apache/arrow) repository.  
   ```



##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+

Review Comment:
   It might be helpful to add a sentence like:
   
   "Included below is an example of how to generate a MATLAB code coverage 
report using the `runtests` command.



##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  
+
+- Test directory maps source directory. For example, the test directory 
`test/arrow/array/` contains all tests for the source directory 
`src/matlab/+arrow/+array/`.  
+- One test for one source file. For example, `test/arrow/array/tArray.m` is 
the test file for `src/matlab/+arrow/+array/Array.m`.  

Review Comment:
   ```suggestion
   - One test file maps to one source file. For example, 
[`test/arrow/array/tArray.m`](https://github.com/apache/arrow/blob/main/matlab/test/arrow/array/tArray.m)
 is the test file for 
[`src/matlab/+arrow/+array/Array.m`](https://github.com/apache/arrow/blob/main/matlab/src/matlab/%2Barrow/%2Barray/Array.m).
  
   ```



##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  
+
+- Test directory maps source directory. For example, the test directory 
`test/arrow/array/` contains all tests for the source directory 
`src/matlab/+arrow/+array/`.  

Review Comment:
   ```suggestion
   - Source and test directories follow an (approximately) "parallel" 
structure. For example, the test directory 
[`test/arrow/array`](https://github.com/apache/arrow/tree/main/matlab/test/arrow/array)
 contains tests for the source directory 
[`src/matlab/+arrow/+array`](https://github.com/apache/arrow/tree/main/matlab/src/matlab/%2Barrow/%2Barray).
  
   ```



##########
matlab/doc/testing_guidelines_for_the_matlab_interface_to_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Testing Guidelines for the MATLAB Interface to Apache Arrow  
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  
+
+- Test directory maps source directory. For example, the test directory 
`test/arrow/array/` contains all tests for the source directory 
`src/matlab/+arrow/+array/`.  
+- One test for one source file. For example, `test/arrow/array/tArray.m` is 
the test file for `src/matlab/+arrow/+array/Array.m`.  
+
+## When tests are run  
+
+When pushing changes to the `matlab` directory, GitHub Actions is used to 
automatically trigger tests under `matlab/test` to run. Currently, all tests 
under `matlab/test` are configured to run. In the future when the run time of 
running tests becomes a concern, we will consider doing source to test mapping 
and only triggering related tests to run.  
+
+## How to Write Tests  
+
+Tests for MATLAB interface should use the MATLAB testing framework 
[`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
 Here is a simple example.  
+
+```matlab
+classdef tArray < matlab.unittest.TestCase
+    methods(Test)
+        function InferNullsTrue(testCase)
+            matlabArray = [1 2 NaN 3];
+            arrowArray = arrow.array(matlabArray, InferNulls=true);
+            testCase.verifyEqual(arrowArray.Valid, [true; true; false; true]);
+        end
+    end
+end
+```
+
+More test examples can be found in the directory `matlab/test`.  
+
+## How to Run Tests Locally on Your Own Machine  
+
+### Prerequisites  

Review Comment:
   Maybe we should move this up higher in the document? In my head, it feels 
like I would typically expect to see prerequisites higher up in documentation.
   
   Also, we can probably remove the mention of the MATLAB testing framework 
here, since it is mentioned several other times in the document.



##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  
+
+- Test directory maps source directory. For example, the test directory 
`test/arrow/array/` contains all tests for the source directory 
`src/matlab/+arrow/+array/`.  
+- One test for one source file. For example, `test/arrow/array/tArray.m` is 
the test file for `src/matlab/+arrow/+array/Array.m`.  

Review Comment:
   It might be helpful to add some kind of note here, like:
   
   ```suggestion
   **Note**: In certain scenarios, it can make sense to diverge from these 
rules. For example, if a particular class is very complex and contains a lot of 
divergent functionality (which we generally try to avoid), we might choose to 
split the testing into several "focused" test files (e.g. one for testing the 
class display, one for testing the properties, and one for testing the methods).
   ````



##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  

Review Comment:
   ```suggestion
   ## General Guidelines
   ```



##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  

Review Comment:
   ```suggestion
   When making changes to the MATLAB interface, please do your best to add 
tests to cover all changed lines, conditions, and decisions.
   
   Before making a pull request, please check the code coverage for any changed 
code. If possible, it can be helpful to explicitly comment on the code coverage 
in your pull request description.  
   
   Although we strive for high code coverage, it is understood that some code 
cannot be reasonably tested (e.g. an "un-reachable" branch in a `switch` 
condition on an enumeration value).
   ```



##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.

Review Comment:
   We no longer support using GoogleTest for C++ unit tests.
   
   One approach for testing C++ code (which, at least right now, mainly 
consists of `Proxy` method calls) would be to create a `Proxy` instance 
manually in MATLAB and call the method from a MATLAB test case.
   
   If we find that there is more C++ code that needs to be tested in the future 
(beyond simple `Proxy` method calls), then we could considering exposing a 
custom MEX entry-point for calling C++ code from MATLAB.



##########
matlab/doc/testing_guidelines_for_the_matlab_interface_to_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Testing Guidelines for the MATLAB Interface to Apache Arrow  
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  
+
+- Test directory maps source directory. For example, the test directory 
`test/arrow/array/` contains all tests for the source directory 
`src/matlab/+arrow/+array/`.  
+- One test for one source file. For example, `test/arrow/array/tArray.m` is 
the test file for `src/matlab/+arrow/+array/Array.m`.  
+
+## When tests are run  
+
+When pushing changes to the `matlab` directory, GitHub Actions is used to 
automatically trigger tests under `matlab/test` to run. Currently, all tests 
under `matlab/test` are configured to run. In the future when the run time of 
running tests becomes a concern, we will consider doing source to test mapping 
and only triggering related tests to run.  
+
+## How to Write Tests  

Review Comment:
   ```suggestion
   ## Writing Tests
   ```



##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  

Review Comment:
   ```suggestion
   To generate a MATLAB code coverage report, the 
[`ReportCoverageFor`]((https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e))
 name-value pair argument can be supplied to the 
[`runtests`](https://www.mathworks.com/help/matlab/ref/runtests.html) command.
   
   **Note**: Using the `runtests` command with `ReportCoverageFor` requires 
MATLAB *R2023b or newer*.
   ```



##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.

Review Comment:
   I think it might be better to move this to a "Tips" section at the bottom of 
the document since, hopefully, most contributors won't run into this issue.
   
   Also, it would be helpful to define what "shadowing" means. For example: 
https://stackoverflow.com/questions/15939754/what-does-shadows-it-in-the-matlab-path-mean-how-to-do-it-in-a-file.



##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  

Review Comment:
   ```suggestion
   ## Organization of Test Files
   ```



##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  
+
+- Test directory maps source directory. For example, the test directory 
`test/arrow/array/` contains all tests for the source directory 
`src/matlab/+arrow/+array/`.  
+- One test for one source file. For example, `test/arrow/array/tArray.m` is 
the test file for `src/matlab/+arrow/+array/Array.m`.  
+
+## When tests are run  

Review Comment:
   ```suggestion
   ## Continuous Integration (CI) Workflows
   ```



##########
matlab/doc/testing_guidelines_for_the_matlab_interface_to_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Testing Guidelines for the MATLAB Interface to Apache Arrow  
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  
+
+- Test directory maps source directory. For example, the test directory 
`test/arrow/array/` contains all tests for the source directory 
`src/matlab/+arrow/+array/`.  
+- One test for one source file. For example, `test/arrow/array/tArray.m` is 
the test file for `src/matlab/+arrow/+array/Array.m`.  
+
+## When tests are run  
+
+When pushing changes to the `matlab` directory, GitHub Actions is used to 
automatically trigger tests under `matlab/test` to run. Currently, all tests 
under `matlab/test` are configured to run. In the future when the run time of 
running tests becomes a concern, we will consider doing source to test mapping 
and only triggering related tests to run.  
+
+## How to Write Tests  
+
+Tests for MATLAB interface should use the MATLAB testing framework 
[`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
 Here is a simple example.  

Review Comment:
   As noted above, all tests for the MATLAB interface should use the MATLAB 
[Class-Based Unit-Testing 
Framework](https://www.mathworks.com/help/matlab/class-based-unit-tests.html).
   
   Generally speaking, writing a new test involves creating a subclass of the 
[`matlab.unittest.TestCase`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html)
 class. Each method of the class should focus on testing one "behavior" of the 
software. Avoid testing several, unrelated "behaviors" in a single test method.
   
   Included below is a simple example of a test which verifies that an 
`arrow.array.Array` can be created successfully from a MATLAB array.
   
   ```matlab
   lassdef tStringArray < matlab.unittest.TestCase
       methods(Test)
           function TestBasicStringArray(testCase)
               % Verify that an `arrow.array.StringArray` can be created from
               % a basic MATLAB `string` array using the `arrow.array` gateway
               % construction function.
               % Create a basic MATLAB array.
               matlabArray = ["A" ,"B", "C"];
               % Create an `arrow.array.StringArray` from the MATLAB `string`
               % array by using the `arrow.array` gateway construction function.
               arrowArray = arrow.array(matlabArray);
               % `arrowArray` should have class `arrow.array.StringArray`.
               expected = "arrow.array.StringArrray";
               % Get the class name of `arrowArray`.
               actual = string(class(arrowArray));
               % Verify the class of `arrowArray` is `arrow.array.StringArray`.
               testCase.verifyEqual(actual, expected);
           end
       end
   end
   ```



##########
matlab/doc/testing_guidelines_for_the_matlab_interface_to_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Testing Guidelines for the MATLAB Interface to Apache Arrow  
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  
+
+- Test directory maps source directory. For example, the test directory 
`test/arrow/array/` contains all tests for the source directory 
`src/matlab/+arrow/+array/`.  
+- One test for one source file. For example, `test/arrow/array/tArray.m` is 
the test file for `src/matlab/+arrow/+array/Array.m`.  
+
+## When tests are run  
+
+When pushing changes to the `matlab` directory, GitHub Actions is used to 
automatically trigger tests under `matlab/test` to run. Currently, all tests 
under `matlab/test` are configured to run. In the future when the run time of 
running tests becomes a concern, we will consider doing source to test mapping 
and only triggering related tests to run.  

Review Comment:
   I think it may make sense to remove the note about possible future plans to 
selectively run tests due to time concerns since that doesn't feel directly 
relevant to helping new contributors get started with testing in the MATLAB 
interface.
   
   ```suggestion
   The Apache Arrow project uses [GitHub 
Actions](https://github.com/features/actions) as its primary [Continuous 
Integration (CI)](https://en.wikipedia.org/wiki/Continuous_integration) 
platform.
   
   Creating a pull request that changes code in the MATLAB interface will 
automatically trigger [MATLAB CI 
Workflows](https://github.com/apache/arrow/actions/workflows/matlab.yml) to be 
run. These CI workflows will run all tests located under the `matlab/test` 
directory.
   
   Reviewers will generally expect the MATLAB CI Workflows to be passing 
successfully before they will consider merging a pull request.
   
   If you are having trouble understanding CI failures, you can always ask a 
reviewer or another community member for help.
   ```



##########
matlab/doc/testing_guidelines_for_the_matlab_interface_to_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Testing Guidelines for the MATLAB Interface to Apache Arrow  
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  
+
+- Test directory maps source directory. For example, the test directory 
`test/arrow/array/` contains all tests for the source directory 
`src/matlab/+arrow/+array/`.  
+- One test for one source file. For example, `test/arrow/array/tArray.m` is 
the test file for `src/matlab/+arrow/+array/Array.m`.  
+
+## When tests are run  
+
+When pushing changes to the `matlab` directory, GitHub Actions is used to 
automatically trigger tests under `matlab/test` to run. Currently, all tests 
under `matlab/test` are configured to run. In the future when the run time of 
running tests becomes a concern, we will consider doing source to test mapping 
and only triggering related tests to run.  
+
+## How to Write Tests  
+
+Tests for MATLAB interface should use the MATLAB testing framework 
[`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
 Here is a simple example.  
+
+```matlab
+classdef tArray < matlab.unittest.TestCase
+    methods(Test)
+        function InferNullsTrue(testCase)
+            matlabArray = [1 2 NaN 3];
+            arrowArray = arrow.array(matlabArray, InferNulls=true);
+            testCase.verifyEqual(arrowArray.Valid, [true; true; false; true]);
+        end
+    end
+end
+```
+
+More test examples can be found in the directory `matlab/test`.  
+
+## How to Run Tests Locally on Your Own Machine  

Review Comment:
   ```suggestion
   ## Running Tests Locally
   ```



##########
matlab/doc/guideline_for_writing_tests_for_MATLAB_interface_for_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Guideline for Writing Tests for MATLAB Interface for Apache Arrow
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  

Review Comment:
   ```suggestion
   All tests for the MATLAB interface are located under the `matlab/test` 
directory.
   
   To make it easy to find the test files which correspond to specific source 
files, the MATLAB interface tests are organized using the following rules:  
   ```



##########
matlab/doc/testing_guidelines_for_the_matlab_interface_to_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Testing Guidelines for the MATLAB Interface to Apache Arrow  
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  
+
+- Test directory maps source directory. For example, the test directory 
`test/arrow/array/` contains all tests for the source directory 
`src/matlab/+arrow/+array/`.  
+- One test for one source file. For example, `test/arrow/array/tArray.m` is 
the test file for `src/matlab/+arrow/+array/Array.m`.  
+
+## When tests are run  
+
+When pushing changes to the `matlab` directory, GitHub Actions is used to 
automatically trigger tests under `matlab/test` to run. Currently, all tests 
under `matlab/test` are configured to run. In the future when the run time of 
running tests becomes a concern, we will consider doing source to test mapping 
and only triggering related tests to run.  
+
+## How to Write Tests  
+
+Tests for MATLAB interface should use the MATLAB testing framework 
[`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
 Here is a simple example.  
+
+```matlab
+classdef tArray < matlab.unittest.TestCase
+    methods(Test)
+        function InferNullsTrue(testCase)
+            matlabArray = [1 2 NaN 3];
+            arrowArray = arrow.array(matlabArray, InferNulls=true);
+            testCase.verifyEqual(arrowArray.Valid, [true; true; false; true]);
+        end
+    end
+end
+```
+
+More test examples can be found in the directory `matlab/test`.  

Review Comment:
   ```suggestion
   More test examples can be found in the  `matlab/test` directory.  
   ```



##########
matlab/doc/testing_guidelines_for_the_matlab_interface_to_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Testing Guidelines for the MATLAB Interface to Apache Arrow  
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  
+
+- Test directory maps source directory. For example, the test directory 
`test/arrow/array/` contains all tests for the source directory 
`src/matlab/+arrow/+array/`.  
+- One test for one source file. For example, `test/arrow/array/tArray.m` is 
the test file for `src/matlab/+arrow/+array/Array.m`.  
+
+## When tests are run  
+
+When pushing changes to the `matlab` directory, GitHub Actions is used to 
automatically trigger tests under `matlab/test` to run. Currently, all tests 
under `matlab/test` are configured to run. In the future when the run time of 
running tests becomes a concern, we will consider doing source to test mapping 
and only triggering related tests to run.  
+
+## How to Write Tests  
+
+Tests for MATLAB interface should use the MATLAB testing framework 
[`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
 Here is a simple example.  
+
+```matlab
+classdef tArray < matlab.unittest.TestCase
+    methods(Test)
+        function InferNullsTrue(testCase)
+            matlabArray = [1 2 NaN 3];
+            arrowArray = arrow.array(matlabArray, InferNulls=true);
+            testCase.verifyEqual(arrowArray.Valid, [true; true; false; true]);
+        end
+    end
+end
+```
+
+More test examples can be found in the directory `matlab/test`.  
+
+## How to Run Tests Locally on Your Own Machine  
+
+### Prerequisites  
+
+The tests are written by using MATLAB testing framework 
[`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
 To run the tests on your machine, the following software must be installed on 
your machine:  
+
+1. [MATLAB](https://www.mathworks.com/products/get-matlab.html)
+2. [MATLAB Interface to Apache 
Arrow](https://github.com/mathworks/arrow/tree/main/matlab)  
+
+### Run tests in MATLAB  
+
+To run the MATLAB tests, start MATLAB and then cd to the test directory where 
test files of interest reside.  Call the `runtests` command to run your tests:  
+
+```matlab
+>> runtests(testFileName) % For example runtests("tArray.m")
+```
+
+To learn more about `runtests`, please check [the document of 
`runtests`](https://www.mathworks.com/help/matlab/ref/runtests.html).  

Review Comment:
   I think it would be helpful to add a note about `IncludeSubFolders=true` 
since this is probably the most reliable way to easily mimic the MATLAB CI 
Workflows behavior when doing local qualification.



##########
matlab/doc/testing_guidelines_for_the_matlab_interface_to_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Testing Guidelines for the MATLAB Interface to Apache Arrow  
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  
+
+- Test directory maps source directory. For example, the test directory 
`test/arrow/array/` contains all tests for the source directory 
`src/matlab/+arrow/+array/`.  
+- One test for one source file. For example, `test/arrow/array/tArray.m` is 
the test file for `src/matlab/+arrow/+array/Array.m`.  
+
+## When tests are run  
+
+When pushing changes to the `matlab` directory, GitHub Actions is used to 
automatically trigger tests under `matlab/test` to run. Currently, all tests 
under `matlab/test` are configured to run. In the future when the run time of 
running tests becomes a concern, we will consider doing source to test mapping 
and only triggering related tests to run.  
+
+## How to Write Tests  
+
+Tests for MATLAB interface should use the MATLAB testing framework 
[`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
 Here is a simple example.  
+
+```matlab
+classdef tArray < matlab.unittest.TestCase
+    methods(Test)
+        function InferNullsTrue(testCase)
+            matlabArray = [1 2 NaN 3];
+            arrowArray = arrow.array(matlabArray, InferNulls=true);
+            testCase.verifyEqual(arrowArray.Valid, [true; true; false; true]);
+        end
+    end
+end
+```
+
+More test examples can be found in the directory `matlab/test`.  
+
+## How to Run Tests Locally on Your Own Machine  
+
+### Prerequisites  
+
+The tests are written by using MATLAB testing framework 
[`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
 To run the tests on your machine, the following software must be installed on 
your machine:  
+
+1. [MATLAB](https://www.mathworks.com/products/get-matlab.html)
+2. [MATLAB Interface to Apache 
Arrow](https://github.com/mathworks/arrow/tree/main/matlab)  
+
+### Run tests in MATLAB  
+
+To run the MATLAB tests, start MATLAB and then cd to the test directory where 
test files of interest reside.  Call the `runtests` command to run your tests:  
+
+```matlab
+>> runtests(testFileName) % For example runtests("tArray.m")
+```
+
+To learn more about `runtests`, please check [the document of 
`runtests`](https://www.mathworks.com/help/matlab/ref/runtests.html).  

Review Comment:
   ```suggestion
   To learn more about `runtests`, please check [the documentation for 
`runtests`](https://www.mathworks.com/help/matlab/ref/runtests.html).  
   ```



##########
matlab/doc/testing_guidelines_for_the_matlab_interface_to_apache_arrow.md:
##########
@@ -0,0 +1,97 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Testing Guidelines for the MATLAB Interface to Apache Arrow  
+
+## Overview  
+
+This document is aimed at providing guidelines on testing of the `matlab` 
directory in the [`apache/arrow`](https://github.com/apache/arrow) repository.  
+
+## General Guideline  
+
+When designing any test case, please try to design it at the MATLAB interface 
level such that the tests are testing real use cases. Tests for MATLAB 
interface should use the MATLAB testing framework [`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
+
+If the source code cannot be covered by any test at the MATLAB interface 
level, consider adding c++ unit tests by using GoogleTest framework.
+
+## Code Coverage Goals  
+
+When making change to the `matlab` directory in the 
[`apache/arrow`](https://github.com/apache/arrow) repository, please try to add 
tests to cover all changed lines, conditions and decisions. It is 
understandable that some code cannot be hit due to defensive purpose or other 
reasons. When reviewer reviews code change, they'll check the code coverage for 
the changed code.  
+
+### How to Check Code Coverage  
+
+The Name-Value input argument 
[`ReportCoverageFor`](https://www.mathworks.com/help/matlab/ref/runtests.html#mw_764c9db7-6823-439f-a77d-7fd25a03d20e)
 to `runtests` is used to generate code coverage report.  
+
+
+```matlab  
+>> addpath( <your local arrow/matlab> )
+>> runtests(testFilePath/testFolderPath, 'ReportCoverageFor', 
sourceFilePath/sourceFolderPath, 'IncludeSubfolders', true/false);  
+
+% Example
+>> runtests('C:\TryCodeCoverage\arrow\matlab\test', 'ReportCoverageFor', 
'C:\TryCodeCoverage\arrow\matlab\src\matlab\', 'IncludeSubfolders', true);
+```
+
+It might happen that caching or shadowing issue causes zero coverage because 
the test ends up executing some other source file. To avoid such problem, 
please first set a breakpoint in your source file and run the tests. This step 
is to make sure that your source file is executed by the tests. After this 
step, the command `runtests(___, "ReportCoverageFor", ___)` will work well.
+
+## Test File Location and Organization  
+
+All tests for MATLAB interface are put under `matlab/test`. To help easily 
locate related tests for each source file, test organization follows the 
following two rules:  
+
+- Test directory maps source directory. For example, the test directory 
`test/arrow/array/` contains all tests for the source directory 
`src/matlab/+arrow/+array/`.  
+- One test for one source file. For example, `test/arrow/array/tArray.m` is 
the test file for `src/matlab/+arrow/+array/Array.m`.  
+
+## When tests are run  
+
+When pushing changes to the `matlab` directory, GitHub Actions is used to 
automatically trigger tests under `matlab/test` to run. Currently, all tests 
under `matlab/test` are configured to run. In the future when the run time of 
running tests becomes a concern, we will consider doing source to test mapping 
and only triggering related tests to run.  
+
+## How to Write Tests  
+
+Tests for MATLAB interface should use the MATLAB testing framework 
[`matlab.unittest.TestCase 
class`](https://www.mathworks.com/help/matlab/ref/matlab.unittest.testcase-class.html).
 Here is a simple example.  

Review Comment:
   Just my personal opinion - I think it would be nice if we used a slightly 
simpler example for the test. `InferNulls` could be considered "advanced" 
functionality and may not be as relatable as testing something like creating a 
simple `StringArray` using `arrow.array`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to