Python Code Testing

Kent Back’s original article on testing. 

Simple Smalltalk Testing: With Patterns
by Kent Beck (1997)

Ken Beck one of the developers of the xUNIT testing we all use today, set the standards for testing some 20 years ago. In this article, he outlined was what needed to test software. He tells us we need unit testing by the original developer to test the inside of the code. He discussed the common test fixture. Rather than have many ways of executing tests, fit all the tests into a common framework. He urged us to aggregate out tests into test suites. That test cases are stimulus, response entities. He introduced  unit tests and integration testing. 

He told us testing has to be selective you can’t possibly test everything. Rather than a vague idea about what to test, pick one area to test well and then build upon it as you get to know the software better. Start with a test environment and then subclass tests under it. Tests should run independently so you get better coverage. It takes longer but you are not concerned about testing performance.  

You need to test to get the right answer but you also need to test for invalid subscripts or array out of bounds. 

He tells us to run tests and throw away the temporary test data once the results are found. He mentioned test suites should be able to call other test suites so that test engineers can collaborate. 

He mentioned recording timestamps before and after tests. He wants us to collect run times so you can collect performance statistics over time. He suggests intentionally adding errors to see how the software handles errors. 

These principles suggested in 1997 are just as true now as they were then.

 

“https://web.archive.org/web/20150315073817/http://www.xprogramming.com/testfram.htm”

 

 

Robot *
“https://robotframework.org/”

Robot Framework is an open source testing solution. It is used for test automation and robotic process automation RPA.

It lives on github
“https://github.com/robotframework/robotframework”

https://robotframework.org/”

It’s split up into Test case, Report and Log, Keywords, Library, Template. Gherkins and Task(RPA)

 

 

PyTest *****

Mature test framework with lots of features. Supports testing with Exception testing objects. 

Unittest ***

test fixture, test case, test suite and test runner

 

Doctest

doctest is a module included in the Python programming language’s standard library that allows the easy generation of tests based on output from the standard Python interpreter shell, cut and pasted into docstrings.

Nose2

Based on unittest, they even mention in the documentation you may be better off with pytest. Nose2 ‘s purpose is to extend pytest.

Testify

“github.com/stretchr/testify

Supports go, the language

Testify – Thou Shalt Write Tests

Install with “go”
go get github.com/stretchr/testify

Behave

Behavior-driven development (or BDD) is an agile software development technique that encourages collaboration between developers, QA and non-technical or business participants in a software project. We have a page further describing this philosophy.

A pip install 

Lettuce

PyUnit

Gauge

Jasmine

Splinter 

works with selenium headless

Locust

load testing

RedwoodHQ

Java, Python, C# Tool Selenium

Python C# Java

load testing

Junit

The original release of JUnit was in August 2000. The current release is 5.7.1 released on  February 2021. Kent Beck and Eric Gamma invented a way of Testing Java starting with the first release in late 2000. Starting with this pioneering effort, JUnit concepts have been copied to other testing frameworks to test projects programmed in several other  languages.

Selenium 

Simulates user access to a typical website from any of the common browsers

Selenium needs the underlying browser driver for each kind of browser

Browser testing Chrome, Safari, Internet Explorer/Edge, Firefox

Most Operating System

Java, Python, Ruby, C#

Cucumber

Based on Gherkin. A plain text language to define a test or tests

Given, And, When, Then