Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing with MaterialApp #29787

Closed
snotani opened this issue Mar 22, 2019 · 2 comments
Closed

Testing with MaterialApp #29787

snotani opened this issue Mar 22, 2019 · 2 comments
Labels
a: tests "flutter test", flutter_test, or one of our tests d: stackoverflow Good question for Stack Overflow framework flutter/packages/flutter repository. See also f: labels.

Comments

@snotani
Copy link

snotani commented Mar 22, 2019

Steps to Reproduce

file:/home/fridgebuddy/Desktop/FridgeBuddy-master/test/app_test.dart

Logs

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:tablet_app/app_screens/user_update_screen.dart';

Conflicting code:
void main() {
testWidgets('app should work', (tester) async {
await tester.pumpWidget(new MaterialApp());
expect(find.byWidget(user_update_screen()), findsNothing);
});
}
Analyzing FridgeBuddy-master...

info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/add_screen.dart:13:5 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/add_screen.dart:17:5 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/add_screen.dart:21:5 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/add_screen.dart:67:23 • non_constant_identifier_names
info • This function has a return type of 'Future', but doesn't end with a return statement • lib/app_screens/add_screen.dart:69:1 • missing_return
info • Name types using UpperCamelCase • lib/app_screens/add_screen.dart:80:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/add_screen.dart:85:7 • camel_case_types
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/add_screen.dart:512:38 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/add_screen.dart:518:36 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/add_screen.dart:524:34 • non_constant_identifier_names
info • Name types using UpperCamelCase • lib/app_screens/add_screen.dart:597:7 • camel_case_types
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/add_screen.dart:624:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/add_screen.dart:637:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/add_screen.dart:689:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/add_screen.dart:738:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/add_screen.dart:786:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/add_screen.dart:793:6 • non_constant_identifier_names
info • Unused import: 'admin_login_screen.dart' • lib/app_screens/admin_home_screen.dart:2:8 • unused_import
info • Name types using UpperCamelCase • lib/app_screens/admin_home_screen.dart:9:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/admin_home_screen.dart:14:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/admin_home_screen.dart:92:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/admin_home_screen.dart:120:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/admin_home_screen.dart:147:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/admin_home_screen.dart:174:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/admin_home_screen.dart:201:7 • camel_case_types
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/admin_home_screen.dart:258:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/admin_home_screen.dart:286:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/admin_home_screen.dart:292:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/admin_login_screen.dart:13:5 • non_constant_identifier_names
info • The class 'Future' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions •
lib/app_screens/admin_login_screen.dart:16:1 • sdk_version_async_exported_from_core
info • Name types using UpperCamelCase • lib/app_screens/admin_login_screen.dart:35:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/admin_login_screen.dart:40:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/admin_login_screen.dart:188:7 • camel_case_types
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/admin_login_screen.dart:197:11 • non_constant_identifier_names
info • Name types using UpperCamelCase • lib/app_screens/admin_login_screen.dart:212:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/admin_update_screen.dart:6:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/admin_update_screen.dart:11:7 • camel_case_types
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/admin_update_screen.dart:83:7 • non_constant_identifier_names
info • Name types using UpperCamelCase • lib/app_screens/admin_update_screen.dart:143:7 • camel_case_types
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/admin_update_screen.dart:169:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/admin_update_screen.dart:169:51 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/admin_update_screen.dart:195:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/admin_update_screen.dart:224:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/admin_update_screen.dart:235:6 • non_constant_identifier_names
info • Name types using UpperCamelCase • lib/app_screens/admin_view_screen.dart:7:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/admin_view_screen.dart:12:7 • camel_case_types
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/admin_view_screen.dart:84:7 • non_constant_identifier_names
info • The value of the local variable 'quantity_check' isn't used • lib/app_screens/admin_view_screen.dart:84:7 • unused_local_variable
info • Name types using UpperCamelCase • lib/app_screens/feedback_page.dart:4:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/feedback_page.dart:9:7 • camel_case_types
info • Unused import: 'admin_login_screen.dart' • lib/app_screens/sign_up_screen.dart:4:8 • unused_import
info • The class 'Future' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions •
lib/app_screens/sign_up_screen.dart:16:1 • sdk_version_async_exported_from_core
info • Name types using UpperCamelCase • lib/app_screens/sign_up_screen.dart:45:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/sign_up_screen.dart:50:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/sign_up_screen.dart:228:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/user_update_screen.dart:6:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/user_update_screen.dart:12:7 • camel_case_types
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/user_update_screen.dart:94:7 • non_constant_identifier_names
warning • The parameter 'onPressed' is required • lib/app_screens/user_update_screen.dart:144:11 • missing_required_param
info • Name types using UpperCamelCase • lib/app_screens/user_update_screen.dart:176:7 • camel_case_types
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/user_update_screen.dart:202:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/user_update_screen.dart:202:51 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/user_update_screen.dart:257:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/user_update_screen.dart:286:6 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/app_screens/user_update_screen.dart:297:6 • non_constant_identifier_names
info • Duplicate import • lib/app_screens/verify_accounts_screen.dart:5:8 • duplicate_import
info • The class 'Future' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions •
lib/app_screens/verify_accounts_screen.dart:11:1 • sdk_version_async_exported_from_core
info • This function has a return type of 'Future', but doesn't end with a return statement • lib/app_screens/verify_accounts_screen.dart:11:1 •
missing_return
info • Name types using UpperCamelCase • lib/app_screens/verify_accounts_screen.dart:22:7 • camel_case_types
info • Name types using UpperCamelCase • lib/app_screens/verify_accounts_screen.dart:27:7 • camel_case_types
info • Name types using UpperCamelCase • test/widget_test.dart:32:7 • camel_case_types

The following assertion was thrown building MaterialApp(dirty, state: _MaterialAppState#6ea1c):
'package:flutter/src/widgets/app.dart': Failed assertion: line 165 pos 15: 'navigatorObservers !=
null': is not true.

@justinmc justinmc added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. d: stackoverflow Good question for Stack Overflow labels Mar 22, 2019
@justinmc
Copy link
Contributor

This error is thrown when trying to render a MaterialApp with no content. You'll have to add a home property for example:

    await tester.pumpWidget(MaterialApp(
      home: Text('hi'),
    ));

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: tests "flutter test", flutter_test, or one of our tests d: stackoverflow Good question for Stack Overflow framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

No branches or pull requests

2 participants