Logo-amall

Hello @mention. I've used pyTest only for basic tests, but not CI/CD. So I will share my experience with Robot Framework. *Benefits*: - If non dev want to develop test, it can be easy for them to write their own tests (but if you have well specified atomic keywords). - Generate test reports. - Big community & lib ressources (pytest has the same benefits) - Easy to integrate with classic CI/CD frameworks (Jenkins, Github actions ...) *Drawbacks*: - If you or your team are devs with Python knowledge, i'll suggest you to develop your with python. Even if you choose Robot FW, you will certainly have to write a python layer. - Code overhead : In my opinion, it takes too much time to develop a Robot FW layer, specially if you have not clearly specified all your keywords at the beginning, - Some basic development features are ugly (look how to do a simple FOR loop...) For microservice testing, Robot FW or pyTest can both do the job. If you plan to develop only a rest API testing layer, manu python lib can also do the job : Flask, FastAPI, ...

Last active 4 months ago

45 replies

10 views

  • JE

    Hello @mention. I've used pyTest only for basic tests, but not CI/CD. So I will share my experience with Robot Framework.
    Benefits:
    - If non dev want to develop test, it can be easy for them to write their own tests (but if you have well specified atomic keywords).
    - Generate test reports.
    - Big community & lib ressources (pytest has the same benefits)
    - Easy to integrate with classic CI/CD frameworks (Jenkins, Github actions …)
    Drawbacks:
    - If you or your team are devs with Python knowledge, i'll suggest you to develop your with python. Even if you choose Robot FW, you will certainly have to write a python layer.
    - Code overhead : In my opinion, it takes too much time to develop a Robot FW layer, specially if you have not clearly specified all your keywords at the beginning,
    - Some basic development features are ugly (look how to do a simple FOR loop…)

    For microservice testing, Robot FW or pyTest can both do the job.
    If you plan to develop only a rest API testing layer, manu python lib can also do the job : Flask, FastAPI, …

  • SN

    Hey @mention , thanks for your response. I'm a new employee, but the team is already sort of using Cypress for end-to-end. My boss is nagging me to limit my use of Cypress for integration testing. I don't know if Cypress is the best option because I'm very new to this microservice architecture. especially if you want a separate repository just for automation. I can communicate with the services using their APIs, but these services do not necessarily interact with each other via APIs; some of them consume messages from queues, in this case, SQS. My main goal is to test the communication happening between services. I just need a better understanding or maybe good articles that will help me understand how I can do this. I need a tool that supports robust libraries to enable me to mock these calls. I have automated integration testing for my previous organization. It was simple because I wrote the code within the same repo, so I could totally control that the server connects to my mock DB and it establishes a connection with the amqp URL I am providing. I just don't understand how I can do it here when I am totally dependent on APIs to communicate with the services. Sorry if I sound stupid, but I just need some insights on how I can achieve this. Any doc, any open source example, or anything I can use to get started will be very helpful.

  • KO

    @mention As far i can understand your problem, you've to create a map of the communications between your services, right ? I think you need something like probes on the backend services to create a map and monitor requests, performance, … Have you tried tools like AppDynamics, Dynatrace, New Relic, or something else ?

  • KO

    https://www.appdynamics.com/blog/product/automation-framework-in-analytics-part-1/

  • KO

    With an APM you'll be able to identify the requests used by the clients and create mock servers easily

  • KO

    I'm using https://jestjs.io/ for create my tests

  • SN

    i haven't actually created anything. I need to write automation for integration testing to test the communication happening between different services in a microservices architecture. We have done end-to-end testing, but now we want to write tests to verify the communication paths and interactions between services to detect interface defects. @mention

  • KO

    I can suggest you some tools to achieve this specific job like https://pact.io

  • KO

    You can have a look on their youtube channel which give a great overview of the problematic and the solution they bring to us with Pact : https://www.youtube.com/playlist?list=PLwy9Bnco-IpfZ72VQ7hce8GicVZs7nm0i

  • SN

    Thank you @mention , I'll read this and let you know if I have any questions or comments.

  • KO

    With pleasure 👍

  • SN

    Thanks @mention pact is exactly what i needed… gonna start working on the poc branch 😄 😄

  • KO

    Cool ! It may be a heavy load at the first place since you've to declare all the services to establish all the contracts, but then it's very usefull and worth

  • SI

    How can I get a specific value inside 2 nested dictionary?

  • KO

    @mention Hello, that's not the purpose of this thread i suggest you to post it directly on the channel <#902834445168570390> and to bring us more context (language, use case, …)

  • SN

    i have a doubt @mention so let's say the consumer code is written in typescript and the provider's in goLang.. will pact support multiple languages while writing the contract..

  • KO

    Pact will definitely support it 🙂

  • KO

    You have multiple implementation of pact for most languages

  • KO

    Have a look here : https://docs.pact.io/implementation_guides/cli, you can use pact as a CLI, library for JS, Java, .NET, Go, Python, C++, Rust etc…

  • KO

    You can even use it on your CI with Docker

  • KO

    You talked about Cypress the other day, you can have a look at their new adapter too : https://www.npmjs.com/package/@pactflow/pact-cypress-adapter

  • SN

    cool thanks 🙂

  • SN

    Hey @mention so i have written the dummy test for pact in the consumer side and trying to run the test with mocha…the spec file is in typescript.. and i have added the config for mocha in .mocharc.json
    {
    "extensions": ["ts"],
    "spec": ["src/pact/.spec."],
    "node-option": [
    "loader=ts-node"
    ]
    }
    but still getting the Unknown file extension ".ts".. any idea how i can solve this?

  • KO

    Hello @mention , did you try to have a look at the Mocha example repo for Typescript ? https://github.com/mochajs/mocha-examples/tree/master/packages/typescript ?

  • SN

    Yea i did… but was still getting the same error..

  • KO

    In the outDir folder have you all the expect transpiled (JS) files, spec files and typescript map files ?

  • KO

    The only way i could reproduce your error is when i disabled the line "require": "ts-node/register" from the example and set yours :

    "node-option": [
      "loader=ts-node"
    ]
    
  • SN

    i actually changed it back to "require": "ts-node/register" from what i had earlier.. it is still throwing the same error… 😞

  • KO

    So your .mocharc.json file is like :

    {
      "extension": ["ts"],
      "spec": "src/pact/*.spec.ts",
      "require": "ts-node/register"
    }
    

    ?

  • SN

    yep

  • KO

    Did you try to clone their demo package and start the test command from here ?

  • KO

    It may be a problem from your tsconfig.json

  • KO

    With their repo you may isolate the problem by comparison from your repo

  • SN

    yea you are right… it is because of the tsconfig.json, and after altering the tsconfig file's content to match what they had, it is no longer throwing the same problem.

  • SN

    this is a problem.. :/

  • KO

    Did you figured out what's the tsconfig property in fault ?

  • SN

    naah .. still figuring out…

  • SN

    it is cz of the module.. i have just created another tsconfig extending the original one and while running mocha, have specified the overridden configuration to use.. it is working now..

  • KO

    By module you mean your package is ESM ?

  • SN

    yep..

  • SN

    had to change it to commonjs

  • KO

    Yeap Mocha as some features available for ESM : https://mochajs.org/#nodejs-native-esm-support, but not all…

  • SN

    Thanks for your help 🙂 i might bug you a lot while i am working on this…

  • SN

    Hey @mention, I've been asked to compare pactflow and the open-source pact-broker. I completed the Pactflow setup but could not find detailed documentation for using a self-hosted pact-broker. Could you please help me?

  • KO

    Hello @mention, the pact-broker documentation can be found here : https://docs.pact.io/pact_broker, you've multiple way to deploy a Pact Broker app. I suggest you to find the best way , with minimum impact / costs between CLI, Bin, Docker Image.

Last active 4 months ago

45 replies

10 views