Closed hanna-ho closed 1 month ago
Hi @hanna-ho, I see in the logs that test report was generated: See the report at:
. Could you send screenshots of this report? (it consists of multiple files) There could be more info on why the test failed.
In logs you provided I see also that no tests were found - it may be caused by mistakes in the native config. Please check (or post) the android/app/build.gradle
file first
Hi there,
The report doesn't say much, at least to me.
The build.gradle file looks like this:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
namespace "com.example.eudi_wallet"
compileSdkVersion 34
// compileSdkVersion 33
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
configurations {
all {
exclude group: 'com.scottyab', module: 'rootbeer-lib'
}
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
//applicationId "com.example.eudi_wallet"
applicationId "hu.egroup.ewc"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 26
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "pl.leancode.patrol.PatrolJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: "true"
}
signingConfigs {
debug {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
shrinkResources false
signingConfig signingConfigs.debug
}
}
testOptions {
execution "ANDROID_TEST_ORCHESTRATOR"
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
androidTestUtil "androidx.test:orchestrator:1.4.2"
}
Thanks for the report, unfortunately it says the same as logs.
Oops, I asked for build.gradle, but I was thinking MainActivityTest.java
file - the one that you create in the setup tutorial. Sorry for confusion
In this MainActivityTest.java
the very first line of it should be changed - the package name should be your package name, not the example one. Skipping this step may cause behaviour you described
Thanks for the idea, and the quick reply. I have checked, the package name was set the same as the applicationId in the build.gradle.
package hu.egroup.ewc;
import androidx.test.platform.app.InstrumentationRegistry;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import pl.leancode.patrol.PatrolJUnitRunner;
@RunWith(Parameterized.class)
public class MainActivityTest {
@Parameters(name = "{0}")
public static Object[] testCases() {
PatrolJUnitRunner instrumentation = (PatrolJUnitRunner) InstrumentationRegistry.getInstrumentation();
// replace "MainActivity.class" with "io.flutter.embedding.android.FlutterActivity.class"
// if in AndroidManifest.xml in manifest/application/activity you have
// android:name="io.flutter.embedding.android.FlutterActivity"
// instrumentation.setUp(MainActivity.class);
instrumentation.setUp(io.flutter.embedding.android.FlutterActivity.class);
instrumentation.waitForPatrolAppService();
return instrumentation.listDartTests();
}
public MainActivityTest(String dartTestName) {
this.dartTestName = dartTestName;
}
private final String dartTestName;
@Test
public void runDartTest() {
PatrolJUnitRunner instrumentation = (PatrolJUnitRunner) InstrumentationRegistry.getInstrumentation();
instrumentation.runDartTest(dartTestName);
}
}
// if in AndroidManifest.xml in manifest/application/activity you have
// android:name="io.flutter.embedding.android.FlutterActivity"
// instrumentation.setUp(MainActivity.class);
instrumentation.setUp(io.flutter.embedding.android.FlutterActivity.class);
Did you try switching to the original line here? If yes and it still doesn't work, please post AndroidManifest.xml
file
Yes I tried, I got an error: cannot find symbol instrumentation.setUp(MainActivity.class); symbol: class MainActivity location: class MainActivityTest
My android manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.USE_BIOMETRIC"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.NFC" />
<application
android:label="MyD"
android:name="${applicationName}"
android:icon="@drawable/myd"
tools:replace="android:label">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!--TODO: Add this filter, if you want support opening files into your app-->
<!-- <intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="application/pdf"
android:scheme="content" />
</intent-filter>-->
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/pdf" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="egroup.hu" />
<data android:scheme="https"/>
<data android:pathPattern="/eudiwallet"/>
<!-- <data android:scheme="https"
android:host="ewc-cont"/>
<data android:scheme="ewc-cont"
android:host="eudiwallet"/>
<data android:scheme="https"
android:host="ewc-start"/>
<data android:scheme="ewc-start"
android:host="eudiwallet"/>-->
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
Sorry for late response.
In your manifest, the android:name
property is .MainActivity
, so you should leave the original line in MainActivityTest.java
:
instrumentation.setUp(MainActivity.class);
The problem must be caused by something else. It would be great if you could send us a project, where this problem occurs. My guess right now is that the file structure in android/app/src/main
is different than it should be
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.
Steps to reproduce
I am running a very small test on a Samsung Galaxy A52s.
The test:
I'm running:
Note: I have no issues with running patrol test on a freshly generated flutter project, after the necessary configuration steps are done.
Actual results
The build runs fine until the task :app:connectedDebugAndroidTest. I get deprecation warnings, but the build resumes regardless of them.
When the :app:connectedDebugAndroidTest task is reached, after a few minutes I get the error: Exception: Gradle test execution failed with code 1
See the included log for details.
Logs
Logs
``` Sorry, it's too long, I have pasted it here: https://pastebin.com/W5xUZz8n ```Patrol version
patrol 3.9.0
Patrol Doctor output
Patrol Doctor output
``` Patrol doctor: Patrol CLI version: 3.0.1 Flutter command: flutter Flutter 3.22.3 • channel stable Android: • Program adb found in C:\Users\hanna.horvath\AppData\Local\Android\Sdk\platform-tools\adb.exe • Env var $ANDROID_HOME set to C:\Users\hanna.horvath\AppData\Local\Android\Sdk ```Flutter Doctor output
Flutter Doctor output
``` Doctor summary (to see all details, run flutter doctor -v): [!] Flutter (Channel stable, 3.22.3, on Microsoft Windows [Version 10.0.19045.3570], locale en-US) ! Warning: `flutter` on your path resolves to C:\Users\hanna.horvath\fvm\versions\3.22.3\bin\flutter, which is not inside your current Flutter SDK checkout at C:\Users\hanna.horvath\fvm\default. Consider adding C:\Users\hanna.horvath\fvm\default\bin to the front of your path. ! Warning: `dart` on your path resolves to C:\Users\hanna.horvath\fvm\versions\3.22.3\bin\dart, which is not inside your current Flutter SDK checkout at C:\Users\hanna.horvath\fvm\default. Consider adding C:\Users\hanna.horvath\fvm\default\bin to the front of your path. [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [√] Chrome - develop for the web [!] Visual Studio - develop Windows apps (Visual Studio Build Tools 2019 16.11.25) X The current Visual Studio installation is incomplete. Please use Visual Studio Installer to complete the installation or reinstall Visual Studio. [√] Android Studio (version 2024.1) [√] VS Code (version 1.90.1) [√] VS Code, 64-bit edition (version unknown) X Unable to determine VS Code version. [√] Connected device (4 available) [√] Network resources ! Doctor found issues in 2 categories. ```