Quick Index
Overview


We'll look at a examples of smoke tests.

We'll use DynamicArray as our subject (testee).

The most important methods are the constructors. Without them there are no objects.

We'll assume that DynamicArray core methods include "size", "add", "get", and "remove".

Constructor Smoke Tests


Example 1 - Constructing
This is the most important smoke test.

If no exception occurs, that means at least we can construct objects. Because without objects, we would have unusable software.
smokeTest_construct() {
	let dynArray = DynamicArray.newEmpty();
}



Core Method Smoke Tests


The short methods below exercise core methods
smokeTest_size() {
	let dynArray = DynamicArray.newEmpty();
	println(`Size (expecting 0): ${dynArray.size()}`);
}

smokeTest_add() {
	let dynArray = DynamicArray.newEmpty();
	dynArray.add('asha@hello.com');
	println(`Size (expecting 1): ${dynArray.size()}`);
}

smokeTest_get() {
	let dynArray = DynamicArray.newEmpty();
	let email = 'asha@hello.com';
	dynArray.add(email);
	println(`First Element (expecting [${email}]): ${dynArray.get(0)}`);
}

smokeTest_removeIndex() {
	let dynArray = DynamicArray.newEmpty();
	for (let i=0; i<10; i++)
		dynArray.add('Asha' + i);
	for (let i=0; i<10; i++)
		dynArray.removeIndex(dynArray.size() - 1);
	println(`Size (expecting 0): ${dynArray.size()}`);
}


Smoke Tests to Apply Pressure


These examples assure that a model can withstand applied pressure (e.g., a heavy data load).

These types of tests are relevent for certain types of models.

For data structures, these tests add many elements into the structures apply "pressure".

The purpose of smoke tests that "load data" is to apply some "load" (pressure) on the software.

It is suprising how generally easy it is to loads of any desire size (as shown below).

The second test below is extremely important. It uses "proper objects" (e.g. employees) rather than primitive-like values (e.g, strings, integers). Using proper objects can expose more bugs.
smokeTest_load() {
	let dynArray = DynamicArray.newEmpty();
	for (let i = 0; i < 1000; i++)
		dynArray.add('Asha' + i);
	for (let i = 0; i < 1000; i += 50)
		println(`Element at [${i}]: ${dynArray.get(i)}`);
}

smokeTest_object_load() {
	let dynArray = DynamicArray.newEmpty();
	for (let i = 0; i < 5000; i++)
		dynArray.add(new Employee(i, 'Name' + i));
	for (let i = 0; i < 5000; i += 250)
		println(`Element at [${i}]: ${dynArray.get(i)}`);
}