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

Allow specification of percentages in test methods. #3

Open
meisterT opened this issue Oct 24, 2014 · 0 comments
Open

Allow specification of percentages in test methods. #3

meisterT opened this issue Oct 24, 2014 · 0 comments

Comments

@meisterT
Copy link
Member

A good unit test has only one assert statement. However, in practice we sometimes use more than one assert statement or the code before the assert fails for whatever reason (e.g. NPE in student code). In these cases, we'd like to give point percentages.

A possible annotation might be:

@Test(timeout=100)
@tester.annotations.Bonus(exID = "GA4.6a", bonus = 10)
public void test() {
    Student s = new Student(1, 2, 3);
    @tester.annotations.Checkpoint(0.2)
    Student s2 = new Student(s);
    @tester.annotations.Checkpoint(0.3)
    assertEqual(s.toString(), s2.toString());
}

So the whole test is worth 10 (relative) points in total. If you reach the Checkpoint, you will get proportionate values of that, even if the test method fails later on.

One might even allow variables in the checkpoint annotation (instead of constants only).

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