Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95543

Re: Parametrized Unit Tests

Path csiph.com!news.mixmin.net!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!217.188.199.168.MISMATCH!takemy.news.telefonica.de!telefonica.de!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'run- time': 0.05; 'test,': 0.05; 'testing,': 0.05; 'acceptance': 0.07; 'tests,': 0.07; 'behave': 0.09; 'definition,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python.': 0.11; 'server,': 0.15; '8bit%:26': 0.16; '8bit%:32': 0.16; 'combinations': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'tests.': 0.18; 'tests': 0.18; 'library': 0.20; "aren't": 0.22; 'pass': 0.22; 'passing': 0.23; 'discussion': 0.24; 'feature': 0.24; 'testing': 0.25; 'header :User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'parameters': 0.27; 'then.': 0.27; 'host': 0.28; 'function': 0.28; 'once.': 0.29; 'code': 0.30; 'call.': 0.30; 'e.g.': 0.30; 'another': 0.32; 'url:python': 0.33; 'usually': 0.33; 'instances': 0.33; 'url:listinfo': 0.34; 'running': 0.34; 'something': 0.35; 'supports': 0.35; 'unit': 0.35; 'there': 0.36; 'url:org': 0.36; 'framework': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'integration': 0.38; 'goes': 0.39; 'test': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'some': 0.40; 'more': 0.63; 'different': 0.63; 'developed': 0.66; 'url:lists': 0.66; 'skip:\xe2 10': 0.70; 'sounds': 0.76; '_o__)': 0.84; 'exercised': 0.84; 'mistakes,': 0.84; 'received:125': 0.84; 'mistakes': 0.95
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben+python@benfinney.id.au>
Subject Re: Parametrized Unit Tests
Date Sat, 22 Aug 2015 11:42:50 +1000
References <f2d05b33-8755-4270-9bf4-b0b6153d13f7@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Cancel-Lock sha1:ZUSV0IYAH0p+bD8eEfyCQ0O4bLc=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9.1440207786.17298.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1440207786 news.xs4all.nl 23790 [2001:888:2000:d::a6]:53267
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:95543

Show key headers only | View raw


rambius <rambiusparkisanius@gmail.com> writes:

> I am running one and the same unit tests that test some web
> application. I would like to execute them against different servers
> that may host different instances of the application.

Those aren't unit tests, then. A unit test, by definition, tests a small
unit of code; usually one true-or-false assertion about one function
call.

What you describe sounds more like integration tests or feature tests or
acceptance tests; something where large parts of the code base are all
exercised at once.

> Is there a better a way to pass the server, the user and the password
> to the test without resolving to global variables?

The ‘testscenarios’ library is one way to have a set of scenarios
applied at run-time to produce tests across all combinations
<URL:https://pypi.python.org/pypi/testscenarios/>.

> Although I developed these tests as unit tests they are more of
> integration tests. Is there an integration testing framework that
> supports a more convenient passing of test parameters / data?

You may want to look at behaviour-driven testing, e.g. using Behave
<URL:https://pypi.python.org/pypi/behave/>.

Another resource to use is the ‘testing-in-python’ forum
<URL:http://lists.idyll.org/listinfo/testing-in-python> where there is
more focussed discussion on testing in Python.

-- 
 \       “Repetition leads to boredom, boredom to horrifying mistakes, |
  `\       horrifying mistakes to God-I-wish-I-was-still-bored, and it |
_o__)              goes downhill from there.” —Will Larson, 2008-11-04 |
Ben Finney

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Parametrized Unit Tests rambius <rambiusparkisanius@gmail.com> - 2015-08-21 08:17 -0700
  Re: Parametrized Unit Tests Laura Creighton <lac@openend.se> - 2015-08-21 17:42 +0200
  Re: Parametrized Unit Tests Ben Finney <ben+python@benfinney.id.au> - 2015-08-22 11:42 +1000
    Re: Parametrized Unit Tests rambius <rambiusparkisanius@gmail.com> - 2015-08-27 07:38 -0700
      Re: Parametrized Unit Tests Ben Finney <ben+python@benfinney.id.au> - 2015-08-28 09:46 +1000
        OFF-TOPIC Ben's sig monster quote [was Re: Parametrized Unit Tests] Steven D'Aprano <steve@pearwood.info> - 2015-08-28 16:26 +1000
          Re: OFF-TOPIC Ben's sig monster quote [was Re: Parametrized Unit Tests] Martin Skjöldebrand <martin@skjoldebrand.eu> - 2015-08-28 09:19 +0200
          Re: OFF-TOPIC Ben's sig monster quote [was Re: Parametrized Unit Tests] Ben Finney <ben+python@benfinney.id.au> - 2015-08-28 17:27 +1000
            Re: OFF-TOPIC Ben's sig monster quote [was Re: Parametrized Unit Tests] Marko Rauhamaa <marko@pacujo.net> - 2015-08-28 12:24 +0300
              Re: OFF-TOPIC Ben's sig monster quote [was Re: Parametrized Unit Tests] jmp <jeanmichel@sequans.com> - 2015-08-28 11:47 +0200
          Re: OFF-TOPIC Ben's sig monster quote [was Re: Parametrized Unit Tests] Steven D'Aprano <steve@pearwood.info> - 2015-08-29 00:02 +1000
            Re: OFF-TOPIC Ben's sig monster quote [was Re: Parametrized Unit Tests] Chris Angelico <rosuav@gmail.com> - 2015-08-29 01:07 +1000
          Re: OFF-TOPIC Ben's sig monster quote [was Re: Parametrized Unit Tests] Michael Torrie <torriem@gmail.com> - 2015-08-28 14:00 -0600
          Re: OFF-TOPIC Ben's sig monster quote [was Re: Parametrized Unit Tests] Rustom Mody <rustompmody@gmail.com> - 2015-08-29 21:34 -0700

csiph-web