0

I am trying to fetch test data from the excel sheet but it reads the integer value as decimal. Every integer value comes up with a decimal followed by zero.

  1. I have used apache poi for data driven testing.
  2. Method to fetch String values as well as Integer values from the excel sheet is common.
  3. Have attached the screenshots of the excel sheet data, method for fetching test data from the excel sheet and of the Testcase.

Please suggest.

enter image description here

enter image description here

enter image description here

4
  • Don't use toString but format the value properly based on the cell type? Commented Jul 12, 2022 at 21:56
  • For example. Commented Jul 12, 2022 at 22:26
  • 1
    Cell.toString() is not the correct way to get cell values as strings. It gets the stored raw values as strings instead the formatted values as Excel shows them. Use DataFormatter for this task. See stackoverflow.com/questions/7608511/…. Commented Jul 13, 2022 at 3:41
  • I got it working. I manually changed the format of the values as Number in the excel sheet. Didn't need to change the code. Thanks anyway. Commented Jul 13, 2022 at 6:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.