Commit Graph

48 Commits

Author SHA1 Message Date
Bernhard Beschow
ed6083b521 AutoTest: Improve type safety in TestParseResult
By having TestParseResults take ITestFramework rather than ITestBase as
parameter, some base->asFramework() casts can be avoided today which
could possibly fail in the future.

Moreover, it allows TestTreeItem to take ITestFramework rather than
ITestBase as parameter which improves type safety further. This shall be
done in a separate commit though.

Change-Id: I66594415d68c3423076a0830ecd11080d3b6c186
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-04 11:31:56 +00:00
Christian Stenger
73613d8549 AutoTest: Introduce ITestTool
Preparation for separating handling of code based and
build system based tests.

Task-number: QTCREATORBUG-23332
Change-Id: I490af5f3157fd4a8cd07d976cdfd9e4503ade97b
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-11-16 08:10:31 +00:00
Christian Stenger
239a59c596 AutoTest: Introduce ITestConfiguration
Preparation for an additional simpler test configuration
which needs to have the same common base.

Change-Id: I1800ed5d7301f1aea99eba6ef588a204697bd569
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-11-16 08:10:04 +00:00
Christian Stenger
55298cc211 AutoTest: Introduce ITestTreeItem
Preparation for having separated test tree items with a
common base.

Change-Id: I3735f582cc96910e971f5a41c799cc0729a10a58
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-11-16 08:09:46 +00:00
Christian Stenger
24db5dcc4f AutoTest: Use base of framework inside TestTreeItem
...and respectively inside the parse results which hold the
information that are used to create the items.

Change-Id: I78f7b5632df5d449d39fa03ffbf48036a138e337
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-11-09 08:23:00 +00:00
Eike Ziller
8b031c8c05 Merge remote-tracking branch 'origin/4.13' into master
Change-Id: I3f2a6c553819e992da7e9f538dc44b95b482359e
2020-10-02 10:47:07 +02:00
Christian Stenger
2fa08db858 AutoTest: Consolidate common functionality
While at it remove unused code path.

Change-Id: I15dff61131c5f3c9301cd733e1c8b92bd848f084
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-01 09:37:09 +00:00
Christian Stenger
af9d8768dc AutoTest: Fix marking for removal and sweeping of Quick Tests
If opening and editing a QML file we did no more mark tests of this
file as to be removed. In turn we may have got "new" items when e.g.
just modifying the name of a function or test case and but did not lose
the old one.
Broke with 90fd6870c5.

Change-Id: I86917089ffb9d4acb2f735f2f3e0f112d8cdc65a
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-09-29 10:18:47 +00:00
Christian Stenger
5f22126a79 AutoTest: Support gathering failed tests
Mark test tree items as failed for the last run
to be able to re-run them in an easier way.

Change-Id: I7ea3dcd16e5a02797d41f13e02b2fa95b857cf5e
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-09-16 06:53:54 +00:00
Christian Stenger
502ad9badb AutoTest: Correct completing test run configuration
Ensure all possible project parts are taken into account
when gathering build system targets.
When having multiple possible build system targets for a
test - which may easily happen e.g. when defining tests
beside the main application inside a big top-level
CMakeLists.txt - let the user decide which one to run.

Fixes: QTCREATORBUG-24268
Change-Id: Ia7b7e4148fe8e8dab55832c435f12cc78f5c2f7a
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-07-10 05:06:58 +00:00
hjk
90fd6870c5 AutoTest: Simplify QuickTestTreeItem::markForRemovalRecursively()
Change-Id: I3ab1876aa2d4dc04b9b5d53f373751e0f5241e75
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-04-22 05:27:26 +00:00
hjk
77c4caf4ea Autotest: Keep track of generating framework in TestTreeItem
... and TestConfiguration. This allows dropping code that
reconstruct framework ids and framework lookup by id.

Change-Id: I0bb1e6e135376e21f96b9fab7971aa097787e483
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-03-27 14:11:11 +00:00
hjk
d3f79fcc68 AutoTest: Use ITestFramework * instead of its id in some cases
Change-Id: Ic327e31185247b6479c78af8bf8156f44bb4bdfb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-03-16 12:18:29 +00:00
Eike Ziller
8452264a18 CppTools: Move QtVersion and BuildTargetType
QtVersion to utils/cpplanguage_details.h which already contains similar
flags.

BuildTargetType to ProjectExplorer, next to BuildTargetInfo (but not in the
same header to not pull that in everywhere).

Removes dependency on ProjectPart from RawProjectPart.

Change-Id: I5791065e4266f20c2657ee4b1b594df04b238a1c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-10 07:31:21 +00:00
Christian Stenger
e7040f1abf AutoTest: Fix warning about type mismatch
Change-Id: If4b0f2171eafc81330acb8a544201f0d05a9f6ae
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-23 09:19:02 +00:00
Christian Stenger
8cd7a11926 AutoTest: Fix handling of unnamed QuickTests
..now that the parser understands multiple TestCase items
inside a single qml file.
As long a test function is located inside a different TestCase
it is considered as a different one, so treat test functions
even of unnamed test cases correct.

Change-Id: I5cbfe1f63f896317523d51bbf67ea59169481a71
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-08-22 06:50:05 +00:00
Christian Stenger
c020fb6e3e AutoTest: Fix parsing of multiple test cases in single qml file
Quick tests allow definition of more than one TestCase inside a
qml file and even nesting is possible, so support this correctly.

Fixes: QTCREATORBUG-22761
Change-Id: I65fcc7cd6063d976d798c3e900d3299a12e2d73f
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-07-30 10:45:09 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
Christian Stenger
6189745a3b AutoTest: Adapt Type enum
Follow the official terms used by the test frameworks.
In detail this means Google test now uses TestSuite and TestCase
and the value for a normal function has been simplified to
TestFunction.
Beside the visual change there is no change in functionality.

Change-Id: Idf541d07fa3469e04a699d46f4625ff9075d5b6f
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-05-23 12:20:05 +00:00
Christian Stenger
efa7a5a4d4 AutoTest: Add suite layer for tests
Test suites are used in several test frameworks. To avoid
fiddling around with the types and their meaning on the
frameworks side just add another type (TestSuite) that can
be used.
Frameworks can use or ignore this type as it is done already
for other types.

Change-Id: I6c2a312a32ce5716f55b49303e2b1a0f6f8e8da4
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-05-16 07:41:38 +00:00
Eike Ziller
db9837fa6c Merge remote-tracking branch 'origin/4.7'
Conflicts:
	src/plugins/clangtools/clangtoolruncontrol.cpp
	src/plugins/cpptools/compileroptionsbuilder.cpp

Change-Id: Ib1e8abf066898b50c90fc1ccba4697fe983e8a8f
2018-08-15 13:53:28 +02:00
Christian Stenger
164d6ce7e0 AutoTest: Fix and unify handling of group nodes
QtTest had been forgotten to handle correctly as well. So, it
was possible to have several levels of grouping which had not
been handled correctly.
By (current) definition we handle only one level of grouping,
so prohibit more for QtTest tree items as well.
Basically move the check into a separate function and use this
beforehand instead of creating a nullptr.

Change-Id: Icbf02eae67e89464f371eb349eecf2976636d05f
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-08-07 11:01:51 +00:00
Christian Stenger
1d894c0f7a AutoTest: Code cosmetics
* use nullptr
* override
* remove old style casts
* fix most of the code model warnings

Change-Id: Ia08e846f9326ae28ca7e7d66748e25a8b817b9b1
Reviewed-by: Xing Xiong
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-07-20 08:34:48 +00:00
Christian Stenger
f80aa2c6f7 AutoTest: Fix handling of cpp files for Quick tests
Modifying C++ files of Quick tests had been ignored as they
normally have little impact.
But nevertheless this behavior is wrong and could lead to
unexpected behavior later on if no complete rescan had been
done and even with a rescan there could have been some
cached artifacts.
Fix this by tracking the paths of the C++ files that hold
the main() or the respective macro to be able to handle
changes of these files correctly as well.

Task-number: QTCREATORBUG-20746
Change-Id: Iec860aa63ffd167511efdbf63a6ffa369f094edf
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-07-11 13:18:04 +00:00
Sergey Morozov
57edd22d11 AutoTest: Add action to run all tests from current file
Run specific test functions since one test case can be implemented in multiple files.

Task-number: QTCREATORBUG-20329
Change-Id: I07f435c264f18e9608caa5b7ee20dff2d33ee9c0
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-05-15 14:41:53 +00:00
Christian Stenger
95446fb614 AutoTest: Use TypedTreeItem for test tree items
Change-Id: I739b6aefc868550b01c7421b4b304293564bb7b6
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-04-20 06:52:46 +00:00
Christian Stenger
96ccb95e6f AutoTest: Avoid unneeded duplication on rebuild
When the rebuild of the tree model has been triggered
due to switching between grouping by filter or directory
it could happen that some children did not get merged
into others due to (insignificant) differences.
Avoid this visual duplication by finding items similar
to the one to be added and if there is one re-use this
instead.

Change-Id: Ife49593638e0af23ffc7353e305be4ea25eb2180
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-04-16 07:47:36 +00:00
Christian Stenger
d9dfddac73 AutoTest: Simplify determination of RunConfiguration
Since bc698d4ce6 the build system targets / build keys are
unique on their own.
Simplify the completion of test configurations and improve
readability.

Change-Id: I258e8a35a4740dd58b1365498ca399258092e0e3
Reviewed-by: hjk <hjk@qt.io>
2018-04-13 12:04:45 +00:00
Christian Stenger
2945865516 AutoTest: Provide possibility to copy tree items
This allows to create a copy of an item. Basically it will
copy its member objects, but it does not copy its children.
Preparation for extending grouping support for GTest.

Change-Id: I75f92be53ff4191cacea2944b31641a9292d1e58
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-04-11 08:24:47 +00:00
Christian Stenger
30000c80af AutoTest: Ensure removal of empty items if possible
Change-Id: I2cac91e56e8f22f89f88bbc82cc5f7b526500529
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-01-26 11:43:24 +00:00
Christian Stenger
a5b82fe827 AutoTest: Fix running test cases with grouping
When gathering information for running tests we need to
take the grouping into account if enabled.
This patch amends 4eabcda3a1.

Task-number: QTCREATORBUG-17979
Change-Id: I27c17a5de8596c95f3b207530560d2a7c2cb5e99
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-01-25 14:11:07 +00:00
Christian Stenger
4eabcda3a1 AutoTest: Allow grouping of test cases
Grouping of test cases can now get enabled for each
registered framework.
For now grouping happens only folder based.

Task-number: QTCREATORBUG-17979
Change-Id: Ic0e5c0ecc76998a1aedea8aa0845f6d9b53fb179
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-01-15 13:21:44 +00:00
Christian Stenger
466fb7ea53 AutoTest: Fix running Quick Tests with special functions
If special functions (init, initTestCase, cleanup, cleanupTestCase)
are present for a Quick Test they must get ignored when trying to
run a single test as they cannot get explicitly addressed.

Task-number: QTCREATORBUG-19311
Change-Id: Ie91928271928cf581bfef0b5e3463e027af985fd
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-11-20 14:45:10 +00:00
Christian Stenger
faee18d31e AutoTest: Enable debugging for Quick Tests
Task-number: QTCREATORBUG-18961
Change-Id: I6f00c84ea6279ceb59745e5bb12349511ae4637b
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-10-09 12:46:33 +00:00
Christian Stenger
e255baaa8f CppTools: Add target type information to project part
Let project managers store information whether a project part
belongs to an executable or a library and use this information
inside the AutoTest plugin.
This information will help to determine which targets are
relevant for the execution of tests.

Change-Id: I93b42797bf55225425398dc83aecea3c99eea290
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-18 10:01:30 +00:00
Christian Stenger
58aef63959 AutoTest: Fix handling of running selected Quick Tests
Unnamed Quick Tests cannot get explicitly selected.
They also should not get executed implicitly if we try
to execute a named Quick Test of the same project, but
only if "Run All" is triggered.

Task-number: QTCREATORBUG-18501
Change-Id: I5cddbca5bffd2d5f82e121e0455226e4b388a293
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-08-08 04:55:16 +00:00
Christian Stenger
27cb331b4b AutoTest: Avoid guessing run configuration
Base the selection of the run configuration on the executable
we have gotten already from the BuildTargetInfo and take
deployment information into account.

This also reverts cce1e130 partially and avoids
stuffing unrelated information into the buildsystemtarget.

Change-Id: I3de6e910a5fd1092d428ec4afc33c4ca62daaa25
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-07-31 06:11:35 +00:00
Christian Stenger
ba1a657227 AutoTest: Make test tree root items checkable
This allows (de)selecting of all test cases of a specific test
framework.

Change-Id: I21357d3dbcfce73387f157b1b40686f437fa260b
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-06-29 10:20:13 +00:00
Orgad Shaneh
687466ac47 Merge remote-tracking branch 'origin/4.3'
Change-Id: I126f3a05212a3d5df78812e66285bc9e8078360b
2017-06-20 11:32:02 +03:00
Christian Stenger
cce1e130d7 AutoTest: Fix handling of multiple build targets
If project files are not mapped 1:1 to targets the result
of the chosen executable was more or less random.
Try to handle multiple targets as correct as possible by
checking for build targets already where we still know
which files are part of the respective test cases.

Task-number: QTCREATORBUG-17783
Task-number: QTCREATORBUG-18357
Change-Id: I82dcc26bf52c9918e2727b439a719af08879ef49
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-06-19 08:14:55 +00:00
Christian Stenger
a9d511ff7d AutoTest: Unify TestTreeItem::modify*() functions
Change-Id: Ia234fb6a8a8466c039060f6f00b1a5e3dea2af9e
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-06-02 10:14:28 +00:00
Christian Stenger
74fb4bb014 AutoTest: Use better names and remove unused code
Change-Id: Ifb7f252e7c3fd020537eb46c62d8f5700b8a55ef
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-02-24 09:36:28 +00:00
Christian Stenger
23398229e9 AutoTest: Modernize code
* remove unnecessary QLatin1String where possible
* foreach
* nullptr
* bad naming of static members

Change-Id: If0f7c6839be4d2efbfef6f7f0775d2034775bd90
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-02-17 08:01:36 +00:00
Christian Stenger
40174187cb AutoTest: Remove unnecessary indirection when creating test tree items
Change-Id: Id4648196011b6769a2cd51b4daee146068272f00
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-12 05:50:32 +00:00
Eike Ziller
5b47c653c1 Merge remote-tracking branch 'origin/4.1' into 4.2
Change-Id: Ibe4cd5522e1d87d56d2aae7a429282b41bf18647
2016-10-12 16:02:47 +02:00
Christian Stenger
01db726870 AutoTest: Fix running selected quick test functions
Task-number: QTCREATORBUG-17093
Change-Id: Ia404efe5779eaf5e735410db83840d9b9f58f5bd
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-10-10 10:58:34 +00:00
Christian Stenger
b0bf07c64a AutoTest: Modernize code a bit
Change-Id: Ie56f6e5cb8a4f1962bd8df5e57214911ae609921
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-09-29 12:27:14 +00:00
Christian Stenger
2f8b4b3fbf AutoTest: Move test framework related code...
...into files and respective sub folders.

Change-Id: Ic80d693bd73993a6e74b6d422349e47276e8cb6e
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-06-01 11:37:32 +00:00