test
Run tests for Android projects to verify functionality and identify issues. Specify the project folder path to execute test suites directly within your development environment.
Instructions
Run test for the Android project in the folder
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| folder | Yes | The full path of the current folder that the Android project sits |
Implementation Reference
- src/mcpandroidbuild/server.py:53-59 (handler)Dispatch logic in the call_tool handler that sets the command to execute test.sh for the 'test' tool.command = [""] if name == "build": command = [os.path.join(script_dir, "build.sh"), args.folder] elif name == "test": command = [os.path.join(script_dir, "test.sh"), args.folder] else: command = [os.path.join(script_dir, "instrumentedTest.sh"), args.folder]
- src/mcpandroidbuild/server.py:60-73 (handler)Subprocess execution and result processing logic shared by all tools including 'test', extracting error lines or success message.result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False) stdout_lines = result.stdout.decode("utf-8").splitlines() stderr_lines = result.stderr.decode("utf-8").splitlines() all_lines = stdout_lines + stderr_lines error_lines = [line for line in all_lines if "failure: " in line.lower() or "e: " in line.lower() or " failed" in line.lower()] error_message = "\n".join(error_lines) if not error_message: error_message = "Successful" return [ TextContent(type="text", text=f"{error_message}") ]
- src/mcpandroidbuild/server.py:19-22 (schema)Pydantic BaseModel defining the input schema for the 'test' tool: a folder path.class Folder(BaseModel): """Parameters""" folder: Annotated[str, Field(description="The full path of the current folder that the Android project sits")]
- src/mcpandroidbuild/server.py:33-37 (registration)Registration of the 'test' tool in the list_tools() function.Tool( name="test", description="Run test for the Android project in the folder", inputSchema=Folder.model_json_schema(), ),
- src/mcpandroidbuild/server.py:51-51 (helper)Helper to compute the script directory for locating shell scripts like test.sh.script_dir = os.path.dirname(os.path.abspath(__file__))