#StackBounty: #magento2 #varnish #testing #magento2marketplace #class-not-found Magento 2 : Installation & Varnish Test Results Fai…

Bounty: 100

We have created the custom module and uploaded to Magento Marketplace and Installation & Varnish Test has been failed due to class does not exist.

If the class not exists, How the Code Sniffer passed?

enter image description here
But the class is exists. Don’t know why extension is failed.

enter image description here

We have a custom interface ConnectorCustomerRepositoryInterface, The Testing says the class does not exist.

The classes are below:

<?php
namespace ABCSolutionsConnector365ApiCustomer

interface ConnectorCustomerRepositoryInterface{
..
}

and the extended Class

<?php
namespace ABCSolutionsConnector365ModelResourceModel;

class CustomerRepository implements ABCSolutionsConnector365ApiCustomerConnectorCustomerRepositoryInterface{
...
}

And the di.xml

<preference for="ABCSolutionsConnector365ApiCustomerConnectorCustomerRepositoryInterface" type="ABCSolutionsConnector365ModelResourceModelCustomerRepository"/>

And webapi.xml file

<route url="/V1/connector/Customer_MultiCreate" method="POST">
<service class="ABCSolutionsConnector365ApiCustomerConnectorCustomerRepositoryInterface" method="Customer_MultiCreate"/>
<resources>
 <resources ref="Magento_Customer::customer"/>
</resources>
</route>

And Installed the Varnish in my local magento system and compiled everything working in my local system.

enter image description here

enter image description here

enter image description here

Any help on this?


Get this bounty!!!

#StackBounty: #testing #magento2marketplace Installation & Varnish Test Results Failed => Class Does not exist Magento Marketplace

Bounty: 50

We have created the custom module and uploaded to Magento Marketplace and Installation & Varnish Test has been failed due to class does not exist.

enter image description here
But the class is exists. Don’t know why extension is failed.

enter image description here

We have a custom interface ConnectorCustomerRepositoryInterface, The Testing says the class does not exist.

The classes are below:

<?php
namespace ABCSolutionsConnector365ApiCustomer

interface ConnectorCustomerRepositoryInterface{
..
}

and the extended Class

<?php
namespace ABCSolutionsConnector365ModelResourceModel;

class CustomerRepository implements ABCSolutionsConnector365ApiCustomerConnectorCustomerRepositoryInterface{
...
}

And the di.xml

<preference for="ABCSolutionsConnector365ApiCustomerConnectorCustomerRepositoryInterface" type="ABCSolutionsConnector365ModelResourceModelCustomerRepository"/>

And webapi.xml file

<route url="/V1/connector/Customer_MultiCreate" method="POST">
<service class="ABCSolutionsConnector365ApiCustomerConnectorCustomerRepositoryInterface" method="Customer_MultiCreate"/>
<resources>
 <resources ref="Magento_Customer::customer"/>
</resources>
</route>

And Installed the Varnish in my local magento system and compiled everything working in my local system.

enter image description here

enter image description here

enter image description here

Any help on this?


Get this bounty!!!

#StackBounty: #angular #asynchronous #testing #jestjs Angular Jest async test seems to overflow results from one test to another

Bounty: 100

In Angular, using Jest we have 2 tests that test a method on a component class:

  describe('checkEmailStatus', () => {
    it('set VERIFIED page design when email verification succeeds', async () => {
      jest.spyOn(authService, 'checkEmailVerification');
      await expect(component.checkEmailStatus()).resolves.toEqual(undefined);
      expect(authService.checkEmailVerification).toBeCalledTimes(1);
      expect(component.pageDesign.key).toBe('verified');
    });

    it('set ERROR page design when email verification fails', async () => {
      const checkEmail = jest.spyOn(authService, 'checkEmailVerification');
      checkEmail.mockImplementation(() => {
        return Promise.reject(false);
      });
      await expect(component.checkEmailStatus()).resolves.toEqual(undefined);
      expect(authService.checkEmailVerification).toBeCalledTimes(1);
      expect(component.pageDesign.key).toBe('error');
    });
  });

These tests have been running fine for a month. Nothing about this component has changed and neither have we changed Jest version (25.2.7) yet now the 2nd test complains that the method was called 3 times.

If I comment out the first test, the 2nd tests passes.

It seems that the first test is not tearing down correctly – is there something I need to do to force that? (I tried using the done() callback, but it made no difference)

UPDATE

This is the method under test:

  async checkEmailStatus(): Promise<void> {
    this.isLoading = true;
    try {
      await this.authService.checkEmailVerification('');
      this.setPageDesign('verified');
      this.isLoading = false;
    } catch (error) {
      this.setPageDesign('error');
      this.isLoading = false;
    }
  }

This is the stubbed authService:

import {Observable, BehaviorSubject, of} from 'rxjs';
import {switchMap} from 'rxjs/operators';
import {mockUsers} from '../../../../mocks/user.mock';

// tslint:disable-next-line: completed-docs
function initStub() {
  const userId$ = new BehaviorSubject<string>(null);

  return {
    userId$,
    checkEmailVerification(): Promise<boolean> {
      return Promise.resolve(true);
    }
  };
}

export const authServiceStub = initStub();

UPDATE 2

This is the complete test file:

import {AuthService} from 'src/app/shared/services/auth.service';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';

import {VerifyEmailComponent} from './verify-email.component';
import {SharedModule} from '../shared/shared.module';
import {getTranslocoModule} from '../transloco-testing.module';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {AngularFireModule} from '@angular/fire';
import {environment} from 'src/environments/environment';
import {routerStub} from '../test/helpers/router.stub';
import {authServiceStub} from '../test/helpers/auth.service.stub';

fdescribe('VerifyEmailComponent', () => {
  let component: VerifyEmailComponent;
  let fixture: ComponentFixture<VerifyEmailComponent>;
  let authService: AuthService;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [VerifyEmailComponent],
      imports: [
        SharedModule,
        getTranslocoModule({}),
        BrowserAnimationsModule,
        AngularFireModule.initializeApp(environment.firebase)
      ],
      providers: [routerStub, {provide: AuthService, useValue: authServiceStub}]
    }).compileComponents();
    authService = TestBed.inject(AuthService);
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(VerifyEmailComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  afterEach(() => {
    jest.clearAllMocks();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });

  describe('setPageDesign', () => {
    it('should set the correct design for VERIFY', () => {
      component.setPageDesign('verify');
      expect(component.pageDesign.key).toBe('verify');
    });

    it('should set the correct design for VERIFIED', () => {
      component.setPageDesign('verified');
      expect(component.pageDesign.key).toBe('verified');
    });

    it('should set the correct design for ERROR', () => {
      component.setPageDesign('error');
      expect(component.pageDesign.key).toBe('error');
    });

    it('should set the ERROR design for unknown status values', () => {
      component.setPageDesign('');
      expect(component.pageDesign.key).toBe('error');
    });
  });

  describe('checkEmailStatus', () => {
    it('set VERIFIED page design when email verification succeeds', async () => {
      jest.spyOn(authService, 'checkEmailVerification');
      await expect(component.checkEmailStatus()).resolves.toEqual(undefined);
      expect(authService.checkEmailVerification).toBeCalledTimes(1);
      expect(component.pageDesign.key).toBe('verified');
    });

    it('set ERROR page design when email verification fails', async () => {
      const checkEmail = jest.spyOn(authService, 'checkEmailVerification');
      checkEmail.mockImplementation(() => {
        return Promise.reject(false);
      });
      await expect(component.checkEmailStatus()).resolves.toEqual(undefined);
      fixture.detectChanges();

      expect(authService.checkEmailVerification).toBeCalledTimes(1);
      expect(component.pageDesign.key).toBe('error');
    });
  });

  describe('onClickContinue', () => {
    // TODO: implement 2 tests for if/else cases of the button
    return undefined;
  });
});

This is the component code:

import {TranslocoService, TRANSLOCO_SCOPE} from '@ngneat/transloco';
import {Component, OnInit} from '@angular/core';
import {AuthService} from '../shared/services/auth.service';
import {Router} from '@angular/router';

// define static data to be used only by this component
interface PageDesign {
  icon: string;
  key: string;
}
const pageDesigns: PageDesign[] = [
  {
    icon: 'email-verified',
    key: 'verify'
  },
  {
    icon: 'email-verified',
    key: 'verified'
  },
  {
    icon: 'email-expired',
    key: 'error'
  }
];

@Component({
  selector: 'wn-verify-email',
  templateUrl: './verify-email.component.html',
  styleUrls: ['./verify-email.component.scss'],
  providers: [{provide: TRANSLOCO_SCOPE, useValue: 'verifyEmail'}]
})
export class VerifyEmailComponent implements OnInit {
  isLoading: boolean = false;
  pageDesign: PageDesign;

  constructor(
    public translocoService: TranslocoService,
    private authService: AuthService,
    private router: Router
  ) {}

  /**
   * Init
   */
  ngOnInit(): void {
    this.setPageDesign('verify');
    this.checkEmailStatus();
  }

  /**
   * Affects the current email data
   */
  setPageDesign(status: string): any {
    this.pageDesign = pageDesigns.find(
      emailDesign => emailDesign.key === status
    );
    if (!this.pageDesign)
      this.pageDesign = pageDesigns.find(
        emailDesign => emailDesign.key === 'error'
      );
  }

  /**
   * Check whether email address is verified
   */
  async checkEmailStatus(): Promise<void> {
    this.isLoading = true;
    try {
      await this.authService.checkEmailVerification('');
      this.setPageDesign('verified');
      this.isLoading = false;
    } catch (error) {
      this.setPageDesign('error');
      this.isLoading = false;
    }
  }

  /**
   * Click handler for the continue navigation button
   */
  onClickContinue(status: string) {
    if (status === 'verified')
      // TODO: use the continueURL from params and navigate to that
      console.error('continue url needed');
    else this.router.navigate(['/']);
  }
}


Get this bounty!!!

#StackBounty: #jenkins #testing #groovy #nunit #invoke Exception has been thrown by the target of an invocation, in jenkins' groovy…

Bounty: 50

I need to maintain a jenkins groovy script (we are not sure however if it ever worked).The script for a pipeline build has multiple stages (‘revision’ and ‘build’ stages before ‘unit tests’ have succeeded), one of which is the following:

enter image description here

stage('Unit Tests')
        {
            stages
            {
                stage('Tests')
                {
                    parallel
                    {
                        stage('TRKengineTest')
                        {
                            steps 
                            {
                                bat '"C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" TRKengine\TRKengine.Test\bin\Release\netcoreapp3.1\TRKengine.Test.dll --result=TRKengine.Test.xml;format=nunit2 --timeout=180000  --workers=1'
                                echo "Something to do?"
                            }
                        }
                        stage('TRKengineGUItest')
                        {
                            steps 
                            {
                                //bat '"C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" TRKengine\TRKengineGUI.Test\bin\Release\netcoreapp3.1\TRKengineGUI.Test.dll --result=TRKengineGUI.Test.xml;format=nunit2 --timeout=180000 -v --workers=1'
                                echo "Nothing to do"
                            }
                        }
                    }
                }
                stage('Testresults')
                {
                    steps
                    {
                        nunit testResultsPattern: 'TRKengine.Test.xml, TRKengineGUI.Test.xml'
                    }
                }
            }
        }

The bat command returns a -100 error. More precisely:

C:JenkinsworkspaceTRKengine_trunk>"C:Program Files (x86)NUnit.orgnunit-consolenunit3-console.exe" TRKengineTRKengine.TestbinReleasenetcoreapp3.1TRKengine.Test.dll --result=TRKengine.Test.xml;format=nunit2 --timeout=180000 -v  --workers=1 

NUnit Console Runner 3.6.1 

Copyright (C) 2017 Charlie Poole



Runtime Environment

   OS Version: Microsoft Windows NT 10.0.14393.0

  CLR Version: 4.0.30319.42000



Test Files

    TRKengineTRKengine.TestbinReleasenetcoreapp3.1TRKengine.Test.dll





Errors, Failures and Warnings



1) Error : 

Exception has been thrown by the target of an invocation.



Server stack trace: 

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)

   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)

   at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)

   at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)

   at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)

   at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)

   at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)

   at NUnit.Engine.Drivers.NUnit3FrameworkDriver.Load(String testAssemblyPath, IDictionary`2 settings)

   at NUnit.Engine.Runners.DirectTestRunner.LoadPackage()

   at NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()

   at NUnit.Engine.Runners.DirectTestRunner.RunTests(ITestEventListener listener, TestFilter filter)

   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)

   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)



Exception rethrown at [0]: 

   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

   at NUnit.Engine.ITestEngineRunner.Run(ITestEventListener listener, TestFilter filter)

   at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)



Test Run Summary

  Overall result: Failed

  Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0

  Start time: 2020-07-15 11:32:42Z

    End time: 2020-07-15 11:32:43Z

    Duration: 0.556 seconds



Results (nunit2) saved as TRKengine.Test.xml

script returned exit code -100

I have tried a couple of things:

1)First of all, it seems like the path of nunit-console.exe is wrong but as I found out, it can be used in recent releases of nunit.

2)The path of the test.dll is correct, as I manually navigated there and ..netcoreapp3.1TRKengine.Test.dll is indeed there.

3)I have spotted –result=TRKengine.Test.xml;format=nunit2 in other exampels across the internet.

4)I experimented with removing any combinations of the remaining parameters, workers/timeout -v etc, without success.

So the line where the error appears, seems to be correct, and my intuition is that probably the mistake has already happened somewhere else.

I am not sure what "invocation" means. I have also checked How do you run NUnit tests from Jenkins? that seems related and it feels like Winston33 ‘s proposition is exactly like what is happening here.

Something that is a bit worrying is that my machine is 64 bits but the path is ..x86.

I also have access to code and all projects inside the solution build successfully

I am a total beginner in both jenkins and groovy, so if I had not disclosed any necessary information please notify me.

Any help would be greatly appreciated.


Get this bounty!!!

#StackBounty: #testing #continuous-integration #end-to-end #health-monitoring Continious E2E monitoring with SDK and service discovery …

Bounty: 300

we have a custom system and I was wondering if there are available analogs we can switch to.

Our system runs various language agnostic test suites against each node of given role. Each test process simply gets target node IP and some values and returns test results in specific format as output.

Questions are:

  • What is the proper term for such system?
  • Are there any known solutions like this?
  • Are there any best practices we can onboard while switching?

Simplified schema

Wanted features are:

  • Web frontend to configure, trigger executions and check results
  • Schedulled executions
  • Smart alert triggering
    (something like “more than 5 nodes failed the test” or “3 runs in a row had failed tests”)
  • Language agnostic tests
    (we have SDKs and and helper libraries using different languages, which we are also under test)
  • Custom service discovery support
    (basically we want to provide test configuration with role name and scheduller should fetch the list of nodes)

Thanks in advance!


Get this bounty!!!

#StackBounty: #java #testing #junit #rollback #micronaut Micronaut and JUnit rollback

Bounty: 150

I have some tests written for a micronaut micro service. I would want that after my tests are done all the changes in the DB are reverted (rollback). Firstly I have written a simple example which seems to work. Changes are reverted. But when I run a micro service test using the same analogy the changes are not reverted.

Simple working example:

@Test
@Transactional
public void testRollback() {
    try (Connection connection = dataSource.getConnection();

        Statement stmt = connection.createStatement()){
        connection.setAutoCommit(false);
        stmt.execute(String.format("INSERT INTO city VALUES (9999, 'Darko town', '123')"));
        connection.rollback();

    } catch (SQLException e) {
        Assert.fail("Exception " + e);
    }
}

After this is executed the city is removed from the DB.

My real test scenario:

@Test
@Transactional
public void testDeleteDocuments() {

    try (final Connection connection = deletionService.getDataSource().getConnection(); 

        Statement stmt = connection.createStatement()) {
        connection.setAutoCommit(false);
        deletionService.startHacDeletion();
        connection.rollback();

    }catch (SQLException e) {
        Assert.fail("Exception " + e);
    }

}

Everything done by the method I am testing: DeletionService.startHacDeletion() is not reverted.

Am I missing something? Is this the right approach? Please assist….

UPDATE:

here is the delete function

public void deleteHacDocuments () {

    List<Document> allComments = new ArrayList<>();

    while (hacDeletionActive) {
        List<Document> parentDocuments = documentRepository.findHacDocuments();

        LOG.info(String.format("Remove HAC parent documents %d", parentDocuments.size()));

        for(Document document : parentDocuments){
            LOG.info(String.format("Remove HAC documents %d", document.getId()));
        }


        if (parentDocuments.isEmpty()) {
            hacDeletionActive = false;
            LOG.info("HAC deletion finished");
        } else {

            for (Document doc : parentDocuments) {
                if (doc.getType() == 1) {
                     deleteWholeStudy(doc.getId());
                } else if (doc.getType() == 6) {
                    List<Document> studies = documentRepository.findStudiesByCase(doc.getId());

                    for (Document study : studies) {
                        deleteWholeStudy(study.getId());
                    }

                    deleteWholeCase(doc.getId());

                } else if (doc.getType() == 4) {
                    allComments.add(doc);
                } else {
                    documentService.markDocumentAsDeleted(doc.getId());
                }
            }
            documentService.markCommentsAsDeleted(allComments);
        }

}
}


Get this bounty!!!

#StackBounty: #php #testing #phpunit #php-parser How is it possible to compare two nodes excluding protected attributes? (PHP-Parser)

Bounty: 50

I use PHP-Parser in my project. I would like to compare two nodes, using PHPUnit‘s assertSame function.

Despite the nodes are the same, it gives a false result.
The reason is, that one of the nodes contains two protected attributes, and the other does not:

["attributes":protected]=>
array(2) {
  ["startLine"]=>
  int(2)
  ["endLine"]=>
  int(2)
}

Is it possible to compare the nodes excluding protected attributes?


Get this bounty!!!

#StackBounty: #android-studio #testing #github #intellij-idea #version-control How to align git working copy using only Android Studio …

Bounty: 50

There are a bunch of decade-old answers for using git command line to accomplish various goals, but this question is how to use the standard git plugin for Android Studio 3.3.1, GUI only to “fix” a common “problem”. Maybe it’s “impossible” without git command line. If so, then that’s the answer: “impossible”, but you would have to wonder about the authors of the VSC plug-in.

Scenario

You would like to test some code that’s hosted on github.com and you only want to use the GUI of Android Studio. You’re asked to test but don’t know how to switch branches and keep an exact match with the code you’re supposed to be testing. You have read-only access to the remotes.

Checkout / Clone

Within Android Studio, you select VCS > Checkout from Version Control > Git, then you paste the url you found while using your web browser. So it might be something like https://github.com/someguy42/someproggy42. You hit the test button and it says Connection successful. Then you hit the Clone button.

You check the remotes: VCS > Git > Remotes... If the one you want isn’t there, you do(plus sign) > (url of repository found in github.com). You specify the name of this remote as someguy42.

You then do a fetch VCS > Git > Fetch. At the bottom right of the Android studio, you click and you see someguy42master, someguy42feature1, someguy42feature2. You note on the web that both features branched off from master.

All is well. So far.

Testing Two Branches

You are asked to test both features.

So from the list you see by left clicking on the bottom right of the IDE, you right click on someguy42feature1 > Checkout As... > feature1.

You complete your work on feature 1. Maybe you add a logging statement or something, but nothing you care to save.

Now it’s time for feature 2, so you repeat the process as before: from list on the bottom right of the IDE, you right click on someguy42feature2 > Checkout As... > feature2.

You notice something odd. You now have a mixture of feature1 and feature2 in your IDE!

You prove this to yourself by going to the Android app folder, right click and select Git > Compare with Branch... and you compare with the remote someguy42master. You expect to see only files changed in feature2, but both feature1 and feature2 files are in the list.

Question

What steps, executed exclusively through the Android Studio GUI and the VCS plug-in, would make it so your working copy was a guaranteed pristine copy of only files from feature2?


Get this bounty!!!

#StackBounty: #ios #firebase #testing #firebase-authentication #firebase-test-lab Testing passwordless auth in Firebase test lab for iOS

Bounty: 100

I am trying to figure out how to perform e2e test via firebase test lab for iOS that allow to check passwordless authentication flow, which essentially should do following

  1. Enters email within my app
  2. Firebase sends auth link to such email
  3. Somehow I need to be logged into such email somewhere in firebases test device, I assume either in mail app, or gmail?
  4. I need to know when new email arrives and open it
  5. Once I opened an email I need to click on auth link
  6. This should bring me back into the app and authenticate

My biggest issue at the moment is figuring out steps that happen outside my app i.e. how can I prepare for this test and log in under my email address (is it better to log into gmail in safari for example or somehow add this acc to apples mail app?).


Get this bounty!!!