Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Add TestSuite Model with Serialization and Deserialization Support

hunteraraujo1d735caf40d3
diff --git a/frontend/lib/models/test_suite.dart b/frontend/lib/models/test_suite.dart
new file mode 100644
index 0000000000..bffca73afc
--- /dev/null
+++ b/frontend/lib/models/test_suite.dart
@@ -0,0 +1,25 @@
+import 'package:auto_gpt_flutter_client/models/task.dart';
+
+class TestSuite {
+ final String timestamp;
+ final List<Task> tests;
+
+ TestSuite({required this.timestamp, required this.tests});
+
+ // Serialization: Convert the object into a Map
+ Map<String, dynamic> toJson() {
+ return {
+ 'timestamp': timestamp,
+ 'tests': tests.map((task) => task.toJson()).toList(),
+ };
+ }
+
+// Deserialization: Create an object from a Map
+ factory TestSuite.fromJson(Map<String, dynamic> json) {
+ return TestSuite(
+ timestamp: json['timestamp'],
+ tests: List<Task>.from(json['tests'].map(
+ (taskJson) => Task.fromMap(Map<String, dynamic>.from(taskJson)))),
+ );
+ }
+}