Comments (7)
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
from patrol.
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"
}
from patrol.
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
from patrol.
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);
}
}
from patrol.
// 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
from patrol.
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>
from patrol.
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
from patrol.
Related Issues (20)
- Add support for root integration test (default is still 'integration_test') (fix included) HOT 3
- Gradle test execution failed with code 1 HOT 16
- Undefined symbol: _GCDAsyncSocketManuallyEvaluateTrust HOT 6
- "--flavor foo" value is not mapped to built in flutter "appFlavor" constant on Android HOT 1
- Unable to run test on Apple Silicon Mac - Simulator Build Fails on simulator iPhone 15 Pro Max iOS 17.5 HOT 7
- xcodebuild exited with code 70 HOT 3
- Truncated text is not identified by patrol HOT 3
- Finders won't work on iOS sign in dialog (auth0 webview login) HOT 3
- iOS webview running `getNativeViews(focused: true)` or `enterTextbyIndex` twice crashes HOT 2
- Cannot Run on iOS Simulator or Device - Deploys App but Doesn't Start Due To Library not loaded: @rpath/AppAuth.framework/AppAuth HOT 6
- Tests stopped running after updating PATROL_CLI to 3.0.0 HOT 3
- Problem with running patrol tests on a remote device from DeviceFarm (STF) HOT 10
- Running the same test twice in a run causes internal server error HOT 6
- Firebase TestLab Test Failed HOT 3
- Test run failed to complete - app:connectedDebugAndroidTest FAILED HOT 5
- NativeAutomator.disableDarkMode does not work if Settings App is not in Default View on iOS HOT 1
- [IOS] Test Crash when add package mobile_scanner in pubspec.yaml HOT 4
- [Question] How to run `patrolTest` with variants that come from `late` fields initialized during `setUp`? HOT 4
- [docs] The "Ignoring Exceptions" section in the "Tips & Tricks" page has a mistake HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from patrol.