Skip to content

Commit

Permalink
example test changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hey24sheep committed Oct 12, 2023
1 parent 8fbe418 commit f691111
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 48 deletions.
29 changes: 21 additions & 8 deletions sample_project/junit.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<testsuites>
<testsuite name="api_dummy_test.dart" timestamp="2023-08-05T09:56:09.886Z" errors="0" skipped="0" failures="1" tests="3">
<testcase name="D:/hey24sheep/work/my_github/azure-flutter-tasks/sample_project/test/api_dummy_test.dart: Api Dummy Test" classname="D:/hey24sheep/work/my_github/azure-flutter-tasks/sample_project/test/api_dummy_test.dart: Api Dummy Test" time="0.299"/>
<testsuite name="1_api_test.dart" timestamp="2023-10-12T08:10:12.560Z" errors="0" skipped="0" failures="1" tests="4">
<testcase name="1_api_t1" classname="1_api_t1" time="0.024"/>
<testcase name="1_api_t2" classname="1_api_t2" time="0.011"/>
<testcase name="1_api_t3" classname="1_api_t3" time="0.083"/>
<testcase name="1_api_fail_t4 [E]" classname="1_api_fail_t4 [E]" time="0">
<failure type="FlutterError"/>
</testcase>
</testsuite>
<testsuite timestamp="2023-08-05T09:56:09.886Z" errors="0" skipped="0" failures="0" tests="1">
<testcase name="All tests passed!" classname="All tests passed!" time="0"/>
<testsuite name="2_api_test.dart" timestamp="2023-10-12T08:10:12.560Z" errors="0" skipped="0" failures="0" tests="1">
<testcase name="2_api_t1" classname="2_api_t1" time="0"/>
</testsuite>
<testsuite name="widget_test.dart" timestamp="2023-08-05T09:56:09.886Z" errors="0" skipped="0" failures="0" tests="4">
<testcase name="D:/hey24sheep/work/my_github/azure-flutter-tasks/sample_project/test/widget_test.dart: Counter increments smoke test" classname="D:/hey24sheep/work/my_github/azure-flutter-tasks/sample_project/test/widget_test.dart: Counter increments smoke test" time="0.203"/>
<testcase name="D:/hey24sheep/work/my_github/azure-flutter-tasks/sample_project/test/widget_test.dart: Other test" classname="D:/hey24sheep/work/my_github/azure-flutter-tasks/sample_project/test/widget_test.dart: Other test" time="0.01"/>
<testcase name="D:/hey24sheep/work/my_github/azure-flutter-tasks/sample_project/test/widget_test.dart: And another test" classname="D:/hey24sheep/work/my_github/azure-flutter-tasks/sample_project/test/widget_test.dart: And another test" time="0"/>
<testsuite name="3_services_test.dart" timestamp="2023-10-12T08:10:12.560Z" errors="0" skipped="0" failures="0" tests="2">
<testcase name="3_service_t1" classname="3_service_t1" time="0.022"/>
<testcase name="3_service_t2" classname="3_service_t2" time="0"/>
</testsuite>
<testsuite name="4_widget_test.dart" timestamp="2023-10-12T08:10:12.560Z" errors="0" skipped="0" failures="0" tests="1">
<testcase name="4_widget_t1" classname="4_widget_t1" time="0"/>
</testsuite>
<testsuite timestamp="2023-10-12T08:10:12.560Z" errors="0" skipped="0" failures="0" tests="1">
<testcase name="Some tests failed." classname="Some tests failed." time="0"/>
</testsuite>
<testsuite name="5_widget_test.dart" timestamp="2023-10-12T08:10:12.560Z" errors="0" skipped="0" failures="0" tests="3">
<testcase name="5_widget_t1" classname="5_widget_t1" time="0.069"/>
</testsuite>
</testsuites>
28 changes: 28 additions & 0 deletions sample_project/test/1_api_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// This is a basic Flutter widget test.
// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
// find child widgets in the widget tree, read text, and verify that the values of widget properties
// are correct.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:sample_project/main.dart';

void main() {
test('1_api_t1', () {
expect('1', '1');
});

test('1_api_t2', () {
expect('1', '1');
});

test('1_api_t3', () {
assert(true, true);
});

test('1_api_fail_t4', () {
expect('1', '2');
});
}
16 changes: 16 additions & 0 deletions sample_project/test/2_api_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This is a basic Flutter widget test.
// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
// find child widgets in the widget tree, read text, and verify that the values of widget properties
// are correct.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:sample_project/main.dart';

void main() {
test('2_api_t1', () {
expect('1', '1');
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:sample_project/main.dart';

void main() {
test('services test', () {
test('3_service_t1', () {
expect(true, true);
});

testWidgets('mock', (WidgetTester tester) async {});
test('3_service_t2', () {
assert(true, true);
});
}
64 changes: 64 additions & 0 deletions sample_project/test/4_widget_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// This is a basic Flutter widget test.
// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
// find child widgets in the widget tree, read text, and verify that the values of widget properties
// are correct.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:sample_project/main.dart';

void main() {
testWidgets('4_widget_t1', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(new MyApp());

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);

// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();

// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});

testWidgets('4_widget_t2', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(new MyApp());

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);

// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();

// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});

testWidgets('4_widget_t3', (WidgetTester tester) async {
//throw Error();
// Build our app and trigger a frame.
await tester.pumpWidget(new MyApp());

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);

// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();

// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:sample_project/main.dart';

void main() {
testWidgets('Api Dummy Test', (WidgetTester tester) async {
testWidgets('5_widget_t1', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(new MyApp());

Expand All @@ -26,8 +26,4 @@ void main() {
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});

testWidgets('failure api dummy test', (WidgetTester tester) async {
// throw Error();
});
}
33 changes: 0 additions & 33 deletions sample_project/test/widget_test.dart

This file was deleted.

0 comments on commit f691111

Please sign in to comment.