I want to know the comand line in maven to run unit tests for Apache Camel.
Any help please?
Regard
You can use normal maven test commands like mvn clean test
if you have to run specific unit test then you have to use
mvn -Dtest=TestClass#testMethod test
where TestClass is junit test class and testMethod is actual method to run .
More about camel testing can be accessed here..
http://camel.apache.org/spring-testing.html
Related
I'm running parallel unittesting using Django 's manage.py test command.
The issue is that this command only recognized the unittest-way test method - for those that has the pytest-way eg no test class and have fixture param, manage.py test will skip them.
So my question is how to get manage.py test collect the pytest-way test methods?
p.s.
The reason I go for Django unittest manage.py test is because of its --parallel feature ie it can handle beautifully test database creation for each parallel thread the test running in.
I'm a hobby web developer looking to build my first product with the django web framework which I will host on Heroku. Cypress looks like a great modern tool for UI testing which I certainly want to use. In local development I am using it within django testing so that the django staticliveservertestcase runs first - which creates a separate development server process, and a test database, if one hasn't been created already. Within this test I then call a bash script which executes a cypress UI test. See the example below.
Bash Script -
#!/bin/bash
echo $1 # the 1st command line argument
echo $2 # the 2nd command line argument
./node_modules/.bin/cypress run --env baseUrl=$1 --spec $2
Django Test Code -
class ExampleTest(StaticLiveServerTestCase):
def test_view_url(self):
from subprocess import run
exit_code = run([
'./cypress/run.sh',
f'http://{self.server_thread.host}:{self.server_thread.port}',
'cypress/integration/sample_spec.js'
])
self.assertEqual(0, exit_code.returncode)
From my understanding this is the opposite to the standard cypress approach. Normally cypress runs outside of the app independently and simply runs through all the tests which interact with the app. Here the cypress tests are called by the django process. Unless I am mistaken there are obvious advantages to this approach. I can test the UI and whether objects where created in the database after the UI test has run.
Is it possible, and if this how, to do this within Heroku? So Heroku would simply call the test script -
python manage.py test
And I get UI testing and unit testing all done in one go. It would also be nice to see the tests running in interactive mode. Which may be a challenge because Heroku obviously runs everything in a linux container - I don't plan on using Docker incidentally because I think that limits a lot of the features Heroku offers.
I have Ember.js 2.16 acceptance tests written using the Ember template test libraries (QUnit and testem) that test the general functionality of an Ember app. When I run ember test, the 'environment' for which environment variables are retrieved is always set to test.
Is there a way to run ember test with any environment other than test? Running it with --environment="my_other_test_env" doesn't change the environment as it would for ember build or ember serve.
I’d like to be able to pass parameters to acceptance tests depending on what environment they are running in. Is this behavior supported, and if not, is there a reason I shouldn't be doing this? I understand that for lower-level unit testing, I shouldn't be dealing with external dependencies, but for end-to-end acceptance testing, it seems normal that there would be different environments I would want to run the tests in.
You could use your own environment variable:
Run with TEST_ENV=...
$ TEST_ENV=special ember test
Add it to your app configuration:
// config/environment.js
if (environment === 'test') {
ENV.testingEnvironment = process.env.TEST_ENV;
...
}
And use it in your acceptance test like:
import ENV from '../../config/environment';
alert(ENV.testingEnvironment); // outputs 'special'
I'm using similar way to deploy a production build to a staging environment, but only changing some api endpoints in the configuration.
In Django 2.0, I have following project structure, which I can't change, no matter what:
grocery_store_website
manage.py
grocery_store # contains wsgi, settings,etc.
app1
app1
non-app-utils
__init__.py
helpers.py
serializers.py
model_mixins.py
tests
test_helpers.py # I want test runner to run these.
It turned out, I need to write unit tests for non-app-utils. Mentioned directory is not a registered Django App and never will be. These tests must be located in tests directory, located in non-app-utils. How can I make Django's test runner to discover and run also tests from non-app-utils directory?
If I run Django tests with directly specified path ./manage.py test utils.tests.test_helpers, it works. However ./manage.py test does not. Any ideas how to go on?
Jerin Peter George suggested adding __init__.py file into non-app-utils directory. However, problem was, there is __init__.py file missing in non-app-utils/tests directory!
After I add those and run ./manage.py test, Django's test runner found my tests and ran them as I needed to!
I'm using django_nose for test django apps,
simply run python manage.py test
But, I wanna do a setup before any tests.
For example, create a file before test start. and then all the tests will using this file.
How to do this?
please help
As mentioned in nose docs, Test modules offer module-level setup and teardown; define the method setup, setup_module, setUp or setUpModule for setup. for e.g. setup_module() function: runs before anything else in the file