M
M
missial2014-10-04 11:15:19
Python
missial, 2014-10-04 11:15:19

How to run python tests in TeamCity?

Now we use our own auto-testing system, which downloads the project, builds it and runs tests in Python. I recently got acquainted with TeamCity and realized that this system is much better than our autotest system and I plan to switch to it.
I figured out how to download and build the project. It remains to transfer the tests to TeamCity. What I want to know:
1) How to set up TeamCity to run tests after build. Tests have a separate branch where they are stored. It is necessary to automatically add new tests from the repository to TeamCity.
2) Dependence of tests from each other is necessary. For example, if a test that checks the functionality of some main module fails, then other tests that use this module in tests should not be run.
3) It should be possible to recheck (restart) the test
Well, the question, which does not quite correspond to the title of the topic. I'll try to describe in more detail. Is it possible to create a separate branch in TeamCity for testing? That is, the developer changes the functionality in the project, at the moment he is not interested in all the tests, but only in tests that check exactly the functionality that he changes. He is not interested in other tests. Can he create some separate "branch" for himself, add the necessary tests there, see the results after the commit, and then delete it? I want to implement this functionality in TeamCity, because there are a lot of tests, but I don’t want to wait until the right test passes.
I will be grateful for the answers!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alinam, 2014-10-16
@missial

Good afternoon!
Let's say you have build configuration A that builds the project and publishes the build results - artifacts.
1. a. You need to create build configuration B for tests. Attach VCS root to this build configuration and configure it so that it “listens” to the required branch (how to configure this depends on the VCS used, for Git see Feature Branches ).
b. Set up B's dependency on A. There are two types of dependencies: Artifact and Snapshot Dependecny.
Artifact - provides transfer of artifacts from Bleed configuration A to B, Snapshot Dependency- ensures the use of the same source revision (if the repositories are different, then the revision at the corresponding point in time is taken). A detailed description can be found here .
It is recommended to configure Artifact (with Build from the same chain option )+Snapshot dependency.
c. Set up VCS trigger . It strat builds when TeamCity detects changes in VCS root. This trigger needs to be configured for configuration B, with the option Trigger a build on changes in snapshot dependencies. At the same time, if you commit the code in A, then the trigger will work and add build A to the queue first, and then build B.
d. To transfer test results to TeamCity, use the .
2. The order and logic of calling tests must be implemented in the build script, and not using TeamCity.
3. At the moment there is no way to restart a separate test. There is a request to add this functionality.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question