Skip to content

Instantly share code, notes, and snippets.

@ArunYogeshwaran
Last active February 5, 2023 21:56
Show Gist options
  • Save ArunYogeshwaran/aedfd46a0b69706f4a4f6abb7730d0f9 to your computer and use it in GitHub Desktop.
Save ArunYogeshwaran/aedfd46a0b69706f4a4f6abb7730d0f9 to your computer and use it in GitHub Desktop.
An example of a clear test for a system which recommends the most appropriate jobs based on machine learning models
// A test with relevant details right in the test itself
@Test
fun `get ML recommended jobs with new user expect predefined list`() {
// Test arrangements and setup
val engine = getRecommendationEngine()
val jobs = engine.getJobs(new User(UserStatus.FAIRLY_NEW, "testId", "Test User Name"))
assertThat(jobs).isEqualTo(expectedJobs)
}
// A test with relevant details abstracted out
@Test
fun `get ML recommended jobs with new user expect predefined list`() {
// Test arrangements and setup
val engine = new RecommendationEngine(getEnvDetails(), getLocalInfo(), getSessionProperties())
val jobs = engine.getJobs(getTestUserInfo())
assertThat(jobs).isEqualTo(expectedJobs)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment