Failed Test during the build

When I am building I find that 50% of the test case are failing. I am unable to find the cause what is going wrong. Someone on the forum, suggested that test case can be such that the purchaseDate can be after the endDate and in that case appropiate list should be returned.
I am unable to find which test cases are failing. It would be great help if anyone can point the potential error or guide me about how to debug.
Thanks in Advance!

You need to be a bit more precise with your query. What are those 50% test cases which are failing? What problems are you facing? Can you please be lil more specific.

The above is test summary which I got after a build. I am unable to find what is the potential cause of failure of the 4 test cases.
I have already tested various test cases using the command "./gradlew run --args=“trades.json 2019-12-03” by giving different values of endDate.
As mentioned in the TODO that the program should return a list of symbols and the stock price at endDate. My point is that when I am testing it working and return me the 2 list mentioned in the TODO, but 4 test cases are failing when I run the command “./gradlew build”

Just make sure that you’re not hard coding any things.

I had not hard coded, and if I had then I think 4 testcases(as mentioned in the test summary) have not passed.

Have you sorted the stocks in ascending order of their closing price.
And while sorting, also keep in mind that they are of type Double

Hey @Abhi,

When I faced that number of failed test cases, I found tackling them one by one was very helpful. Sometimes resolving for one case also cleared more test cases.

As for how to resolve them, the best way for you to get assistance on forum will be to show which vases are failing. You can find them written on terminal when you run the build command.

As a generic suggestion, you can always go over forum, see if anyone faced same failed test as you did and what was the solution to it. Also, try checking once if you have followed all TODOs to the last letter.

Let me know if this issue persists!

Yes I was able to resolve the issue. Initially I was confused as how to move forward and resolve the issue but then I looked at the unit tests and found a difference between the expected output and my program output. So, finally I was able to resolve the error. Guys, Thanks for help.

1 Like

That’s great to hear. I’ll suggest you close the topic then by marking whatever you found helpful as answer.

Happy coding!