Skip to main content



      Home
Home » Language IDEs » AspectJ » Sharing aspecs between src and test module?(I have defined an aspect in the src module but it does not seem to apply to code in the test module)
Sharing aspecs between src and test module? [message #1850973] Wed, 23 March 2022 13:35 Go to next message
Eclipse UserFriend
Hi. I am writing Aspects to monitor/intercept test code. I am defining them in the src module but they don't seem to apply unless I define them in the test module instead (where the actual tests are). However, I also want to monitor/intercept test framework code in the src module. (Note that I also tried setting <scope>test</scope> for the aspect dependencies in my pom file.)

I can envision a couple of approaches (aside from my attempt to set scope, above):

1. Define the aspects in the test module and use cflow() for my pointcut definition (which will hopefully cover framework code from src as well)

2. Define an abstract aspect in src and extend it with the proper pointcuts in src and test

Do those ideas make sense? Any other suggestions/ideas? Thanks!
Re: Sharing aspecs between src and test module? [message #1861462 is a reply to message #1850973] Fri, 13 October 2023 15:15 Go to previous messageGo to next message
Eclipse UserFriend
Creating an abstract aspect in the src module and extending it in both src and test can provide a clean and maintainable solution. By defining the common pointcuts and functionalities in the abstract aspect, you can then specialize and customize its behavior in the individual aspects within the src and test modules.
Re: Sharing aspecs between src and test module? [message #1861469 is a reply to message #1861462] Fri, 13 October 2023 15:48 Go to previous messageGo to next message
Eclipse UserFriend
Thanks!
Re: Sharing aspecs between src and test module? [message #1862898 is a reply to message #1850973] Fri, 05 January 2024 01:51 Go to previous messageGo to next message
Eclipse UserFriend
Kevin Kraft wrote on Wed, 23 March 2022 17:35
Hi. I am writing Aspects to monitor/intercept test code. I am defining them in the src module but they don't seem to apply unless I define them in the test module instead (where the actual tests are). However, I also want to monitor/intercept test framework code in the src module. (Note that I also tried setting <scope>test</scope> for the aspect dependencies in my pom file.)

I can envision a couple of approaches (aside from my attempt to set scope, above):

1. Define the aspects in the test module and use cflow() for my pointcut definition (which will hopefully cover framework code from src as well)

2. Define an abstract aspect in src and extend it with the proper pointcuts in src and rice purity test

Do those ideas make sense? Any other suggestions/ideas? Thanks!

It sounds like you're dealing with some challenges in defining and applying aspects in the src and test modules. It's like trying to navigate through a complex maze of dependencies and module interactions. Your proposed approaches seem reasonable, and it's always good to consider different strategies when facing such issues. Finding the right balance and approach is crucial, and I hope you find a solution that works effectively for your testing needs.
Re: Sharing aspecs between src and test module? [message #1866255 is a reply to message #1850973] Thu, 23 May 2024 11:14 Go to previous messageGo to next message
Eclipse UserFriend
Hi, did you manage to do this ?
Re: Sharing aspecs between src and test module? [message #1866282 is a reply to message #1866255] Fri, 24 May 2024 13:25 Go to previous message
Eclipse UserFriend
I never got it working, unfortunately. I created an abstract base aspect class in main with an abstract pointcut, that I was able to extend with an aspect class in test, but when I tried extending it in main it would fail with NoAspectBoundException. I ended up having to create a separate aspect class in main.

[Updated on: Fri, 24 May 2024 13:26] by Moderator

Previous Topic:Aspects to monitor/intercept test code
Next Topic:Inconsistent bytecode generated by aspectjweaver 1.9.22
Goto Forum:
  


Current Time: Thu May 22 03:51:35 EDT 2025

Powered by FUDForum. Page generated in 0.02914 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top