With a consistent test, the auto manufacturer can come within, say, 5% of the emission limits. With random tests, the manufacturer has to come in way low to beat the odds on the test. Assuming that the emission limits are reasonable, and that reducing emissions further will cost somehow, it's much better to have a consistent test.
You have a fundamental misunderstanding of corporate profits. Corporations cannot simply decree how much revenue they get; they have to sell products or services or something to customers, and that's their revenue. This means that it's governed by laws of supply and demand. When selling a given product, there is a price that will bring in the most profit, based on the individual production cost of something and the demand curve. There will be other expenses that don't depend on how many items the corp makes, and those determine whether the corporation is profitable or not. If fixed expenses go up, they come out of corporate profits because there's no way to change the item price to make more money (if the corp could have changed prices to make more money, it would have). If individual unit expenses go up, the price will go up, but that means fewer units will be sold, and the price will almost certainly stabilize at a point where there's less per-unit profit.
Therefore, imposing costs due to environmental regulation, or anything else, cuts into corporate profits.
Further, some things have significant externalities that are not accounted for in the price. Since we're talking about the environment, assume that a certain product produces a lot of pollution in its manufacture (gold) or use (cars). This pollution imposes costs on people, which are not accounted for in the manufacture, buying, or selling, and therefore which distort the market. This results in more polluting stuff being produced and bought than is optimum. This is a version of the Tragedy of the Commons.
I'm also not sure what you think contractual obligations will do to deal with pollution, say. I don't sign contracts with people saying how much pollution I'm going to allow them. The contractual obligations are going to be between the manufacturer and suppliers or manufacturers and customers, and it's to the immediate financial interest of all three of those to disregard externalities. Who's going to sign a contract with whom limiting pollution?
If you want a totalitarian economy, mandate that all disputes be settled through binding arbitration. The arbitrators look for return business, and so will tend to deliver decisions that favor their best customers, which will be the corps. Moreover, the damages or whatever they can award are typically limited by contract. Private arbitration is no substitute for a good public court system.