Debugging TAEF Tests
By default, test cases are executed in a separate process than TE.exe: TE.ProcessHost.exe.
If you use a debugger such as cdb or windbg, you can simply pass the '-o' switch to the debugger. This will configure the debugger to automatically debug child processes, all withinin the same debugger instance.
windbg -o te.exe MyTests.dll
Then to switch to the process where your tests run, use the | (pipe) command. The pipe command for switching processes is used exaclty as the ~ (tilda) command for switching threads.
|1s - sets the current process to the second loaded process.
If you prefer to use Visual Studio to do your debugging, the method above will not work for you. In this case, just configure your debugger to run TE.exe, set the appropriate breakpoints in for test case, and pass the /inproc switch to TE.exe. This will ensure that all tests are run within the TE.exe process rather than spawning a new process.
start devenv /debugexe te.exe MyTests.dll /inproc
The command above will launch Visual Studio. Next open the source code for your test cases and set your appropriate breakpoints. Finally, hit F5 to start your test case and it should break on your first breakpoint (if your symbols have loaded correctly).
The steps described above work only with correct symbols set in Visual Studio. At least, you need to set the symbols to the test dll that you are debugging. To set symbols in Visual Studio:
- Select Tools Menu
- Select Options...
- Select Debugging on the left tree-looking menu
- Select Symbols under Debugging
- Enter the symbols path under Symbol file (*.pdb) location: section
- Save your settings
In order to ease the debugging process, Taef provides the ability to automatically break into the debugger before each test class is instantiated and/or before each test method is invoked.
cdb -gG te.exe MyTests.dll /inproc /breakOnCreate /breakOnInvoke
The command above will launch Te.exe under cdb. Taef will break into the debugger right before each test class is instantiated, and before each test method is invoked.
Note: It is recommended that you use this feature while running Te.exe under a debugger, and also specifing the /inProc option.
Build date: 11/16/2013