Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run two or more tests coverage tasks for a project with multiple modules in pipeline yml? #79

Open
md99991234 opened this issue May 23, 2023 · 8 comments
Labels
help wanted Community help is needed more-info-needed More information is required to debug or solve the problem

Comments

@md99991234
Copy link

Hello, I have used task hey24sheep.flutter.flutter-test.FlutterTest@0 in the pipeline to run the tests and get coverage. But my question is if i have multiple modules in my project, and if i want to see their test coverage individually then how to have multiple tasks that will run test coverage with different projectDirectory or module directories ? it is currently not allowing multiple tasks for FlutterTest for different modules. I think it is allowing only single FlutterTest task in pipeline.yml for the whole project. Can you tell me how can I have multiple FlutterTest tasks in pipeline file?

Code example:

- task: hey24sheep.flutter.flutter-test.FlutterTest@0
    displayName: 'Flutter Test rider journey Packages'
    inputs:
      projectDirectory: 'AppCore/rider_journey'
      generateCodeCoverageReport: true
    enabled: true
    continueOnError: true

- task: hey24sheep.flutter.flutter-test.FlutterTest@0
    displayName: 'Flutter Test user journey Packages'
    inputs:
      projectDirectory: 'AppCore/user_journey'
      generateCodeCoverageReport: true
    enabled: true
    continueOnError: true

the above code doesnt work. Pipeline/Build doest work whenever we use multiple flutter test tasks.

@hey24sheep
Copy link
Owner

It should work with multiple tasks. There is no restriction of any sort that you can't add multiple Flutter test task. Remove quotes from projectDirectory, try that.

Also you don't need enabled by default it's always enabled.

If for some reason it doesn't work. You can run command task with the custom flutter test command pointing to your directory.

projectDirectory: AppCore/user_journey

@md99991234
Copy link
Author

no multiple test converage tasks are not working in same pipeline file. Also without quotes it is not working as well.

@hey24sheep
Copy link
Owner

hey24sheep commented May 24, 2023 via email

@hey24sheep hey24sheep added help wanted Community help is needed more-info-needed More information is required to debug or solve the problem labels May 24, 2023
@md99991234
Copy link
Author

this is the error i am getting while using two or more flutter test tasks:

/pipeline.yml: (Line: 84, Col: 18, Idx: 2818) - (Line: 84, Col: 18, Idx: 2818): Mapping values are not allowed in this context.

I have tried using two flutter command task also, it is giving same error. It seems multiple of same type of tasks are not running/allowed. Can you please help.

@hey24sheep
Copy link
Owner

@md99991234 multiple tasks are allowed. We have used them in our builds and it works normally. Also, many other people are doing what you are trying to do. So there is something else wrong with your configuration.

Post your pipeline.yml file here.

@md99991234
Copy link
Author

sure, please find the pipeline.yml below:

variables:
  - name: flutter_version
    value: 3.7.3

steps:
  - task: hey24sheep.flutter.flutter-env.FlutterEnv@0
    displayName: 'Flutter Environment setup'
    inputs:
      customPath: '/home/user/fvm/versions/${{ variables.flutter_version }}'

  - bash: |
      
     echo Y | fvm use ${{ variables.flutter_version }}
      
      fvm flutter --version

      fvm flutter pub get --verbose
      
    displayName: 'Pub get'
    enabled: true

  - task: hey24sheep.flutter.flutter-command.FlutterCommand@0
    displayName: 'Flutter Command coverage rider journey'
    inputs:
        projectDirectory: 'AppCore/rider_journey'
        arguments: 'test --coverage'

  - bash: |
      cd AppCore/rider_journey
      genhtml -o coverage coverage/lcov.info
    displayName: 'genhtml rider_journey'
    continueOnError: true

  - task: hey24sheep.flutter.flutter-command.FlutterCommand@0
      displayName: 'Flutter Command coverage user journey'
      inputs:
        projectDirectory: 'AppCore/user_journey'
        arguments: 'test --coverage'

  - bash: |
      cd AppCore/user_journey
      genhtml -o coverage coverage/lcov.info
   displayName: 'genhtml user journey'
   continueOnError: true

@hey24sheep
Copy link
Owner

@md99991234 You can copy your YAML and paste it in https://yamlpipelinesvalidator.dev/ and click validate. It will tell you all the errors there are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Community help is needed more-info-needed More information is required to debug or solve the problem
Projects
None yet
Development

No branches or pull requests

2 participants