The easiest way to know if sqldev version x.y.z has never been run is to check the settings against the version unzipped.
The version of sqldev is in the ../bin directory a file named version.properties.
:~ klrice$ cd sqldeveloper/bin
kriss-MacBook-Pro:bin klrice$ ls
..
version.properties <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< THE FILE
..
kriss-MacBook-Pro:bin klrice$ more version.properties
COMPANY=Oracle
PRODUCT=SQL Developer
VERSION=18.03001761612f
VER=18.3.0 <<<<<<<<<<<<<<<<<<<<<<<<<< VERSION
VER_FULL=18.3.0.176.1612 <<<<<<<<<<<<<<<<<<<<<<<<<< VERSION
BUILD_LABEL=176.1612
BUILD_NUM=176.1612
EDITION=
Once that version is known it could be checked against settings which would have a directory per version of sqldev that has been run. These settings use the version number as the directory name.
On windows it's in AppData\Roaming\SQL Developer
On linux/osx it's in ~/.sqldeveloper
kriss-MacBook-Pro:bin klrice$ ls ~/.sqldeveloper/
17.0.0/
4.2.0/
17.3.0/
17.3.1/
17.4.0/
18.1.0/
18.3.0/
4.1.5/
...
The trick now is to have a wrapper / batch / shell script around starting sqldeveloper.exe(.sh) to catch the case of your test before it starts and makes those setting directories.
Now if you are up for writing Java Extension to sqldev, there's more choices such as having a dedicated pref that tracks if your code snippet has run.