Application Design & Use Cases.
Often, when a customer orders application, she or he orders a collection of a certain functionalities.
For example:
- logging into online email application,
- deleting all spam in spam inbox,
- logging off automatically after a given time,
- configuring email sorting preferences,
- ...
Use cases are means of specifying these functionalities, defined by a number of steps (click here, scroll here, type something here, read report's field #n, etc ...).
A minimal set of use cases often determines how user interface should look, is often a formal requirement for ordered application functionalities - can be a part of the business contract between a customer & a developer company.
Automated Tests, Changes & Debugging.
Often tests for use cases can be automated, can be performed after any change is introduced into the code ... just before program's compilation, just before running an application, or at any other convenient moment.
By using Automated Use Case Tests, programmers can be comfortable that when they (or their teammates) change parts of the code, the older parts of the code (previous functionalities) that they are responsible for - won't prove erroneous after the new code additions.
Automated Use Case tests often show when part of the code is erroneous after changes, and while these are far from being 'proofs of code's correctness', these are extremely practical nevertheless. Even if not every error is caught by these - carefully designed tests can quickly find basic functionality failures. Other errors can still be found & fixed using other methods, and it's still easier to fix one error than multiple overlapping ones.
More than that - carefully designed automated tests can help programmer to create 'Mental Test Harness' that let's them more boldly & quickly do larger changes in code without inspecting the same things over & over, without fearing of application breakages so much.
This also builds Trust & Responsibility in the teams - with tests it's quick & easy to find out when someone breaks other teammate's code parts - at early stage of failure at that, so it can be addressed before error turns to be too complex to address quickly, before true stress, psychological dramas & employee firings start, before project's budgets & time schedules are endangered.
In many ways, Automated Tests help to develop applications with much more of the speed & security, with only a small amount of extra code at start (tests have to be designed & written too) & with a small amount of maintenance (when requirements change, tests have to be modified).
Documentation & Automated Tests.
Important aspect of code's quality are automated tests and documentation.
Developers should not write in documentation anything they please, there should be formal standards on what to write and how.
Class documentation should state the Contract between class user and class creator - class responsibility, invariants, what results code provides on which conditions. Results are not only returned values of methods, but also exceptions thrown, state changes, methods called and events raised.
As of how classes should be documented - there's for example Javadoc writing guidelines and requirements, these are about style, keywords and syntax.
Automated Tests for each of classes should be grouped in a single file.
Within that file many tests can be provided, one or more tests for each of tested class' methods.
Tests should check if documented contracts are intact, should check every of 'border criteria'.
Tests can also be written for software's use cases.
... for Java's automated testing tools, check, if You wish:
- JUnit 5,
- EasyMock.
See also: Software Development & Quality.
I am still learning, so much to consider & experiment with. I hope that as I understand more, ideas explored here will turn into science with great depth.
If you benefited from this blog, you can return favour by helping Lama Ole Nydahl or his friends. Here's list of our Buddhist Centers.
This blog is for buddhist woman I love, and for Lama Ole. Hopefully it will help them even after deaths & rebirths.
Showing posts with label Tests. Show all posts
Showing posts with label Tests. Show all posts
Saturday, 21 January 2023
Monday, 30 April 2018
Causal Automated Tests.
About.
Automated Unit & Integration tests / pl: zautomatyzowane testy jednostkowe i integracyjne / are not proofs, but these are practical as well - reducing bugfixing costs extremely significiantly at a very small price. There are more benefits to using Automated Tests, for example Mental Harness of Unit & Integration Tests enables one to proceed more boldly, faster, thinking on higher abstraction levels without worryig about minor bugs, relying on tests to handle that. These also can use Invariants.
In the 'Causal Programming Paradigm', each of state changes, as well as methods entrances, having control within, and control leaving can cause conditions appearance, existence, and disappearance event notifications. Methods' leave events contain return values, if applicable.
In the 'Causal Programming Paradigm', causes appearances and disappearances can cause event notifications.
How automated tests are perfomed in this paradigm, then?
1. Test registers for neccessary event notifications,
2. Test runs a method to be tested - which can contain one or many objects/methods.
3. Test gets report of the events raised and analyzes their types, order of appearance and state.
4. Test returns a value - either true or false, which says whether it was success or failure.
Links.
See also, if You wish:
- Invariants,
- Causes & Conditions,
- The 'Causal Programming Paradigm'.
Automated Unit & Integration tests / pl: zautomatyzowane testy jednostkowe i integracyjne / are not proofs, but these are practical as well - reducing bugfixing costs extremely significiantly at a very small price. There are more benefits to using Automated Tests, for example Mental Harness of Unit & Integration Tests enables one to proceed more boldly, faster, thinking on higher abstraction levels without worryig about minor bugs, relying on tests to handle that. These also can use Invariants.
In the 'Causal Programming Paradigm', each of state changes, as well as methods entrances, having control within, and control leaving can cause conditions appearance, existence, and disappearance event notifications. Methods' leave events contain return values, if applicable.
In the 'Causal Programming Paradigm', causes appearances and disappearances can cause event notifications.
How automated tests are perfomed in this paradigm, then?
1. Test registers for neccessary event notifications,
2. Test runs a method to be tested - which can contain one or many objects/methods.
3. Test gets report of the events raised and analyzes their types, order of appearance and state.
4. Test returns a value - either true or false, which says whether it was success or failure.
Links.
See also, if You wish:
- Invariants,
- Causes & Conditions,
- The 'Causal Programming Paradigm'.
Subscribe to:
Posts (Atom)