Certified outsystems developer - part 2

The last few days I've took the level 3 certification of the outsystems platform. Today I finally received the results: I passed :D

Level 4...Here I go!

 


Check out my other hobby

Besides programming, I enjoy taking photos. I recently bought a cool camera and since then I've pursuit this hobby more intensely. So you can now check out my recent photos @ zooomr.

tradicional boat

Lego Darth Vader Canteen Incident


Register.com is forcing me to pay for a service that i no longer want

After some year with Register.com has my domain name registrar, I've decided to transfer my domain to another registrar. The domain been transfer already had expired so I though the process would run smoothly.

How I was wrong.

While talking with Register.com live chat thy inform me that I would have first to pay the renew of the domain and only then  could I transfer the domain.

"WHAT?!?!? I have to pay for a service I no longer want???"
"You need to renew the domain name first and then transfer the domain name to another Registrar."

What the hell!!!!!! 

ICANN clearly states that:

"My domain name has just expired. Can my registrar require me to pay for a renewal before I can transfer to a new registrar?

No. Your new registrar of choice can initiate a transfer request on an expired domain name once they receive the required authorization from you. Expiration or nonrenewal of a domain name is not a valid reason for denial of a transfer request.

Note that if the registrar has already begun the deletion process on the domain name and its status shows it to be within a 30-day Redemption Grace Period, the name must be .restored. by your current registrar before it can be transferred."

 I then asked what would happen if I just let the domain to expire. They then told me that they couldn't tell me how long would the domain be available to register again. 

So after much talk they left me with no choice to renew the domain. But I'm still transferring it to another registrar. 

What's funny about this is that they had the nerd to tell me that "We are committed to customer service and we will do everything possible for the satisfaction of our customers." ....Hummm..."everything possible for the satisfaction of our customers"...DON'T THINK SO!!!!!

 I've got other domains with Register.com that haven't yet expired...I'll be transferring them also...this isn't a company I will work any time soon.

kick it on DotNetKicks.com

OutSystems Certified Developer

For all of you who don't know, OutSystems Platform "enables enterprises to easily build, change and operate applications that integrate existing systems to reach new users. By combining the productivity offered by visual modeling tools with the level of extensibility and customization found in integration suites or custom development frameworks, the OutSystems Platform is helping businesses to deliver their applications in weeks, instead of months or years."

I've completed the first stage of the certification with the completion of the Level 1 and 2 skills tests. These are online tests, and the best of all, they are free. Just log on in the OutSystems community, download the free edition and complete the tests.

If all goes well, I will soon start the next levels of certification, but from now on, these are not online.

certified


Asp.Net: Why not a App_MasterPages folder?

With the asp.net 2.0 a new set of application folder appeared. You now have a folder for your database (app_data), a folder for your themes (app_theme) and even a folder for your code (app_code).

But what about the Master Pages? Aren't they so important as the Themes? Why isn't there an App_MasterPages folder?

A master page is part of our web development and a folder for them would help in the organization. And like the app_data as the |DataDirectory|, a keyword could be made available in the web.config.

I've opened a suggestion in the  Connect site, so if like me you think this is a good idea, please vote.

What do you think?

kick it on DotNetKicks.com

Windows Workflow and Controls Design time support

Scott @ Ode to Code has posted a A Few Interesting Windows Workflow Links that you must read if working with WWF.

On the other side, Amr Elsehemy  has a 9 part post about the controls design time support, for all of you that, like me, develop custom controls. Great work Amr.


UI: Unit Testing or/and Use Case Testing?

After reading the Automated GUI testing - Is it worth it? from Mladen Prajdić I started thinking  what I'm doing when I use the open source WaitN Web Application Testing tool to test my webforms. After a small debate with some colleagues I came to the conclusion that I can both unit test and use case test a UI.

In this post I will not cover any code, just explain my idea. If you want to see some code, please let me know.

So, lets "work" with the following example:

We have developed a funds transfer webform for a bank web application.  This page has a custom server control for filling the account number. This control has the following business rules (applied using JavaScript, and validated on server-side):

  • only numbers can be typed;
  • a valid account number is validated using a specific formula;
  • the control itself is a composite control containing the text box and a custom validator (for validating the typed account);

We also have a custom server control for the amount value. This control also only allows numbers and the "," digit for the decimal values.

There's also another custom server control that observes the state, in this case, of the account control, and when this is filled with a valid account number, enables the transfer button.

So we now have a webform with a destination account text box, a amount text box and a transfer button.

Now I came to realize that I can both Unit test and Use Case test the UI.

Unit Testing the UI

So, we have developed 3 custom server controls (account, amount and behavior). Although they are server controls, they have also a strong client-side usage, that can be tested. This said, We can build a web page only contains our account control, a validation summary and a asp.net button.

So using the WaitN Web Application Testing I can unit test the control on his web environment and test if all the client-side side business rules are ok.

WaitN allows me to fill the control with a value, calling all the client-side events, like the keypress and the keydown. It also allows me to access the DOM of my web page, accessing this way to all the html on my page. So I can, for instance, test if typing and invalid account number the custom validator is fired and the correct message is showed on the validation summary.

Use Case Tests on the UI

Use Case tests differs from the unit test in the way that what we are testing is not the functionality of the control, but what the customer accessing the page can do and what are the behaviors of our page according to this use. So, for instance, an returning to the Transfer page, we can use the WaitN tool to test if typing and invalid account still maintains the transfer button disabled. Other Use Case tests like if both account number and amount number are filled the transfer button becomes enabled, if the amount value is less than 0 a error message is showed, etc.

Conclusion

After all this babbling, I think that we can both Unit test and Use Case test our UI. What do you think?

kick it on DotNetKicks.com

Welcome to BlogEngine.NET 1.3

If you see this post it means that BlogEngine.NET 1.3 is running and the hard part of creating your own blog is done. There is only one thing you need to do from this point on to take full advantage of the blog and that is to set up the first author profile.

Write Permissions

To be able to log in to the blog and writing posts, you need to enable write permissions on the App_Data folder. If you’re blog is hosted at a hosting provider, you can either log into your account’s admin page or call the support. You need write permissions on the App_Data folder because all posts and comments are saved as XML files and placed in the App_Data folder.

Username and password

When you've got write permissions to the App_Data folder, you need to change the username and password. Find the sign-in link located either at the bottom or top of the page depending on your current theme and click it. Now enter "admin" in both the username and password fields and click the button. You will now see an admin menu appear. It has a link to the "Users" admin page. From there you can change the username and password.

On the web

You can find BlogEngine.NET on the official website. Here you'll find tutorials, documentation, tips and tricks and much more. The ongoing development of BlogEngine.NET can be followed at CodePlex where the daily builds will be published for anyone to download.

Good luck and happy writing.

The BlogEngine.NET team


Mock Javascript or How to unit test Javascript outside the Browser environment - Part 1

 At work I do a lot of javascript. The .net framework we develop has a extensive javascript library for the web controls to use and abuse. What happens is that many times we end up building pages to test parts of our js framework.

But you, the reader, must be thinking..."Why don't yo use a unit testing framework like JSUnit?"

Well this is one possible way... but what it would be nice was to have a way of testing the javascript in the same way we test the framework: in the build process.

The problem is that many of the javascript we do was one BIG dependency: the Browser. The window, the document, and other objects supplied by the browser are needed.

So Paulo suggested: "Why don't you build a Mock framework for javascript?"

This is a great ideia.... So I started coding (with the mock expert guidance of Paulo) and ended up with a way of mocking javascript. This is still in a early stage of development, but I wanted to show you what I'm doing hoping to get some feedback.

So, taking a simple javascript like the one bellow and build a mock test for it:

 

function GreetUser()
{
var txt = document.getElementById("txtName");
var lbl = document.getElementById("lblGreet");
lbl.innerHTML = "Hi " + txt.value; 
}

 

Since we don't have the browser as the running environment, we need to mock the document object and his methods, that in this case is the getElmentById. The mocked document.getElmentById must then return an object containing the value property, in the case of the txtName, and the innerHTML for the lblGreet.

The first thing we must do is create a new instance of the JSMock object:

var mock = new JSMock();

Then we mock the document object like so:

var mockedDocument = mock.mockObject("document");

After we need to asign the new mocked object to the script container, this way simulating the browser enviroment:

this.document=mockedDocument.target;

This done, we must create the expectations for the mocked object, first for the txtName control:

var txt = { "value" : "Bruno Figueiredo" };
mockedDocument.expectAndReturn("getElementById", ["txtName"], txt );

Then for the lblGreet control:

var lbl = { "innerHTML" : "" };
mockedDocument.expectAndReturn("getElementById", ["lblGreet"], lbl );

All we need to the next is call the GreetUser function and assert the results:

GreetUser();
assert.AreEqual(lbl.innerHTML, "Hi Bruno Figueiredo");

Now, if I'm not using the browser to run the scripts, we need to use the Windows Script Host to run them. I don't know much about WSH so, this is a hudge problem for me. I've started reading about it and came up with this script to run the tests:

<job id="Job1">
<script language="JavaScript" src="JSUnit.js">
</script>
<script language="JavaScript" src="JSMock.js">
</script>
<script language="JavaScript">
var mock = new JSMock();
function GreetUser()
{
var txt = document.getElementById("txtName");
var lbl = document.getElementById("lblGreet");
lbl.innerHTML = "Hi " + txt.value;
}
function testGreetUser()
{
var mockedDocument = mock.mockObject("document");
this.document=mockedDocument.target;
var txt = { "value" : "Bruno Figueiredo" };
mockedDocument.expectAndReturn("getElementById", ["txtName"], txt );
var lbl = { "innerHTML" : "" };
mockedDocument.expectAndReturn("getElementById", ["lblGreet"], lbl );
GreetUser();
assert.AreEqual(lbl.innerHTML, "Hi Bruno Figueiredo");
}
JSUnit.container = this;
JSUnit.addTest("testGreetUser");
JSUnit.runAll();
</script>
</job>

To run just drop the above code in a file, for example test.swf and execute "cscript test.swf" on the command-line.

What happens is that I now need a way to capture the output somehow. Maybe you can help me out.

In the meanwhile i'll dig some more on the WSH and as soon as I have some new code I'll update this post.

 

Appendix

Code for the JSMock object:

var JSMock = function JSMock()
{
var mockedObjects = {};
this.mockObject = function JSMock$MockObject(name, returnType)
{
return this._createObject(name);
};
this._createObject = function JSMock$_createObject(objectName)
{
var mock = this;
return mockedObjects[objectName] = {
"target":{}, 
"expectAndReturn": function expectAndReturn(funcName, comparerValue, objBody)
{
var me = this;
var obj;
if (this.target[funcName] == null)
{
obj = {
"comparers" : {},
"func": function func()
{
return this.comparers[mock._serialize(arguments)];
}
};
}
else
{
obj = this.target[funcName].object;
}
obj.comparers[mock._serialize(comparerValue)] = objBody;
var returns = function(){
return obj.func.apply(obj, arguments);
};						
this.target[funcName] = returns;
this.target[funcName].object = obj;
}
};
};
this._serialize = function JSMock$_serialize(arrayValue)
{
var serial = "";
for (i=0;i<arrayValue.length;i++)
{
serial+= new String(arrayValue[i]);
}
return serial;
};
}

Code for the JSUnit object:

var JSUnit = {
tests:null,
container:null,
runAll:function JSUnit$runAll(container)
{
container = container || this.container;
if (this.tests==null)
{
this.tests={};
for(var name in container)
{
if(name.indexOf("test")===0)
{
this.tests[name] = container[name];
}
}
}
for(var name in this.tests)
{
this.tests[name].apply(container);
}
},
run: function JSUnit$run(test)
{
test();
},
addTest: function JSUnit$addTest(testName)
{
if (this.tests==null)
{
this.tests={};
}
var test = this.tests[testName];
if (test == null || test == undefined)
{
this.tests[testName] = this.container[testName];
}
}
};
var assert = {
AreEqual: function Assert$isEqual(value1, value2, errorMessage)
{
var aux = (value1===value2);
if (aux) return true;
else 
{
if (errorMessage)
{
throw errorMessage;
}
else
{
var msg = "The values aren't equal!\nExpected: " + value1 + "\nReceived: " + value2;
WScript.StdOut.Write(msg);
//WScript.Echo(msg);
}
return false;
}
}
};

 

kick it on DotNetKicks.com

About Me

I'm a Senior Consultant in the work, and a geek outside of it :P

Recent comments