Analyzing Coded UI Tests Using Coded UI Test Logs - coded-ui-tests

i am trying to get the html log file for the coded ui tests.
i tried the steps mentioned in the following link
https://msdn.microsoft.com/en-us/library/jj159363(v=vs.110).aspx
By default it generated .png file(image file) which captures only the screenshot of the active window where the error occurred.
So i tried using the other values for "EqtTraceLevel" in the configuration file, but there is no difference, it still generates image file.
Does it work for Windows application? if it does what are the additional settings required?

To enable HTML logging in your tests you should add Playback.PlaybackSettings.LoggerOverrideState = HtmlLoggerState.AllActionSnapshot; to your test.
This will show all steps taken in your test and a corresponding screenshot of your application under test. It will also show you a highlight rectangle to show the found control.
Alternatively change QTAgent32.exe.config or QTAgent32_40.exe.config in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE (or where you have VS installed) to contain the following settings:
<appSettings>
<!--- Your settings -->
<add key="EnableHtmlLogger" value="true"/>
</appSettings>
And to increase the detail of your logging:
<switches>
<add name="EqtTraceLevel"value="4"/>
</switches>
Where 0 is off, 1 for errors, 2 for warnings, 3 for info and 4 for verbose.

Related

Run Application configuration stopped working: appears to start executing gradle task [:app:Api.main()] all of a sudden

Yesterday I was able to run a plain Java class in Android Studio without any problems. I did this by creating an Application configuration:
... for running the main() method of some class I defined in the default app module, e.g.:
package com.example.myappname;
public class Api {
public static void main(String[] arguments) {
System.out.println("API test");
}
}
If I then pressed run:
... the output (which I can't show you now, because it doesn't work anymore) of main() would appear nicely in the Run Tool Window:
As far as I was aware, no gradle task or build process was invoked by running this type of configuration. But now, all of a sudden, it appears as though gradle is being executed before running, because it complains that task [:app:Api.main()] failed with message:
A problem occurred configuring project ':app'.
  > Could not create task ':app:Api.main()'.
    > SourceSet with name 'main' not found.
... as seen here:
I tried recreating the configuration and for the first run it worked as before again, but on rerunning the same gradle build error appears again.
Do you have any idea why this is happening and how I can solve this? Am I correct in thinking gradle should be omitted with these kinds of Application configurations?
When it worked, the output in the Run Tool Window would appear almost instantaneously and no elaborate build process appeared in the Build Tool Window, leading me to believe no gradle build process was being executed.
I got it to work again:
... but don't ask me how exactly. It appears to be very buggy.
After deleting all sorts of cache directories and files and searching all kinds of directories for the location of the configuration files I was able to find that the configurations are stored in .idea/workspace.xml of the project.
And one thing I appeared to notice is that the following "hidden" option is needed as a minimum (which I believe was not there, when it didn't work):
<method v="2">
<option name="Make" enabled="true" />
</method>
Here's a full example configuration:
<configuration name="API" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.example.myappname.Api" />
<module name="MyAppName.app.main" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
But sometimes it works and sometimes it doesn't. It appears to be the most reliable if I signify the classpath (-cp option in the Android Studio dialog) to be MyAppName.app instead of MyAppName.app.main.
Ironically, it started to work again when the configuration dialog claimed it couldn't find the class I wanted to run and a red X appeared in the top right corner of the configuration icon:
So, it's all a bit of a mystery to me, as to why it sometimes works and other times it does not.
PS: I was wrong about gradle not building in this type of configuration; it does.
And after a few more tests, it appears one simply shouldn't select the ".main" part when choosing a module for the classpath argument, as that appears to be some specific gradle configuration/task I don't understand well enough.
In spite of Android Studio claiming it can't find the class then (and the red X appearing), it works.

Distribute SQL_SSDT Code Snippets using vscontent (lang attribute error)

I'm trying to distribute some SQL_SSDT Visual Studio code snippets using .vsi and .vscontent files, but I'm getting an error while installing:
The .vscontent file either contains invalid attributes or specifies a code snippet for a programming language that is not installed.
The .vscontent file is based on the documentation provided by Microsoft How to: Distribute Code Snippets
The sample on this site is the following:
<VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
<Content>
<FileName> </FileName>
<DisplayName> </DisplayName>
<Description> </Description>
<FileContentType> </FileContentType>
<ContentVersion>2.0</ContentVersion>
<Attributes>
<Attribute name="lang" value=""/>
</Attributes>
</Content>
</VSContent>
My file looks like this:
<VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
<Content>
<FileName>SSDTTest.snippet</FileName>
<DisplayName>SSDTTest</DisplayName>
<Description>SSDTTest</Description>
<FileContentType>Code Snippet</FileContentType>
<ContentVersion>1.0</ContentVersion>
<Attributes>
<Attribute name="lang" value="SQL_SSDT"/>
</Attributes>
</Content>
</VSContent>
I'm using the value SQL_SSDT since this is the required value in the .snippet files (<Code Language="SQL_SSDT">).
The installation starts as expected (double clicking on the .vsi file), the VS Content Installer pops up, lists the included content. The error occurs after hitting Finish. (Installation starts, but the above error pops up after a few seconds.)
The snippet is working fine if I copy it to the default snippet folder for SSDT (Documents\Visual Studio 2012\Code Snippets\SQL_SSDT\My Code Snippets) or if I'm adding it via snippet manager in SSDT, but the .vsi installation fails using the above file.
Am I missing something?
Installed VS products on this box:
SSDT
SSDT-BI
VS Express for Desktop (2012)
Update
I found the XML schema reference for the .vscontent files (VS2012), and it seems that the SQL_SSDT is not a valid value for the Lang attribute. It suggests that there are only four values available for the lang attribute. (csharp, jsharp, vb, xml).
Now the question is: Does SSDT add any extensions to this XML schema?
It seems that VS Content Installer has no support for deploying SSDT code snippets. There is a posted idea on visualstudio.uservoice.com which requests this feature, but it is still open.
I did not found any other resources related to this issue.
There is a possible workaround, which needs testing: You can create a PS/BAT which copies the snippet files into the VS's snippet folder for SSDT.

Dynamics CRM 2011

I am new to Dynamics CRM 2011 Online. I am try to generate the data context class using CrmSvcUtil.exe
This is my command:
CrmSvcUtil.exe /out:E:\OrgXrm.cs
/url:https://mdtestuser.api.crm5.dynamics.com/XRMServices/2011/Organization.svc
/username:MDTest#MDTestUser.onmicrosoft.com /password:Password
But its giving an error:
Exiting program with exception: An error occurred when verifying
security for th e message. Enable tracing and view the trace files for
more information. CrmSvcUtil.exe Error: 0 : Exiting program with exit
code 2 due to exception : Sy stem.ServiceModel.FaultException: An
error occurred when verifying security for the message.
I was researching another issue when I ran across a post in the Microsoft forums that may help. I remembered this question so I thought I would post another answer as this one had a positive resolution.
Quote:
I have dealt with this one before. Verify the Time and Date settings (including timezones) are set correctly on both the server and your client machine. It seems that if the two machines are out of sync by more than a minute or two it will cause this problem.
On my client machine I had to restart Visual Studio also for some reason after I set the server clock to get it to connect up properly.
http://social.microsoft.com/Forums/en-US/0ad9a5ee-dcce-4146-a1e6-20eafdccff46/crmsvcutil-error-an-error-occurred-when-verifying-security-for-the-message?forum=crmdevelopment
To fully understand your error, you should use config file with enable tracing, here is an example of config file:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="servicecontextname" value="XrmServiceContext"/>
<add key="codecustomization" value="Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration"/>
<add key="username" value="domain\user"/>
<add key="password" value="password"/>
<add key="out" value="XrmEntitiesReference.cs" />
</appSettings>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="configConsoleListener" type="System.Diagnostics.ConsoleTraceListener">
<filter type="System.Diagnostics.EventTypeFilter" initializeData="Error" />
</add>
</listeners>
</trace>
</system.diagnostics>
</configuration>
check out example from here:
http://www.resultondemand.nl/support/sdk/06abab26-40fc-4b85-9a2a-5e68903ea138.htm
JIC somebody get the same error.
I made the connection and I were able to generate the context from CRM online. The unique difference is in the URL, I have the next:
https://architecture2.api.crm.dynamics.com/XRMServices/2011/Organization.svc
You see this say crm not crm5 but that depends on your organization, to get the rigth one:
Open your organization then Settings->Customizations->Developer Resources->Organization data service
My command line to execute CrmSvcUtil.exe is:
CrmSvcUtil.exe
/url:"https://architecture2.api.crm.dynamics.com/XRMServices/2011/Organization.svc"
/out:"E:\Context.cs"
/username:MyUser#architecture2.onmicrosoft.com
/password:Password
Something else the account should have the required permissions, my account has System Administrator role.
I realize this is a long-shot, but has your password changed recently?
With a command string like this, a lot of people use .bat files to automate the process.
I dislike using passwords in .bat files because:
They are not secure (obvious, I know)
Maintenance. Every time you update your password, you would have to remember to update every script. Or painfully troubleshoot every failure and finally remember that the password was embedded.
To mitigate this I use SET with a /P parameter to prompt for a password during .bat file execution.
Not perfect, but a lot better than hard coding a password.
Here is an example using the command string you supplied:
rem ----- begin script -----
SET /P pwd=Password:
CrmSvcUtil.exe /out:E:\OrgXrm.cs /url:https://mdtestuser.api.crm5.dynamics.com/XRMServices/2011/Organization.svc
/username:MDTest#MDTestUser.onmicrosoft.com /password:%pwd%
CLS
SET pwd=.
rem ----- end script -----
In this example the SET /P tells the command processor to set an environment variable and prompt for the input.
“pwd” is the environment variable being set.
“%pwd%” is the actual use of the environment variable.
“Password:” is the prompt string that will be displayed when the .bat file is run.
“CLS” clears the screen.
“pwd=.” sets the environment variable to “.” so the password is not left in the environment.
You can ignore the lines beginning with “rem” as they are simply remarks.
The “not perfect” part of the solution is that your password is visible as you type. However by clearing the screen immediately following the prompt it is cleared from the screen right away. There are other ways to prevent the password from being visible as you type, however I think they are vastly over complicated or require downloading some additional bits. The idea of using a .bat file is that it is quick and easily updatable ergo low maintenance.
The SET /P works well in my case as no one is looking over my shoulder whenever I need to refresh my file, and there is virtually no maintenance once the .bat file is written.

CruiseControl.NET Visual Studio Test Cases not showing up on dashboard

I'm using CruiseControl.NET to run visual studio test cases after my project builds. In the raw xml log I can see it running the test cases and saying which passed and which failed, however on the CruiseControl dashboard all it says is:
9 Projects built with no warnings at all :-)
Juchuu !!!
Here's what my project block looks like:
<project name="projectname" queue="queuename" queuePriority="2">
<workingDirectory>C:\Build</workingDirectory>
<category>categoryname</category>
<webURL>http://myurl/ViewProjectReport.aspx</webURL>
<triggers>
<intervalTrigger seconds="60" />
</triggers>
<modificationDelaySeconds>60</modificationDelaySeconds>
&sc;
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
<workingDirectory>C:\mypath</workingDirectory>
<projectFile>project.sln</projectFile>
<buildArgs>/v:quiet /noconlog /p:Configuration=Debug</buildArgs>
<targets>Build</targets>
<timeout>900</timeout>
<logger>C:\Program Files\CruiseControl.NET\server\Rodemeyer.MsBuildToCCnet.dll</logger>
</msbuild>
<exec>
<executable>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\mstest.exe</executable>
<baseDirectory>C:\Build\Test\TestCases\</baseDirectory>
<buildArgs>/testcontainer:testproject\bin\debug\testproject.dll /runconfig:localtestrun.Testrunconfig</buildArgs>
<buildTimeoutSeconds>900</buildTimeoutSeconds>
</exec>
</tasks>
<publishers>
<xmllogger logDir="C:\Program Files\CruiseControl.NET\Logs\Navtrak\H4CommandProcess\" />
</publishers>
</project>
How do I get the passed/failed test cases to show up on the cruisecontrol dashboard page for that specific build?
Thanks,
Justin
See this article for some tips on how to get MSTest results to appear in CruiseControl.Net:
http://confluence.public.thoughtworks.org/display/CCNET/Using+CruiseControl.NET+with+MSTest
Essentially what you need to do is:
Get MSTest to save its test results to an xml (.trx) file (your raw build output might show test results in a test format, however CruiseControl.net needs the results in xml format)
Get CruiseControl.Net to merge this xml file into your cruise control build log.
Add an extra build report that uses an XSLT to show transform the xml test results into pretty html.
The above article goes into more detail on how to do this, as well as a couple of extra considerations (such as deleting old test results).
Also, I've noticed that you are using Visual Studio 2009 - something that the above article does not emphasis is that when you are setting up your dashboard to shown MSTest results, you need to make sure you use the VS2009 specific xslt in the CruiseControl.Net directroy, as the standard one won't display any results on the dashboard.

cruisecontrol.net email

On CruiseControl.net there is a link called “NUnit Details”. When you click on this it gives a lot of details including a summary section that looks similar to this…
Summary
Assemblies tested: 2
Tests executed: 56
Passes: 54
Fails: 2
Ignored: 2
I would like the summary emailed to me on every build. Any tips would be great.
The format of the e-mail is configured in the ccnet.exe.config or ccservice.exe.config (in C:\Program Files\CruiseControl.NET\server) if you are running ccnet a service.
I believe the file that you want to include is tests.xml as that includes a detailed listing of the nunit test results. Modify the xslFiles section of the configuration file to include this stylesheet. It will look something like this.
<!-- Specifies the stylesheets that are used to transform the build results when using the EmailPublisher -->
<xslFiles>
<file name="xsl\header.xsl"/>
<file name="xsl\compile.xsl"/>
...
<!-- add tests.xsl here... -->
<file name="xsl\tests.xsl"/>
</xslFiles>

Resources