Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Wait for process inside Visual Studio

Neal L Absent Member.
Absent Member.
0 0 2,598

Did you ever wish you could run DevPartner’s BoundsChecker, TrueTime, or even TrueCoverage from inside of Visual Studio while waiting for a process to start? I will walk you through how I was able to configure a tool bar button in Visual Studio that will allow me to configure DevPartner Code Coverage to wait for a process to start and then launch the process using the debugger (F5).

The reason that I was looking in to this is because of a bug that was recently discovered by one of our Chinese customers. The problem that they are having is that when they launch their website using Code Coverage, the webserver would start, shutdown, and then restart. Because of the restart, DevPartner Code Coverage was not able to capture the coverage data for the newly launched session of the webserver.

The work around for the customer was to use dpanalysis.exe to start DevPartner Code Coverage and have it wait for WebDev.WebServer40.exe to start. The only problem is that the developer or QA person has to open a command prompt each time they want to run Code Coverage against their application. So what I did was create a batch file that I could add to the External Tools menu in Visual Studio.

Here is the content of the batch file that I created (This could be easily modified to support any application):

@echo off
echo Stopping WebDev.WebServer40.exe.

taskkill /im WebDev.WebServer40.exe

echo Configuring DevPartner Analysis for Code Coverage.

"%ProgramFiles(x86)%\Micro Focus\DevPartner Studio\Analysis\DPAnalysis.exe" /cov /e /w %temp% /nowait /p "%CommonProgramFiles(x86)%\microsoft shared\DevServer\10.0\WebDev.WebServer40.EXE"

echo Please start debugging web site by pressing F5 or Ctrl-F5.
echo When done testing, press the stop button in the Session Control window.

The next thing that I did was to create a menu item in Visual Studio by selecting “Tools->External Tools…” in Visual Studio. The following dialog will display:

Press the “Add” button and enter the following data:

Title: Configure Coverage for WebDev.WebServer40.exe
Command: <Location and name of attached batch file>

Also check “Use Output windows”. This will redirect the output of the command to the output window in Visual Studio.

That is it. Now when I select “Tools->Configure Coverage for WebDev.WebServer40.exe” and press F5 or Ctrl-F5 and run my website, DevPartner’s Code Coverage will collect coverage data. When I am done executing my website, I close Internet Explorer and press the “Stop” button in the Coverage Session Control Window.

The DevPartner Code Coverage Session file will open and display the results.

That’s it. If you want, you can now create a new toolbar and add the external tool that we created above.

 

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.