0

I want to save the states of various databases for a reliable Unit-Testing.

SQL-Databases are easy, I just make a dump-file and can recreate my database from scratch every time I run my tests. My question is, can I do the same with an active directory? Can I recreate the state of an active directory with a script or do I have to save the database as an instance (for example a text file) and just use it as a "fake" active directory (just an Object and not a Connection)

What approaches are useful?

muffin
  • 1,456
  • 4
  • 21
  • 44

1 Answers1

1

Active Directory can also be exported and restored as LDIF using LDIFDE. For example, see How to import a groups members using 'ldifde'? for a case of adding data.

However, unless you're specifically writing and testing code that uses Active Directory, mocking it out, either in your code or with a lightweight LDAP server, will better isolate your tests and make them run faster (How to fake Active Directory?).

Community
  • 1
  • 1
Joe
  • 29,416
  • 12
  • 68
  • 88