The brake switch is a normally CLOSED switch when not mounted in the truck. What that means is that if you plug the switch into the wiring harness, but do not have it mounted to the switch bracket, the brake lights will be ON. If you then push the switch IN, the lights will go OFF. That can be confusing since most folks think it would work the other way around.
If it is mounted in the truck, and adjusted properly, the lights will be off until you press the pedal. Duh I know... but some folks do get confused by the switches action when not in the truck.
If what you are seeing is sometimes the brake lights work when you press the pedal, and sometimes they don't, then either the switch needs adjusting, or the switch is intermittent. Sometimes a spray of electrical contact cleaner into the switch will clean the contacts enough to make it work correctly.