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

markup not in common interface/trait #33

Open
GoogleCodeExporter opened this issue Jan 11, 2016 · 9 comments
Open

markup not in common interface/trait #33

GoogleCodeExporter opened this issue Jan 11, 2016 · 9 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Write a function that will write to scalatest HTML report
2. Try to make this function available for any Suite

What is the expected output? What do you see instead?

I would expect the markup function to be available for any Suite type as it is 
for info


What version of the product are you using? On what operating system?
2.0.M5

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 22 Apr 2013 at 8:58

@GoogleCodeExporter
Copy link
Author

Sorry, badly written.  The markup function seems to be implemented in a few 
different types of 'Spec' (FlatSpec, FeatureSpec etc) but it is not on a common 
interface or trait.  This means I had to write some code that was specific to 
FlatSpec as that was the Suite type I was using.  Others can not use my code 
with FeatureSpec but will have to write duplicate code instead just for 
FeatureSpec.  If you want to write some HTML to the ScalaTest HTML report you 
shouldn't need to rely on one of the 'Specs', there should be some trait or it 
should be in Suite or something similar, no?

Original comment by [email protected] on 22 Apr 2013 at 9:02

@GoogleCodeExporter
Copy link
Author

Hi Shmish,

This will actually heal itself soon, as we are planning on making info and 
markup non-implicit within the next six weeks. The way we are going to do it is 
to put info in an Informing trait, and markup in a Documenting trait. We'll 
have the style traits mix these in, and GivenWhenThen will have Informing as a 
self-type.

We actually moved the project over to Github, but I haven't updated the website 
yet to point to that issue tracker. So this will do. I'll close it once that 
enhancement is released in a SNAP release.

In the meantime, one other approach you could take is have the self type of 
your trait be a structural type that includes the markup method. Something like:

trait MyTrait { self: { def markup: Unit } =>
  // ...
}

You'll be able to mix that into any trait that has a method that looks like 
"markup: Unit."

Bill

Original comment by [email protected] on 22 Apr 2013 at 11:25

@GoogleCodeExporter
Copy link
Author

Thanks for your quick response Bill, I'll need to look into self types more as 
I'm new to scala but it looks like it might work for my case.  As you are 
moving the issue tracker, where can we put feature requests?  It's probably too 
big a request with too low a priority from others but TestNG records failed 
tests and runs those first the next time tests are run, this is great for 
end-to-end tests which tend to be slow, avoiding the possibility of having to 
wait 10 mins to find out that the test you are trying to fix is still broken...

Original comment by [email protected] on 23 Apr 2013 at 8:29

@GoogleCodeExporter
Copy link
Author

Hi,

I have been trying to implement the approach you suggested but I am getting an 
error: Illegal inheritance, self type does not conform to { def markup(text: 
String): Documenter }.  The definition of markup in FlatSpec is:

  implicit protected def markup: Documenter = atomicDocumenter.get

I wonder, am I unable to use this method as it is protected?

I am willing to wait for the Informing trait but I was just curious for my own 
personal development why I cannot do this and if there is a way round it?

Original comment by [email protected] on 7 May 2013 at 1:50

@GoogleCodeExporter
Copy link
Author

Hi Shmish,

Actually Informing and Documenting went into master (on github) about a week 
ago. I'll make a SNAP release for you. I'm not sure why you are getting an 
illegal inheritance, but you may be right about protected. You should be able 
to do just mark it protected in your trait if that's the case.

Bill

Original comment by [email protected] on 7 May 2013 at 6:00

@GoogleCodeExporter
Copy link
Author

Sounds cool, will this be available in Maven central?

Original comment by [email protected] on 9 May 2013 at 4:08

@GoogleCodeExporter
Copy link
Author

Well, I guess it will be in oss.sonatype.org first.  Which version will it be?

Original comment by [email protected] on 9 May 2013 at 4:11

@GoogleCodeExporter
Copy link
Author

Hi Smish,

Sorry it took me a few days to get the release out, but it is finally out here:

https://oss.sonatype.org/content/groups/public/org/scalatest/scalatest_2.10/2.0.
M6-SNAP17/

Bill

Original comment by [email protected] on 13 May 2013 at 6:51

@GoogleCodeExporter
Copy link
Author

Thanks, i'm really enjoying Scala test, I've found it really good for testing 
Java as well and it's great to find something so active,I hope I get a chance 
to contribute at done point.

Original comment by [email protected] on 13 May 2013 at 7:31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant