We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Document is not created when unit testing

Hello. A word document is not being generated during unit test.
For example, please run the code below:

using Aspose.Words;
using NUnit.Framework;

namespace ClassLibrary1
public class Class1
public void Run()
var doc = new Document();
var builder = new DocumentBuilder(doc);

packages installed are the following:
Aspose.Words 19.1.0
NUnit 3.11.0
NUnit3TestAdapter 3.12.0



Thanks for your inquiry. Your code is correct. Please make sure that the Run() method is called when you test it. You can specify the path of output document as shown below. Please let us know if you still face problem.


Hello @tahir.manzoor,

Thanks for the immediate response. I tried to put a breakpoint and debug it to make sure it runs, and it did.
Saving to an absolute path creates the document. But this is not desired since this test will run on multiple machines and possibly a build server.

Thank you,

I just discovered that this is an NUnit issue. NUnit’s test CurrentDirectory does not point to the directory containing the test assembly.


There is no need to specify absolute path. We suggested it for your test case.

It is nice to hear from you that you have found the issue. Please let us know if you face any issue while using Aspose.Words.