Skip to content

Instantly share code, notes, and snippets.

@Bharathh-Raj
Created March 16, 2022 16:47
Show Gist options
  • Save Bharathh-Raj/8807469255d36d972b1e443df179e3c1 to your computer and use it in GitHub Desktop.
Save Bharathh-Raj/8807469255d36d972b1e443df179e3c1 to your computer and use it in GitHub Desktop.
Flutter Unit Testing - Grouping
void main() {
group("Area of the circle",(){
test("Area of the circle with radius 1 should be 3.141592", () {
// Arrange
Area area = Area();
// Act
double result = area.circle(1);
// Assert
expect(result, 3.141592);
});
test("Area of the circle with radius 10 should be 3.141592", () {
// Arrange
Area area = Area();
// Act
double result = area.circle(10);
// Assert
expect(result, 314.1592);
});
});
test("Area.pi should be 3.141592", () {
// Arrange
// Act
// Assert
expect(Area.pi, 3.141592);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment