Execution order of TestNG's annotations

Tag(s):

Codes below show the execution order of commonly used annotations of TestNG.

First TestNG test

Tag(s):

Write TestNG test

Writing tests using TestNG is easy. There are only 2 steps:

Imagick basic

Tag(s):

# Resize image
convert -resize 50% -quality 80 input.jpg output.jpg
 
# Convert color to gray

Take screenshot from command line on an X server

Tag(s):

import is part of ImageMagick package.

Add filename, date and time at the bottom of image

Tag(s):

REM ##########################################################
REM Make a copy of the original image and then add filename, date and time at the bottom of the copy(*%suffix%).
REM This script was created because I need to know the filename of the printed image.

Parameterized Tests

Tag(s):

Sometimes you want to use a generic test method to test with different sets of values. But if you use a loop to do that, then the whole method will fail if 1 of the set of values fails. As a result, it is not helpful as you don't know which specific set of values failed. JUnit report will only show that the generic test method as a whole failed. But if you are writing 1 test method per set of values, then there is a lot of codes, which is not efficient and practical.

Execution order of JUnit's annotations

Tag(s):

/**
 * Show the execution order of each annotations.
 * Given this test, the methods will execute in the following order:
 * oneTimeSetUp()
 * setUp()
 * testMyFunction1()
 * tearDown()
 * setUp()
 * testMyFunction2()
 * tearDown()
 * oneTimeTearDown()
 * 
 * **NOTE**: JUnit doesn't guarantee the execution order of the test functions(@Test).
 * 
 */

Calculate the total number of weeks in a specified month

Tag(s):

<?php
  /**
   * Return the total number of weeks of a given month.
   * @param int $year
   * @param int $month
   * @param int $start_day_of_week (0=Sunday ... 6=Saturday)
   * @return int
   */

Wrap <pre>

Tag(s):

pre
{
  white-space: -moz-pre-wrap; /* Mozilla, supported since 1999 */

CSS one-pixel table border

Tag(s):

<html>
  <head>
    <title>1-pixel table border</title>

Pages

Subscribe to OpenWritings.net RSS