- https://github.com/vim-scripts/bats.vim
- https://blog.engineyard.com/2014/bats-test-command-line-tools
- https://github.com/duggan/pontoon/blob/master/.travis.yml (example of how to use it with travis)
- http://www.kinnetica.com/2011/05/29/using-screen-on-mac-os-x/ (used to split the screen and see both vim editor and shell execution at the same time)
A personal blog about: transforming Web Application Security into an 'Application Visibility' engine, the OWASP O2 Platform, Application/Data interoperability and a lot more
Showing posts with label Unit Tests. Show all posts
Showing posts with label Unit Tests. Show all posts
Sunday, 10 May 2015
Writing Unit Tests in Bash using BATS
Since every code we write should have Tests, here is a good tool to test bash scripts:
Labels:
Unit Tests
Thursday, 8 January 2015
Achieving 98% Code Coverage, by running mocha Web Automation Tests in Chrome (from WebStorm)
Here is what the high-productive Node + Chrome TDD test environment (that I use every day) looks like, when executing the TM_4_0_QA UI Automation tests
This is the setup that allows me to have 98% to 100% code coverage (see The quest for 100% Code Coverage, the 96cc idea and 'apps with low CC must be insure' for more details)
The Chrome window on the right is powered by O2 Platform's NWR project
The use of WebStorm is not required for the tests to run, since the same result can be achieved by running npm test from the console.
Video: Running mocha Web Automation Tests in Chrome (from WebStorm)
This is the setup that allows me to have 98% to 100% code coverage (see The quest for 100% Code Coverage, the 96cc idea and 'apps with low CC must be insure' for more details)
The Chrome window on the right is powered by O2 Platform's NWR project
The use of WebStorm is not required for the tests to run, since the same result can be achieved by running npm test from the console.
Video: Running mocha Web Automation Tests in Chrome (from WebStorm)
Labels:
FluentNode,
TeamMentor,
Unit Tests
Thursday, 1 January 2015
The quest for 100% Code Coverage, the 96cc idea and 'apps with low CC must be insure'
I've spent the last day improving the UnitTest coverage of TM_4_0_Design and since this codebase as been developed with a nice TDD workflow, after a bit of code-cleanup and refactoring I was able to achieve 100% Code Coverage :)
Labels:
TeamMentor,
Unit Tests
Tuesday, 9 December 2014
Node + Chrome TDD test environment (finally got it to work)
In the past 3 months I've spent countless hours (and a good number of weekends) trying to figure out a way to better TDD node and JS, and finally I got it to work:
Labels:
Chrome,
NodeJS,
TeamMentor,
Unit Tests
Monday, 24 March 2014
E2E testing AngularJS links and routes using NCrunch, VisualStudio and FluentSharp.WatiN
In order to have real TDD while developing AngularJS inside VisualStudio, I needed a way to write C# Unit Tests that could be executed in the background by NCrunch (i.e. in real-time during coding).
Since I wanted to do E2E (End-to-End) testing of the AngularJS app, I needed either a good mocking environment (like the one provided by KarmaJS/AngularJS Mocks) or the real thing (i.e. actually running the app on a local IIS/Cassini server).
If I have the choice, I always prefer to run my tests without mocking (or with as least amount of Mocks as possible), since that allows for a much more realistic test environment, and promotes much better engineering and coding practices.
This post shows how I created such environment and provides a couple examples of C# tests written to check if links created by AngularJS directives and routes are being correctively set.
Since I wanted to do E2E (End-to-End) testing of the AngularJS app, I needed either a good mocking environment (like the one provided by KarmaJS/AngularJS Mocks) or the real thing (i.e. actually running the app on a local IIS/Cassini server).
If I have the choice, I always prefer to run my tests without mocking (or with as least amount of Mocks as possible), since that allows for a much more realistic test environment, and promotes much better engineering and coding practices.
This post shows how I created such environment and provides a couple examples of C# tests written to check if links created by AngularJS directives and routes are being correctively set.
Labels:
AngularJS,
NCrunch,
Unit Tests,
WatiN
Sunday, 23 March 2014
Problem with AngularJS ng-view, it doesn’t work when inside a directive
I hit an interesting problem yesterday with AngularJS views. They (the views) where working when clicking on a link, but not working when accessed directly, or when the back button was used (which broke the idea of AngularJS routing, since it is supposed to handle those to key scenarios).
After quite a bit of debugging, I was able to track the problem to the fact that if I placed the ng-view directive inside another directive, the refresh and back button would break (although it would work ok for links and direct browser url manipulation).
What is really nice, is that I was able to use the .NET C# based Unit Test infrastructure to confirm this problem and test for it :)
After quite a bit of debugging, I was able to track the problem to the fact that if I placed the ng-view directive inside another directive, the refresh and back button would break (although it would work ok for links and direct browser url manipulation).
What is really nice, is that I was able to use the .NET C# based Unit Test infrastructure to confirm this problem and test for it :)
Labels:
AngularJS,
NCrunch,
Unit Tests
Wednesday, 18 December 2013
Executing Eclipse Plugin JUnit tests in real-time without needing to restart Eclipse (with no mocking)
One of the key capabilities that I wanted to have after Programming Eclipse in Real-Time (using an 'Groovy based' Eclipse Plug-in), was to be able to run JUnit tests (including tests using STWBot) in the live (under debug) Eclipse instance (called test Eclipse below).
This would allow me to code in a very quick/efficient TDD workflow, since I wouldn't have to wait 15s to 30s to see execution results for new JUnit tests or major/minor changes to existing JUnit tests.
The good news is that by using the GroovyExecution API that I wrote for the TeamMentor Eclipse Plugin, I was able to dynamically load and run the class files of the JUnit tests to execute, which was already a massive milestone, since that gave me 80% of what I needed. But it was only after Adding and using new API methods, that are consumed by an Eclipse Plugin under development (without Eclipse restart) and having JRebel enabled, that I had the full dynamic environment (where changes to the main plugin code and changes to JUnit test code did NOT require an Eclipse restart).
Here is a walkthrough of how it works (still a bit rough around the edges , but already a really powerful workflow).
This would allow me to code in a very quick/efficient TDD workflow, since I wouldn't have to wait 15s to 30s to see execution results for new JUnit tests or major/minor changes to existing JUnit tests.
The good news is that by using the GroovyExecution API that I wrote for the TeamMentor Eclipse Plugin, I was able to dynamically load and run the class files of the JUnit tests to execute, which was already a massive milestone, since that gave me 80% of what I needed. But it was only after Adding and using new API methods, that are consumed by an Eclipse Plugin under development (without Eclipse restart) and having JRebel enabled, that I had the full dynamic environment (where changes to the main plugin code and changes to JUnit test code did NOT require an Eclipse restart).
Here is a walkthrough of how it works (still a bit rough around the edges , but already a really powerful workflow).
Labels:
Eclipse,
JRebel,
TeamMentor,
Unit Tests
Tuesday, 12 March 2013
The Email RegEx that (could had) DOSed a site
While I was writing the UnitTests for TeamMentor's NewUser validator (see Validating a POCO DataContract using .NET's DataAnnotations Validator ), I had a weird result in one of the tests.
I basically got a 'never ending execution' scenario on this UnitTest:
I basically got a 'never ending execution' scenario on this UnitTest:
Validating a POCO DataContract using .NET's DataAnnotations Validator
In order to make sure that the TeamMentor server only creates users with valid data, here is how I implemented data validation into the NewUser class using .NET's DataContract annotations.
The first step was to add the annotations to the NewUser object, which originally looked like this:
The first step was to add the annotations to the NewUser object, which originally looked like this:
Labels:
ESTAPI,
TeamMentor,
Unit Tests
Friday, 25 January 2013
GUI with WebStorm and JsTestDriver controlling 3 Hijacked Browser windows (Chrome, Firefox and IE)
Following from PoC - Selenium - Gui with 3 Hijacked Browser Windows and Running JavaScript TestCase Unit Tests using JsTestDriver (in WebStorm) here is a similar PoC, now with JsTestDriver controlling 3 Browsers in the same GUI:
Labels:
JsTestDriver,
O2 Platform,
Unit Tests,
WebStorm,
WinAPI
Running JavaScript TestCase Unit Tests using JsTestDriver (in WebStorm)
As part of the process of adding more UnitTests to TeamMentor (while using WebStorm) I’m starting to convert some of QUnit Tests written a while back into JsUnitRunner (which I can execute directly from WebStorm’s IDE)
The process is quite easy since WebStorm already supports JsUnitRunner, which is explained in detail in this JetBrains JavaScript unit testing support blog post.
The process is quite easy since WebStorm already supports JsUnitRunner, which is explained in detail in this JetBrains JavaScript unit testing support blog post.
Labels:
JsTestDriver,
Unit Tests,
WebStorm
Saturday, 12 January 2013
Sending messages to TeamCity and UnitTest to check if the Google Analytics file has changed
Since it is a really bad idea for websites to load Javascript files from external domains, my objective is to host the Google Analytics ga.js file directly in TeamMentor’s Javascript folder (i.e. not load ga.js from Google's server (which btw, is what most websites do)).
The only potential side-effect of hosting this file natively, is if Google changes the content of the ga.js file (where we are would be using an out-of-date version that could cause problems in the way the data is processed by Google). So to handle that case, I’m going to write a unit test to compare the 'TeamMentor hosted version' with the version at http://www.google-analytics.com/ga.js (this UnitTest needs to also be executable from TeamCity)
The only potential side-effect of hosting this file natively, is if Google changes the content of the ga.js file (where we are would be using an out-of-date version that could cause problems in the way the data is processed by Google). So to handle that case, I’m going to write a unit test to compare the 'TeamMentor hosted version' with the version at http://www.google-analytics.com/ga.js (this UnitTest needs to also be executable from TeamCity)
Labels:
TeamCity,
TeamMentor,
Unit Tests
Friday, 11 January 2013
Using Selenium to Login using Multiple Browsers
Following from yesterday's posts:
- Coding Firefox in C# in real-time using Selenium's Firefox driver and
- OpenQA.Selenium.DriverServiceNotFoundException on Chrome
Labels:
NUnit,
Selenium,
TeamMentor,
Unit Tests
Thursday, 10 January 2013
OpenQA.Selenium.DriverServiceNotFoundException on Chrome
While trying to running a TeamMentor UnitTest in Chrome I got this error:
Labels:
NUnit,
REPL,
Selenium,
TeamMentor,
Unit Tests
Coding Firefox in C# in real-time using Selenium's Firefox driver
The best way to write and debug Selenium Web Automation scripts is to be able to be able to write code snippets in real time (in a REPL)
This post will show how I just did that for the TeamMentor’s UnitTests environment that Michael Hidalgo is working on.
This post will show how I just did that for the TeamMentor’s UnitTests environment that Michael Hidalgo is working on.
Labels:
NUnit,
REPL,
Selenium,
TeamMentor,
Unit Tests
Using VisualStudio C# REPL to quickly find issue
While refactoring a TeamMentor UnitTest, I hit on this error:
Labels:
REPL,
TeamMentor,
Unit Tests,
VisualStudio
Just moved from MSTest to NUnit
Because although we did try to use MSTest for TeamMentor UnitTesting, it lacked a couple key features (namely the ability to define generic types in the Class Attribute).
Here is Michael’s commit that shows a simple NUnit test with multiple Browser invocations (note the TestFixture attributes):
Here is Michael’s commit that shows a simple NUnit test with multiple Browser invocations (note the TestFixture attributes):
Labels:
NUnit,
TeamMentor,
Unit Tests
Subscribe to:
Posts (Atom)


