Hi.
The door switch must be tested either reading volts when the problem happens, or disconnecting switch wiring. If the stereo is involved in the problem the wiring at the back of the stereo must also be checked. In there you find a 12V memory wire that is always hot, if that is shorting the light may come on at random times.
If the switch is OK and there is no short test the relay and the diode module located under the passenger dash. Testing is done reading volts when the problem happens to check what wiring is getting 12V to lamp.
Here the relay picture, the relay is the 4th from the right. Relays can be tested by swapping them (e.g with the fog lamp relay, if fog lamps come on and dome light works, then relay was the problem):
Below a wiring diagram, click on the picture to enlarge: