Skip to content

Commit f691111

Browse files
committed
example test changes
1 parent 8fbe418 commit f691111

File tree

7 files changed

+134
-48
lines changed

7 files changed

+134
-48
lines changed

sample_project/junit.xml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
22
<testsuites>
3-
<testsuite name="api_dummy_test.dart" timestamp="2023-08-05T09:56:09.886Z" errors="0" skipped="0" failures="1" tests="3">
4-
<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"/>
3+
<testsuite name="1_api_test.dart" timestamp="2023-10-12T08:10:12.560Z" errors="0" skipped="0" failures="1" tests="4">
4+
<testcase name="1_api_t1" classname="1_api_t1" time="0.024"/>
5+
<testcase name="1_api_t2" classname="1_api_t2" time="0.011"/>
6+
<testcase name="1_api_t3" classname="1_api_t3" time="0.083"/>
7+
<testcase name="1_api_fail_t4 [E]" classname="1_api_fail_t4 [E]" time="0">
8+
<failure type="FlutterError"/>
9+
</testcase>
510
</testsuite>
6-
<testsuite timestamp="2023-08-05T09:56:09.886Z" errors="0" skipped="0" failures="0" tests="1">
7-
<testcase name="All tests passed!" classname="All tests passed!" time="0"/>
11+
<testsuite name="2_api_test.dart" timestamp="2023-10-12T08:10:12.560Z" errors="0" skipped="0" failures="0" tests="1">
12+
<testcase name="2_api_t1" classname="2_api_t1" time="0"/>
813
</testsuite>
9-
<testsuite name="widget_test.dart" timestamp="2023-08-05T09:56:09.886Z" errors="0" skipped="0" failures="0" tests="4">
10-
<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"/>
11-
<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"/>
12-
<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"/>
14+
<testsuite name="3_services_test.dart" timestamp="2023-10-12T08:10:12.560Z" errors="0" skipped="0" failures="0" tests="2">
15+
<testcase name="3_service_t1" classname="3_service_t1" time="0.022"/>
16+
<testcase name="3_service_t2" classname="3_service_t2" time="0"/>
17+
</testsuite>
18+
<testsuite name="4_widget_test.dart" timestamp="2023-10-12T08:10:12.560Z" errors="0" skipped="0" failures="0" tests="1">
19+
<testcase name="4_widget_t1" classname="4_widget_t1" time="0"/>
20+
</testsuite>
21+
<testsuite timestamp="2023-10-12T08:10:12.560Z" errors="0" skipped="0" failures="0" tests="1">
22+
<testcase name="Some tests failed." classname="Some tests failed." time="0"/>
23+
</testsuite>
24+
<testsuite name="5_widget_test.dart" timestamp="2023-10-12T08:10:12.560Z" errors="0" skipped="0" failures="0" tests="3">
25+
<testcase name="5_widget_t1" classname="5_widget_t1" time="0.069"/>
1326
</testsuite>
1427
</testsuites>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// This is a basic Flutter widget test.
2+
// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
3+
// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
4+
// find child widgets in the widget tree, read text, and verify that the values of widget properties
5+
// are correct.
6+
7+
import 'package:flutter/material.dart';
8+
import 'package:flutter_test/flutter_test.dart';
9+
10+
import 'package:sample_project/main.dart';
11+
12+
void main() {
13+
test('1_api_t1', () {
14+
expect('1', '1');
15+
});
16+
17+
test('1_api_t2', () {
18+
expect('1', '1');
19+
});
20+
21+
test('1_api_t3', () {
22+
assert(true, true);
23+
});
24+
25+
test('1_api_fail_t4', () {
26+
expect('1', '2');
27+
});
28+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This is a basic Flutter widget test.
2+
// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
3+
// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
4+
// find child widgets in the widget tree, read text, and verify that the values of widget properties
5+
// are correct.
6+
7+
import 'package:flutter/material.dart';
8+
import 'package:flutter_test/flutter_test.dart';
9+
10+
import 'package:sample_project/main.dart';
11+
12+
void main() {
13+
test('2_api_t1', () {
14+
expect('1', '1');
15+
});
16+
}

sample_project/test/services_test.dart renamed to sample_project/test/3_services_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ import 'package:flutter_test/flutter_test.dart';
1010
import 'package:sample_project/main.dart';
1111

1212
void main() {
13-
test('services test', () {
13+
test('3_service_t1', () {
1414
expect(true, true);
1515
});
1616

17-
testWidgets('mock', (WidgetTester tester) async {});
17+
test('3_service_t2', () {
18+
assert(true, true);
19+
});
1820
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// This is a basic Flutter widget test.
2+
// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
3+
// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
4+
// find child widgets in the widget tree, read text, and verify that the values of widget properties
5+
// are correct.
6+
7+
import 'package:flutter/material.dart';
8+
import 'package:flutter_test/flutter_test.dart';
9+
10+
import 'package:sample_project/main.dart';
11+
12+
void main() {
13+
testWidgets('4_widget_t1', (WidgetTester tester) async {
14+
// Build our app and trigger a frame.
15+
await tester.pumpWidget(new MyApp());
16+
17+
// Verify that our counter starts at 0.
18+
expect(find.text('0'), findsOneWidget);
19+
expect(find.text('1'), findsNothing);
20+
21+
// Tap the '+' icon and trigger a frame.
22+
await tester.tap(find.byIcon(Icons.add));
23+
await tester.pump();
24+
25+
// Verify that our counter has incremented.
26+
expect(find.text('0'), findsNothing);
27+
expect(find.text('1'), findsOneWidget);
28+
});
29+
30+
testWidgets('4_widget_t2', (WidgetTester tester) async {
31+
// Build our app and trigger a frame.
32+
await tester.pumpWidget(new MyApp());
33+
34+
// Verify that our counter starts at 0.
35+
expect(find.text('0'), findsOneWidget);
36+
expect(find.text('1'), findsNothing);
37+
38+
// Tap the '+' icon and trigger a frame.
39+
await tester.tap(find.byIcon(Icons.add));
40+
await tester.pump();
41+
42+
// Verify that our counter has incremented.
43+
expect(find.text('0'), findsNothing);
44+
expect(find.text('1'), findsOneWidget);
45+
});
46+
47+
testWidgets('4_widget_t3', (WidgetTester tester) async {
48+
//throw Error();
49+
// Build our app and trigger a frame.
50+
await tester.pumpWidget(new MyApp());
51+
52+
// Verify that our counter starts at 0.
53+
expect(find.text('0'), findsOneWidget);
54+
expect(find.text('1'), findsNothing);
55+
56+
// Tap the '+' icon and trigger a frame.
57+
await tester.tap(find.byIcon(Icons.add));
58+
await tester.pump();
59+
60+
// Verify that our counter has incremented.
61+
expect(find.text('0'), findsNothing);
62+
expect(find.text('1'), findsOneWidget);
63+
});
64+
}

sample_project/test/api_dummy_test.dart renamed to sample_project/test/5_widget_test.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
1010
import 'package:sample_project/main.dart';
1111

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

@@ -26,8 +26,4 @@ void main() {
2626
expect(find.text('0'), findsNothing);
2727
expect(find.text('1'), findsOneWidget);
2828
});
29-
30-
testWidgets('failure api dummy test', (WidgetTester tester) async {
31-
// throw Error();
32-
});
3329
}

sample_project/test/widget_test.dart

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)