flutter / flutter/flutter-intellij

Android Studio fails to find multiline test name

Open
#7,940 1 comment 2 reactions 0 assignees View on GitHub
P2 topic-testing
Dominant language
Java
Stars
2k
Forks
356
Avg merge
1d 11h
Merged PRs (30d)
27

Description

When writing tests for Flutter development and using a multiline string as the 'description' parameter I get the following error.

No tests match "Given formType is signIn\n When signInWithEmailAndPassword succeeds\n Then return true\n And state is AsyncData\n ".

```
//Example code
test('''Given formType is signIn
When signInWithEmailAndPassword succeeds
Then return true
And state is AsyncData
''', () async {
// Test code
});
```

I've tried running the same code in VS Code and it runs normally, which makes me believe this is an AS problem.
Running an enclosing group **works fine** (given the group has a single line description string), as does running the top main() function.

Using three double quotation marks or \n operators in a single line makes no difference for me.

**Steps to reproduce**: Write a test function for the Flutter API using a multiline string as the 'description' parameter, then try to run the single test using the run button in the gutter.

---
Build: AI-241.18034.62.2411.12071903, 202407102213
AS: Koala | 2024.1.1 Patch 1
AI-241.18034.62.2411.12071903, JRE 17.0.11+0--11852314x64 JetBrains s.r.o., OS Windows 11(amd64) v10.0 , screens 1920.0x1080.0, 2400.0x1350.0
Android Gradle Plugin: (plugin information not found)
Gradle: (gradle version information not found)
Gradle JDK: JetBrains Runtime 17.0.11
NDK: from local.properties: (not specified), latest from SDK: (not found)
CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)

Flutter Doctor:

[√] Flutter (Channel stable, 3.29.0, on Microsoft Windows [Version 10.0.22631.4890], locale en-GB) [413ms]
• Flutter version 3.29.0 on channel stable at C:\src\flutter\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 35c388afb5 (4 days ago), 2025-02-10 12:48:41 -0800
• Engine revision f73bfc4522
• Dart version 3.7.0
• DevTools version 2.42.2

[√] Windows Version (11 Home 64-bit, 23H2, 2009) [2.0s]

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc4) [2.8s]
• Android SDK at C:\Users\jostk\AppData\Local\Android\sdk
• Platform android-35, build-tools 34.0.0-rc4
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
• All Android licenses accepted.

[√] Chrome - develop for the web [97ms]
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.3.6) [95ms]
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.3.32929.385
• Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2024.1) [23ms]
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• android-studio-dir = C:\Program Files\Android\Android Studio
• Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)

[√] VS Code (version 1.97.2) [21ms]
• VS Code at C:\Users\jostk\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.104.0

[√] Connected device (3 available) [278ms]
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.4890]
• Chrome (web) • chrome • web-javascript • Google Chrome 132.0.6834.160
• Edge (web) • edge • web-javascript • Microsoft Edge 132.0.2957.115

[√] Network resources [321ms]
• All expected network resources are available.

• No issues found!

[DiagnosticsReport20250213-213033.zip](https://github.com/user-attachments/files/18797699/DiagnosticsReport20250213-213033.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.