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

Yaml parser: implement loadClasses flag #2688

Merged

Conversation

dsankouski
Copy link
Contributor

@dsankouski dsankouski commented Dec 6, 2021

Parser loadClasses flag controls, whether test classes will be loaded during
suite parsing. Setting it to false allow to load yaml suite with non-existent
classes, whereas true will fail parsing on test class loading.

Did you remember to?

  • Add test case(s)
  • Update CHANGES.txt
  • Auto applied styling via ./gradlew autostyleApply
  • Add new features to TestNG

@dsankouski dsankouski force-pushed the implement_yaml_load_classes_flag branch 2 times, most recently from 6667b8c to e0701da Compare December 6, 2021 14:20
Parser loadClasses flag controls, whether test classes will be loaded during
suite parsing. Setting it to false allow to load yaml suite with non-existent
classes, whereas true will fail parsing on test class loading.
@dsankouski dsankouski force-pushed the implement_yaml_load_classes_flag branch from e0701da to a1f2e3f Compare December 6, 2021 14:21
} else {
className = ((ScalarNode) node).getValue();
}
return c.newInstance(className, loadClasses);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please use org.testng.internal.objects.InstanceCreator#newInstance(java.lang.reflect.Constructor<T>, java.lang.Object...) to create the instance ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

nodeTuple ->
((ScalarNode) nodeTuple.getKeyNode()).getValue().equals("name"))
.findFirst()
.orElseThrow(RuntimeException::new)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we consider throwing org.testng.TestNGException instead with a proper error message that explains what went wrong ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

CHANGES.txt Outdated
@@ -1,4 +1,5 @@
Current
New: Yaml parser: implement loadClasses flag (Dzmitry Sankouski)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for traceability, it would be good if you could please help do the following:

  1. Log a bug that explains the problem
  2. Refer to that bug id here so that the changeset information is available in the CHANGES.txt
  3. Add a reference to the issue in the description attribute of @Test test, so that we know that the test belongs to a specific defect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@dsankouski
Copy link
Contributor Author

dsankouski commented Dec 7, 2021

closes #2689

- use InstanceCreator#newInstance()
- use TestNG exception with detail exception message
- create and link github issue
Copy link
Member

@krmahadevan krmahadevan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juherr - Can you please help take a quick look from your side as well ?

@juherr juherr merged commit 2a756e5 into testng-team:master Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants