I\'m implementing ms word document generation using content controls and OpenXML SDK. I\'d like to have some automated testing for that code (unit tests or some easy UI auto
The high-level approach for testing Microsoft Word document generation is the following:
Define test cases, where each one consists of:
Write test methods, using your favorite unit testing framework (e.g., xUnit). Using the typical "Arrange, Act, Assert" pattern, those test methods:
It is very easy to retrieve the actual generator output with the Open XML SDK. When comparing actual and expected outputs, you can apply different levels of markup filtering or simplification. For example, you could focus on the essential markup such as the content controls (w:sdt
elements) mentioned in the question.