Hi, My testing need id for compose view, does anyo...
# compose
s
Hi, My testing need id for compose view, does anyone have idea how we can add id to compose view
s
@Colton Idle We are using testTag, but do you have idea how to generate unique number to testTag?
c
You would do it however you would do in java. There's nothing specific to compose in that.
m
@Saurabh Khare You wouldn't want to generate values for the test tag. You want them to be well known, so that you can access them inside your tests. I tend to create constants for my test tags:
Copy code
const val MyButtonTag = "MyButton"

Button(modifier = Modifier.testTag(MyButtonTag)

composeTestRule.onNodeWithTag(MyButtonTag)