Giter VIP home page Giter VIP logo

Comments (7)

christophd avatar christophd commented on May 31, 2024

TestContext is created before test is executed and gets injected as method parameter to all test actions. So if you want to access the context you should add a test action like this:

action(new AbstractTestAction() { ... });

Each test action has a execute method with TestContext as method parameter. You can add your custom logic the inside the test action execute method.

Hope this helps.

from citrus.

aaschmid avatar aaschmid commented on May 31, 2024

Hi @christophd,
yes, this is clear and this is why I build an retriveVariable(String) method to get variables from the test context. Are you not willing to just make more information protected to make the framework more extentable for me?
Cheers,
Andreas

from citrus.

christophd avatar christophd commented on May 31, 2024

This is not a matter of me being willing to do something or not. We should just discuss the need for some new extension point to the framework. Can you please tell me more about your use case scenario?

Maybe I am also giving you more insight to my thoughts: I am thinking that test runner is able to provide protected access to the test context itself quite easy while test designer would have more problems to do so. This is because of designer's nature to just build and prepare all actions before execution.

Citrus offers both test runner and test designer implementation that should be kept more or less equal in capabilities. I would not be happy with test runner giving access to test context while test designer is not. So I have to look at the designer if I can provide access to the context as well. Let me check this

from citrus.

aaschmid avatar aaschmid commented on May 31, 2024

Ok, this is understandable and a worth thing to think about, consistency over the different approaches. My use cases at the moment are described above and there are not more yet. But I am at the beginning of using Citrus for our E2E-Service-Integration tests. I think we will have to write a lot of custom actions to satisfy our needs and as soon as encounter another problem due to extensibility, I can update this issue.

from citrus.

christophd avatar christophd commented on May 31, 2024

I had a look at this and cam up with a solution via resource injection. So the test context instance can be injected to your test method. I will be very happy to receive your feedback. Read about it here: http://citrusframework.org/reference/html/index.html#testcase-context-injection

By the way Citrus 2.5 has been released today and this feature is accessible in that release

from citrus.

aaschmid avatar aaschmid commented on May 31, 2024

Hi @christophd, I really like the feature :-) really - even if it will not help that much for the above required extendability. As I have already mentioned, I will gather more experience and come back to you if I will have a more concreate idea.
You can close that ticket if you do not want to implement the RetrieveVariableAction yourself (or I can create a pull request for it if you want). I know that this feature is just useful using the test runner implementation, getting same variables out of the test context and being able to assert them using normal AssertJ, JUnit, Hamcrest or whatever else assertions ;-)

from citrus.

aaschmid avatar aaschmid commented on May 31, 2024

But is it possible that AssertionExceptions of any of the above mentioned libraries are ignore by Citrus. Haven't hat time to look at it in detail but it seems so ;-)

from citrus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.