Execute code Before and After each Thread with Specflow in Specflow+ runner and SharedAppDomain thread isolation - specflow

Is there any way to execute code before and after each specific thread when executing tests in parallel with SharedAppDomain thread isolation in Specflow?
I was using BeforeTestRun/AfterTestRun Hooks for this purpose, but it seems that since last Specflow versions this is only possible when running tests "AppDomain" thread isolation, and in SharedAppDomain isolation it runs only once per test.

If you are running your tests in parallel, each thread will represent a running scenario. To run something after each scenario you can use the AfterScenario hook.
BeforeTestRun/AfterTestRun are for the entire test run where multiple threads may be running. They are designed to run once for all threads but I have found AfterTestRun to be patchy. Sometimes it appears unable to determine that the last running thread has finished before entering AfterTestRun.

Related

Prevent parallelization of jobs in Jenkins

I am faced with the task of automating the build and test process for 4 software products in Jenkins. As many steps as possible should run in parallel.
The build of all four products can run in parallel. However, the test can only be parallelized by products 3 and 4. The test process of 1 and 2 must be sequential.
How would you basically design the automation in Jenkins?
If I create 4 separate pipelines, it needs to be ensured that the test process of 1 and 2 does not run in parallel.
Is it easier to create a single pipeline and prevent parallelization of 1 and 2 using job dependencies?
A quick solution off the top of my head would be something like this:
Run all the build jobs in one stage and have all of them inside a parallel block.
Then you create a new stage that runs after all the build stages have completed. This stage will also have a parallel block. Tests 3 and 4 will run in parallel while 1 and 2 run sequentially.

Jenkins jobs to run concurrently with conditions

I have a Jenkins job and does something(by calling a Ansible playbook) on a environment(a user selected parameter). I want to setup the job to run in conditional concurrent mode, like the jobs can run concurrently only for different environments.
I saw there was a same question:
Jenkins - Stop concurrent job with same parameter
posted 6 years ago and I did what the recommendation said, but when I tried with the plugins, I do not see the:
Builder: Set the build result
Result: Aborted
for the first Conditional step (single) in the answer.
So something have changed since then? Are there any new solutions for my case?
Thanks!

Gracefully stop a jenkins job

I use jenkins for my countinuous integration testing + possibility of starting manual checks.
My utilization is a job that :
Poll mercurial repo every 10 mn
Once a commit is done, start a generation (clone + make)
Launch a python suite test script
Gather result
Sometimes I want to be able to gracefully stop a job without using the "stop" button that simply aborts the test.
I managed to do it using a trick that check the presence of a file in the log directory used by the Python test suite
But I'm looking for a way to do it inside jenkins job itself.
Is there a way to have a customizable button for that purpose ?
I tried "batch task" plugin that would have been perfect BUT it waits for the python script to complete before execution ... So useless in my case (but the code works)
Thanks in advance for your help

detox jest tests are not running in parallel

Detox Automation with Jest
Hi, I am running detox tests form the CLI with the below command.
detox test -r --maxWorkers 2 to achieve parallel execution.
Already one simulator started with name iphone 5s-Detox and with the maxWorkers 2 or --workers 2, one more simulator is launching but the tests are executing in only one simulator. I want to execute tests in parallel to save the execution time.
Can anyone share concept of detox jest parallel execution. Is this same as testNG or it's different.
in Detox simulator tests are running fine, but new worker got app installed and freezes with out any action
not sure what is the use of this device.registry.state ???
Unable to understand the locking mechanism, as mentioned
https://github.com/wix/Detox/blob/master/docs/Guide.ParallelTestExecution.md
Can any one help on this to understand better jets parallel execution.

Force gulp task to completion via command line

I have a gulp task that runs a couple other tasks. One of the tasks is to run karma. A couple of the tests are failing, which causes the gulp to fail. Is there a way to force a gulp task to completion via the command line, or a way to manipulate the return code?
I am writing a Jenkins job for another project that I don't own, so I am not responsible for the failing tests. That said, I don't have commit privs to the SVN repo that their code is stored on. Yes, it would be easiest to just change the gulpfile, but I'd rather not write a script in the Jenkins job to append a new task. Although, that might be the only option.
I do not know of a 'gulp-native' way to do this. A very similar scenario to what you laid out is discussed in this gulpjs/gulp issue - Continue gulp on error? #75.
The ultimate resolution was to use gulp-plumber

Resources