The laws include the heath and safety at work act, and trading laws. It's not against electrical regulations or building regulations the BS7671 simply says you must have the skill required, it does not say you must hold a qualification. The building regulations say you must notify certain work, but it is down to the building inspector to decide if you have the skill required.
In general any tradesman needs insurance to cover any errors. Insurance is odd in that unlike any other trading practice it is up to you to tell the insurance of risks not up to them to ask, with the exception of motor insurance. So for example if you are colour blind you have to tell them, they don't have to ask. So the insurance can assume if you ask for insurance to do electrical work that you have the skill, and should you not have the skill they can refuse to pay out.
One always hopes nothing goes wrong. But some of the things I have seen one would have never expected in one case some one sprayed Cillit Bang on a socket and bang the socket was gone. Clearly a stupid thing to do, but people do stupid things, and when they do they will always try to blame some one else. Many of the reported court cases one sees how it was not really the electrician who did anything wrong, but the courts have decided he should have found the problem and corrected it. Down to a warranty of skill. With
Emma Shaw case the electrical foreman did not even visit the site, but the court found him guilty. And for you well worth reading as this was all down to using unskilled labour.
I will admit many so called electricians take chances. They will change a socket or switch without completing a minors works certificate or testing and just hope nothing goes wrong. But people are stupid we read again and again comments like they got a mild shock but did not think anything of it. One also sees conflicting reports in news papers so never really sure what went on. From reports I read an elderly land lady rented out a house and got a report from the new tenants that they had got a shock, so she engaged an electrician, but before he arrived a female tenant was killed. The husband had not yet moved in and one asks the question when they knew there was a fault why did they continue in the process of moving in? It also seems the oil filled radiator belonged to the tenant. The courts decided the elderly land lady was at fault for renting out the house before having the electrics checked.
See this report and the list goes on.
These cases fortunately are not that common, so a tradesman can be lucky and have never a need to attend court. If an electrician has a full test kit he can claim he tested even if he didn't, but if you don't own the kit it would be hard to convince a court it was OK when you left. Remember compensation is on top of the fines so having to pay out half a million is not unusual if some one is injured. So insurance is really a must.