Questions tagged [webtest]

WebTest helps you test your WSGI-based web applications, which includes most actively developed Python web frameworks.

WebTest helps you test your WSGI-based web applications. This can be any application that has a WSGI interface, including an application written in a framework that supports WSGI (which includes most actively developed Python web frameworks – almost anything that even nominally supports WSGI should be testable).

With this you can test your web applications without starting an HTTP server, and without poking into the web framework shortcutting pieces of your application that need to be tested. The tests WebTest runs are entirely equivalent to how a WSGI HTTP server would call an application. By testing the full stack of your application, the WebTest testing model is sometimes called a functional test, integration test, or acceptance test (though the latter two are not particularly good descriptions). This is in contrast to a unit test which tests a particular piece of functionality in your application. While complex programming tasks are often is suited to unit tests, template logic and simple web programming is often best done with functional tests; and regardless of the presence of unit tests, no testing strategy is complete without high-level tests to ensure the entire programming system works together.

WebTest helps you create tests by providing a convenient interface to run WSGI applications and verify the output.

To find out more, visit http://webtest.pythonpaste.org/en/latest/

270 questions
26
votes
1 answer

Run Python/Django Management Command from a UnitTest/WebTest

We have a bunch of commands in our Django site, some that are administrative and some that run on cron jobs that I can't figure out how to test. They pretty much look like this: # Saved in file /app/management/commands/some_command.py # Usage:…
scoopseven
  • 1,767
  • 3
  • 18
  • 27
22
votes
2 answers

Finding the real error in a Webtest test failure

I'm using Python and Webtest to test a WSGI application. I found that exceptions raised in the handler code tend to be swallowed by Webtest, which then raises a generic: AppError: Bad response: 500 Internal Server Error How do I tell it to raise…
Sudhir Jonathan
  • 16,998
  • 13
  • 66
  • 90
16
votes
2 answers

Testing oAuth / facebook authentication with WebTestCase in Symfony2

I'm trying to get a FacebookLoginTest running. Problem is: the Symfony2 client does not send real HTTP requests, so it does not work on URLs of other services (like facebook). I know I could work with cUrl,... but I see so many obstacles there:…
stoefln
  • 14,498
  • 18
  • 79
  • 138
13
votes
1 answer

How to run Jest-Puppeteer test in multiple files

I am using jest-puppeteer to run my webtests. If I am running my tests all defined in one file, everything works perfectly. describe('user', () => { jest.setTimeout(12000); beforeEach(async () => { await page.setViewport({width:…
Stefan
  • 1,590
  • 3
  • 18
  • 33
13
votes
3 answers

Disabling @login_required while unit-testing flask with flask-login

I am unit testing my flask app which uses the flask-login extension. I am setting up all my tests like this using webtest: class TestCase(unittest.TestCase): def setUp(self): app.config['TESTING'] = True self.client =…
efeder
  • 552
  • 5
  • 16
11
votes
3 answers

Symfony / Doctrine UnitTests with SQLite memory DB

I'm still working on PHP unit tests for testing my symfony2 controllers. My test classes are derivations of WebTestCase and the tests are doing GET or POST requests do check if everything works fine. I want to test all underlying layers, but I don't…
Hennes
  • 1,340
  • 1
  • 10
  • 26
10
votes
3 answers

Visual Studio 2015 Web Test with Data from Oracle Database

I'm writing a webtest in Visual Studio 2015. The webtest I currently have allows me to run a static test. I would like to spice things up and therefore add more realistic data. The data I want to use is stored in an Oracle Database 12c. So I'm…
Donny
  • 549
  • 2
  • 10
  • 24
10
votes
6 answers

How can I Fail a WebTest?

I'm using Microsoft WebTest and want to be able to do something similar to NUnit's Assert.Fail(). The best i have come up with is to throw new webTestException() but this shows in the test results as an Error rather than a Failure. Other than…
craigb
  • 16,827
  • 7
  • 51
  • 62
10
votes
6 answers

Generate .webtest files without using Visual Studio

We have business users that we'd like to get involved writing webtests for our project, but purchasing full Visual Studio licenses just for this purpose seems like overkill. Are there any open source or third-party tools that can be used to produce…
The Matt
  • 6,618
  • 7
  • 44
  • 61
9
votes
4 answers

How to pass JSON in POST method with PhpUnit Testing?

I am using symfony 3.0 with phpUnit framework 3.7.18 Unit Test file. abcControllerTest.php namespace AbcBundle\Tests\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use…
Ashish Kumar Saxena
  • 4,400
  • 8
  • 27
  • 48
8
votes
4 answers

Is there a headless browser for .NET (for automated Web-UI-Tests)?

Is there a headless browser for .NET? I am looking for this in a testing context. Coming from Java I am thinking of something similar to HtmlUnit (http://htmlunit.sourceforge.net/) which itself is the base for different higher level tools like Canoo…
jbandi
  • 17,499
  • 9
  • 69
  • 81
7
votes
3 answers

Concourse CI - how to run functional tests?

we are in the middle of process migrating from Jenkins to Concourse CI and everything was pretty smooth so far. But now I have the issue, that I don't know how to solve. I would like to get any advices from the community. What I am trying to do is a…
7
votes
0 answers

SharePoint editing for Web test, change pages properties using Visual Studio Test Suite

I'm using Visual Studio 2008 (SP1) to create a web test that will allow me to edit a page using EditForm.aspx. I am trying it using fiddler and the recorder. I have managed to get some tests to run, but they do not change the properties. Does…
Nat
  • 14,175
  • 5
  • 41
  • 64
7
votes
2 answers

Are unittest base classes good practice? (python/webapp2)

I'm rather new to unit-testing and am trying to feel out the best practices for the thing. I've seen several questions on here relating to unit-test inheriting a base class that itself contains several tests, for example: class…
Quentin Donnellan
  • 2,687
  • 1
  • 18
  • 24
6
votes
3 answers

Disabling ExpectedResponseUrl for single request in web test

I'm recording a web test using Visual Studio 2010. For each request, the expected response url is recorded, and a validation rule on the test ensure that these response are correct. The test is using random data. For a particular request, in certain…
Johnny5
  • 6,664
  • 3
  • 45
  • 78
1
2 3
17 18