I'm at the 'back of an envelope' stage in designing an automated transistor curve tracer. The basic idea is that you insert a 2 or 3 terminal semiconductor device into a test socket and it goes off and extracts all the relevant parameters for you. The idea was driven by the fact that I need some matched pairs of JFETs and bipolar transistors, and doing the matching by hand is tedious to say the least. One thing lead to another and I realized it was just as easy to build a fully featured curve tracer as it was to build something that would just extract the parameters that I need to match on.
Anyway, step one was to determine how to recognize what type of device had been inserted into the test socket. E.g. JFET or bipolar transistor, n-channel/NPN, p-channel/PNP etc. It turns out this isn't difficult and it's not difficult to figure out which test pin relates to which device pin (collector, base, emitter, gate and so on).
What turns out to be difficult is deciding which pins of a JFET are source and drain. It's easy to determine whether you've got a p-channel or n-channel JFET, which pin is the gate and which two pins are the channel. The problem is that JFETs are pretty agnostic over which pin (out of the 2 channel ends) acts as source and which as drain - in fact some devices are constructed symmetrically and which is the source and which is the drain are purely arbitrary choices. (Offhand I think the J113 fits this bill.)
A similar problem exists for MOSFETs - JFETs are just my starting point in this as (1) I use them more often, (2) MOSFETs are a little trickier as the gate turn on voltage for some MOSFETs exceeds the breakdown voltages on some other MOSFETs which makes a reliable, safe test method a bit more involved and we don't want that complexity clouding the issue for this problem.
Given that you're already determined that (1) you have a JFET, (2) you know the channel type, (3) you know which terminal is the gate and (4) you know which two terminals are the two ends of the channel: for JFETs which aren't strictly symmetrical, what procedure could one follow, purely using electrical testing*, to determine which terminal should be classified as the source and which as the drain?
Let's try and keep this as abstract as possible. That is, discussing it in terms of the device characteristics rather than concrete implementation terms as the former is quite specific, the latter more 'how long is a piece of string'.
* Using the datasheet is either cheating or besides the point here, depending on your point of view.