উদাহরন ১ঃ একটি passing টেস্ট
আমরা বিয়োগ কার জন্যে একটি subtract মেথড এবং এটার টেস্ট কোড লিখব।
import 'package:test/test.dart';
// Import the test package
int Subtract(int x,int y)
// Function to be tested {
return x-y;
}
void main() {
// Define the test
test("test to check subtract method",(){
// Arrange
var expected = 10;
// Act
var actual = Add(30,20);
// Assert
expect(actual,expected);
});
}
এটার output আসবে নিচের মত।
00:00 +0: test to check add method 00:00 +1: All tests passed!