Archive for February, 2006

JMeter Birthday Boundary Testing - Solution

Tuesday, February 21st, 2006

One of the applications I was testing today required a boundary test for people aged 65 years old. To do this, I set up two variables, one with a generated date exactly 65 years ago, and the other being 65 years old plus one day, thus giving an age of 64.

age64:

${__javaScript(with(new Date()) X = String(getMonth() + 101).substr(1) + “/” + String(getDate() + 101).substr(1) + “/” + String(getFullYear() - 65), dateString)}

age65:

${__javaScript(with(new Date()) X = String(getMonth() + 101).substr(1) + “/” + String(getDate() + 100).substr(1) + “/” + String(getFullYear() - 65), dateString)}

Note that this will fail on the last day of the month and the day before a leap day. But hey, you have been working hard all month … take a day or two off! ;-)

Formatted Date in JMeter / JavaScript - Solution 2

Wednesday, February 15th, 2006

In another JMeter testing scenario, I wanted to set a user defined variable to a date string with the format “yyyymmddhhmmss”. The solution below solved the problem of left-padding with zeros and getting all the formatting done in a single line.

${__javaScript(with(new Date()) X = getFullYear() + String(getMonth() + 101).substr(1) + String(getDate() + 100).substr(1) + String(getHours() + 100).substr(1) + String(getMinutes() + 100).substr(1) + String(getSeconds() + 100).substr(1), dateString)}

The uses of this kind of user variable include:

  1. Knowing exactly when a test was run for auditing
  2. Guaranteeing a unique string for things like new test usernames [note that I am writing regression tests which only run once. If you are running load tests, you will want to add String(getMilliseconds() + 1000).substr(1) to get unique string each pass]
  3. Having a string you can key off of, for example to clean up database entries you have made

Boxes With Rounded Corners in CSS - Solution

Sunday, February 5th, 2006

Round cornered box rendered in FireFox 1.5

CSS Code

.textBox {
background:#9cf url(/images/question-box.gif) left top no-repeat;
/* Width attribute needed to fix behavior in Internet Explorer */
/* width:100%; */
}

.textBox .right {
background:url(/images/question-box-right.gif) right top no-repeat;
}

.textBox .bottom {
background:url(/images/question-box-bottom.gif) left bottom no-repeat;
}

.textBox .corner {
background:url(/images/question-box-corner.gif) right bottom no-repeat;
padding:1em;
}

HTML Code

<div class=”textBox”><div class=”right”><div class=”bottom”><div class=”corner”>
<p>It is easy to create a resizable box with rounded corners using Cascading Style Sheets (CSS). Four nested &lt;div&gt; elements are required, each having a background image respectively set to the left-top corner (including the body), right edge, bottom edge, and right-bottom corner.</p>
</div></div></div></div>

See screenshots at http://www.threeleaf.com/freelance-work/demos/round-corners/ , along with some examples of why the workaround is necessary in Internet Exploer 6 and 7. My question: Why don’t they fix that? If less funded browser companies like Firefox and Opera have come up with solutions, why can’t Microsoft?