Skip to content

Instantly share code, notes, and snippets.

@automationhacks
Created February 22, 2020 03:03
Show Gist options
  • Save automationhacks/7c35352cf2c23b129e007ae96e024f57 to your computer and use it in GitHub Desktop.
Save automationhacks/7c35352cf2c23b129e007ae96e024f57 to your computer and use it in GitHub Desktop.
Use of data providers to run the same test with different data
class SetupTeardownWithDataProvider {
@DataProvider
fun getVehicleTypes(): MutableIterator<Array<Any>> {
val vehicles = arrayListOf<Array<Any>>()
vehicles.add(arrayOf(VehicleType.CAR))
vehicles.add(arrayOf(VehicleType.CAR_XL))
return vehicles.iterator()
}
@Test(dataProvider = "getVehicleTypes")
fun testBookingCreation(vehicleType: VehicleType) {
val booking = Booking()
val orderId = booking.makeBooking(vehicleType)
val isBookingCreated = booking.doesBookingExists(vehicleType, orderId)
Assert.assertNotNull(isBookingCreated)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment