Please point me to any dupes or better places to post this question that you may find.
I have never sold software before, but when I put myself in my customers’ shoes, I think, “I sure would like to see source code for automatic tests for any software that I buy. It would serve as awesomely detailed documentation for the software that I’m buying! In fact, I’d love to see the tests as proof-of-concept before I buy, if possible.”
From the seller’s perspective, I see no reason to hide the test code source (as long as the tests only access the binaries through “front doors” and contain no sensitive data), or even to release the tests as open source to receive help from anyone who wants to help us, as well as prove to potential customers what the software can do in detail.
So… Is it customary, or even a good idea, to let users see (some) automated test code, or even release it open-source, for a closed-source application application that you are selling?
EDIT: Thank you all for the insightful comments. I should clarify that my goal is not to say “Look at how high-quality my software is!” but instead “This is how you use the software” (using tests as documentation). This is for an API; no UI is involved. I just want to demonstrate how to use it (public interface), not the internal workings. I really hate demo apps that are very long, but show only the “happy path” through an API, so I was looking for a way to improve on that.
This idea may be good for the customer, but it’s not good for you. It’s nearly impossible for you to create a suite of automated tests that doesn’t exploit some accidental property of your implementation that isn’t documented and that you’d like to have the freedom to change later. Once you let those tests out the door, you are essentially guaranteeing that those tests will run on any future version of the software. You don’t want to lock yourself into a straitjacket like this.
In theory, of course, you could have a set of tests that would test exactly what is exposed in the public interfaces, no more and no less. But such a test suite would be very expensive to create and maintain as the software evolves.
And the very idea brings to mind one of the minor apocrypha: