Generally, the use of that is optional: neither its use nor its omission are bad style. However, when you are using it everywhere, all the time, that can be too much. The same applies to omitting it everywhere—the more so because its omission can sometimes cause ambiguity.
Of your example sentences, I'd say the first one is OK; I think I'd leave out the first that, but that would be only a minor improvement. Tastes may vary on this. If there had been three thats close together, I'd say it would usually be best to omit one, unless all three were required for clarity; but in that case it might be better to recast or split the sentence.
The second sentence is perhaps acceptable to some, but I'd put a that after difficult. Omitting it twice in a row makes the sentence a bit harder to parse, though it's still not the end of the world. Given the choice, I think one usually omits the that of relative clauses (the chair that I saw) and of reported speech (he said that he'd come) sooner than the that of so ... that, though it is still possible there. I'd write your sentence like this:
The test she took was so difficult
that she began to sweat.
Note that we usually omit that more often in speech; there intonation resolves some of the ambiguity that might otherwise ensue. I'd probably omit both thats in speech.