Can we add custom action to HtmlLoggerState - visual-studio-2013

I'm using VS2013/CodedUI and my palybacksetting is as follow:
Playback.PlaybackSettings.LoggerOverrideState = HtmlLoggerState.AllActionSnapshot;
I also have a 3rd party tool that I have integrated to my code that does some action that codedui can't...Iw an to be able to log those steps into the ActionLog.html file with where codedui capture the actions and screenshot.
I searched a lot but didn't find anything on how we can achieve this.
thanks in advance for any help

I posted a response over here: Writing Custom HTML Logs
It sounds like there's not a good way to do this. You can get the path to where the html file lives and write a custom logger from there. I'm not sure it'd be safe to try and write to it while your test is executing, but perhaps once your test is complete.

Related

excluding files with guard-jasmine while running coverage

I am using guard-jasmine create coverage reports for my javascript app written with backbone js. I would like to exclude the template files from being included in the coverage. Is there a way to do this currently? I have also tried looking through the source and passing the -x option to the intrument command in the coverage.rb file but that doesn't seem to help at all. Any pointers would be appreciated.
Thanks!
There is currently no way of configuring Guard::Jasmine to skip specific files from generating the coverage.
A possible way to add this would be to add something like a coverage_skip option that contains a regex to check it as a preconodition in the coverage tilt template:
return data if file =~ ENV['COVERAGE_SKIP']
Since we do not have access to the Guard::Jasmine options, we need to set it as an environment variable in the server process.
A pull request is heartly welcome ;)

Selenium Webdriver/TestNG/Maven/Xvfb - take screenshot on fail?

wanted to ask you about the best way to take screenshot on fail in such project?
Should I do it in the Selenium code, or in the Maven project via some command or with Xvfb?
Im using Firefox headless via Xvfb.
I have seen a few classes on the internet that take screenshots, but Im missing the big picture here.
How does this class know when to take the screenshot?
How does Jenkins tell the java test code that it has failed, so it will take a picture?
Where in the test code should I reference the take screenshot class?
Should I use a try catch on the whole test?
Isnt there a Jenkins plugin that will automatically save screenshot on fail?
I just found an article that explains a much better way to do it: http://darrellgrainger.blogspot.com/2011/02/generating-screen-capture-on-exception.html
How does it work?
Effectively, you pass in a custom WebDriverEventListener, which has functions that will be called on certain events. One of those events is onException(). So every time an exception is thrown by WebDriver, you can write the code to take a screenshot.
I have seen three different ways to do this:
If you have a static driver, the easiest way is to set up a listener in TestNG (Overridding TestListenerAdapter), and then to take a screenshot in the onTestFailure() method.
My personal method is to use the Selenium Page Object pattern, but modified a bit. I have created an EnhancedWebElement object that wraps and extends a normal WebElement, and has a reference to the driver. Then in each of the methods that WebElement has, I perform the call in a try/catch and in the catch, I then take a screenshot. I'm open to sharing the code, but I'd have to trim away quite a bit to post here, so please tell me if you want to see it.
Alternatively, you can set up a proxy around the WebElement or the Driver itself and have it catch everything. I haven't done this, but I've seen it work on other projects.
just found an article that explains a much better way to do it: http://darrellgrainger.blogspot.com/2011/02/generating-screen-capture-on-exception.html
Blockquote
But this dicision have some problem. it will save screenshoot on any exception even when you try/catch some in your code.
I use methods from that article. But in my testng.xml files i add
`
<listeners>
<listener class-name="MyListener" />
</listeners>
`
And than i create
`
public class MyListener implements ITestListener{
//almost all methods i create blank
//but implement only onTestFailure
//
onTestFailure(){
//here i used methods from article ubove
//
}
}
`
And screenshots done only in case when my #Test fail.

How to trace CakePHP's inner workflow

Short description
I'm getting used to CakePHP right now and am wondering about how to get more debug-information about what is happening inside the framework.
Let me please explain my situation a little more detailed
As you know CakePHP does a lot for you without putting you into the need to write additional code. One example is the handling of models.
I just created a model User and added validation-rules (no other methods). As described in the API methods like save will just work.
After that I created the needed controller and view to add a new user. When I try to add a user from the view I just receive the flash-message The user could not be created. Please, try again. No validation-violations are flashed.
I also did set the debug-level to 2: Configure::write('debug', 2); but do not receive any errors. The error.log inside \tmp\logs is also empty.
I really do want to learn how to solve those issues in the future.
So what else can I do to debug / display inner processes of cake?
Thank you very much for your help!
DebugKit is an official plugin that gives you lots of information on the request, queries and variables produced by Cake:
https://github.com/cakephp/debug_kit
You can also use trace() and other methods in the Debugger to show what is being executed in the background:
http://book.cakephp.org/2.0/en/development/debugging.html
Use a PHP IDE with an integrated debugger. That will allow you to follow execution line by line as it is executed and even inspect variable values as you go. Netbeans is a free one.

How to write the code for listeners in TestNG?

I want to know how can i use listeners in my java code? Also what changes are to made in the xml file if i want to incorporate the listeners? I added org.testng.ITestNGListener then too the program is throwing errors?
Do you have any specific questions that are not covered by the documentation:
http://testng.org/doc/documentation-main.html#logging
?

how to get Hudson CI to include test results in the status email

I've been evaluating Hudson, with an eye to convert to it from CC.NET. In CC.NET, I've gotten my emails to include test statistics, such as # of tests run, how many failed, etc. It even shows in red "this project has no tests" which is a great motivator, right?
Is there any way to accomplish this in Hudson?
I've tried the email-ext plugin, because I'm told that it can get test output and other great stuff into the email, but I just can't figure out "how."
It looks like I need to put a token in for "content" but I dont see any token available that looks like "test results" to me :) Or any that would parse some xml that I provide a path to, or such.
Has anyone done this and can help?
Thanks!
From the Email-ext plugin wiki page:
To see a list of all available email tokens and what they display, you can click the "?" (question mark) at the top of the email-ext section on the project configuration screen.
I can't check if it's listed in the online help right now but I think you're looking for the $FAILED_TESTS token.
If you need more guidance, check this blog post: Continuous Integration with Hudson, ColdFusion, and MXUnit: Advanced Notification Control. There are some screenshots that might help.
See this question - Having Latest Tests Results info in the notified email with Hudson . It seems like the only answer is to hack in your own solution, until Email-ext is improved.

Resources