You need to sign in to do that
Don't have an account?
jgreene
Apex tests are incrementing my Auto Number fields
I have an Apex test that creates a new Case. I figured the tests were transparent, i.e. they just did their thing and didn't modify my data or fire any workflow rules. However, I just noticed that they are in fact incrementing the Auto Number fields. Another member of my team was doing a bunch of development over the weekend and so whenever he ran the test suite it created a new case. I came in on Monday and created a new case; the case number was 100 higher than the last case I had created.
Seems like a bug to me... is it supposed to work like this? Any ideas for a workaround?
Jeremy
Message Edited by jgreene on 10-22-2008 10:11 AM
Seems like a bug to me... is it supposed to work like this? Any ideas for a workaround?
Jeremy
Message Edited by jgreene on 10-22-2008 10:11 AM
I still think it would be ideal if the Apex tests could somehow be rigged not to increment these fields. I understand this might not be possible, I'm just putting the suggestion out there. The current behavior is counter-intuitive.
I am really not that concerned if we skip a few numbers. I was worried that we would start skipping hundreds or thousands of numbers, and my case numbers would go from being 4 digits to being 5 digits. I'd rather keep them 4 digits as long as I can :-)
For all practical purposes, I think we have solved this problem: it turns out that one of our developers was developing Apex code directly on the production salesforce.com instance. So the tests were being run over and over in production. He is going develop in the sandbox instance instead. This way the tests won't affect production until the code is deployed from sandbox to production.