GoogleTest - Read log while test is running - googletest

Im trying to write a test in GoogleTest that will execute some code, and it will pass or not depending on the output logs caused by that code.
For that, I would like to have access to the test log, but I have not found how to do it.
While the test is running, this Testing/Temporary/LastTest.log.tmp file exists but it only contains the start date:
Start testing: Oct 01 13:10 CEST
----------------------------------------------------------
So it seems the logs are not written there until the test ends, and Testing/Temporary/LastTest.log is created.
Is there a way to read the test logs before the test ends?

Related

Quit out of test file on failure, but not entire test suite

First of all, my terminology may be incorrect with some of these terms as I am very new to jest so if that is the case I would love to be corrected to help me learn.
In case I am using the jest terminology incorrectly, here is what I mean:
Test Suite - The entire group of test files I am attempting to run
Test File - The actual .js test file that is being run
Test - The individual 'it' code blocks in each test file.
Currently, I am using a group of around 20 jest tests to test my API EPs for my SQL Server and its corresponding linked server.
To do this, I run an npm command like so in the terminal.
npm run test:file ape/linked -- --env=monke.env
With how jest currently is working, if one of tests in the 20 test files fails, then it quits out of the test suite entirely.
I would like it to just fail out of whatever test file it is in, then continue to the next text file.
I know jest currently has the --bail flag, but enabling this continues the same test file on failure which I can't have happen due to the nature of my linked server to my actual SQL server.
Any help would be greatly appreciated and I am new to all of this so let me know if more info needs to be included.
This will be running on various mac versions as well as Ubunutu server

TestCafe Studio - How to debug test failure when .testcafe file is executed?

I'm using TestCafe Studio to create my tests and executing the tests written in .testcafe format using the testcafe docker container. Further I'm using 'Drone' as CI environment.
Below is the command that I use to execute my tests
`- /opt/testcafe/docker/testcafe-docker.sh -c 3 chromium -q --skip-js-errors --ass`ertion-timeout 60000 --selector-timeout 60000 CommonScenarios/*.testcafe
When a test failure occur I will not get enough information about the test failure. For example below is an error log printed.
1) AssertionError: expected false to be truthy
Browser: Chrome 91.0.4472.124 / Linux 0.0
7
Is there any way that I can get enough details about which step is actually failing when the tests are executed in .testcafe format?
(When I ran .js format of the test it gives which line is failing)
This looks like a bug in TestCafe Framework. I opened an issue in the GitHub repository: https://github.com/DevExpress/testcafe/issues/6424. Subscribe it to be notified of updates.
As a simple solution, you can convert your *.testcafe fixture file to *.js. Also, there is a more complex workaround - it allows you to determine which step is failing:
Open the *.testcafe file in VS Code or some other editor. You will see that it looks like a JSON file.
Find an object with the "name" property whose value corresponds to your test name: "name": "Your-failed-test-name"
Look at the "commands" array. Find an object with the "callsite" property whose value is equal to the number that you can see in the error console output. This object specifies the failed step.
Note that the format of this file is intended for internal use, and it is not recommend to modify it manually.

How can I redirect the output of the CMake "execute_process" command to STDOUT in real-time?

I am working on a project that needs to execute a system process from a CMake script that may take a while to run. The problem is the entire time the process is running I get no feedback about whether it is succeeding or not. Since the process may take a few minutes to run it may appear as though it froze even though it is still silently working.
At the end of the process I can get the output in a CMake variable and print all of the things that happened during that time:
execute_process(COMMAND some system command
OUTPUT_VARIABLE command_output
)
# ... nothing happens for a few minutes while the process executes
# All of the output from the past few minutes is printed all at once.
message(STATUS ${command_output})
It would be much nicer if I could just redirect the process output directly to STDOUT so I could see output of the process while it is executing... Is there any way to do this?

jest, logging success or failure between each test while the tests are running

seems like something quite basic but it dosen't seem to be available in jest automatically.
when i run my jest tests, during the test run i get the logging info from the code itself while the tests are run.
and only after the tests are finished i receive a summary of the spec results(which tests passed and which didn't).
what i'm trying to achieve is to have extra lines in my console, that fill while the tests are running, that tell which test we have just finished, and what was the result.. this will make log debugging so much simpler..
thanks!

How can i write test Suite for Multiple Cest or Cept files...?

Well I'm new to Codeception, code will be executed in single file correctly but how am supposed to execute all files in a single test suite for Cest or Cept format php files.
To execute all Cept and Cest files in test suite (e.g. defined in yourSuite.suite.yml) run
codecept run yourSuite
To execute particular Cept/Cest file run
codecept run path/to/your/testCept.php
To execute particular test of Cest class (public method of Cest class, e.g. TryToTest()) run
codecept run path/ti/yout/testCest.php:tryToTest
Simply run it
php codecept.phar run suite
e.g. php codecept.phar run unit