Forum Discussion

Suniltech's avatar
Suniltech
Occasional Contributor
11 months ago

TestComplete: Unable to see c# option while creating project. Is it actually fully supported?

TestComplete: Unable to see c# option while creating a new project. Also, one of your documentation page says that creating test using c# is not recommended. For my My project c# is must so whats the way forward? Can I assume that TestComplete is not the right fit?

Reference Page: https://support.smartbear.com/testcomplete/docs/reference/language/csscript.html#:~:text=C%23Script%20is%20a%20specific,it%20to%20create%20new%20tests.

 

It says: C#Script is a legacy language. We do not recommend that you use it to create new tests. Instead, we recommend that you use JavaScript or Python:
Please let me know, how to use full c# language for creating test, reusable functions and custom actions?

 

 

Please let me know, how to use full c# language for creating test, reusable functions and custom actions?

14 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Try this:

    1) Right click on your Project Suite in the Project Explorer

    2) Select Add -> New Item

     

    The resuting dialog is a little different and allows you to select C#Script as a scripting language.

    Note, however, that the documentation given above still applies.  There is, technically, no such thing as C#Script.  It's a wrapper around JavaScript in the TestComplete project structure.

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      Hi,

       

      There is, technically, no such thing as C#Script.  It's a wrapper around JavaScript in the TestComplete project structure.

       

      Small correction: C#Script, like C++Script, is a wrapper not around JavaScript, but around JScript.

       

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    See Selecting the Scripting Language

     

    Quote - "Note however that the syntax of C#Script and C++Script differs from that of C# and C++. So, selecting these scripting languages makes sense only if you plan to create a connected or self-testing C++ or C# application. If you want to select C#Script or C++Script only due to that the C# or C++ syntax is closer to your skills, we recommend that you rather use JavaScript as its syntax is more similar to C# and C++ than the C#Script and C++Script syntax is."

    • Suniltech's avatar
      Suniltech
      Occasional Contributor

      Oh yes! I've used it CodedUI for long time and looking for similar offering.

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      The other alternative is Coded UI, but that's deprecated!

      Oh really? Finally 🙂

      I tried it but was not able to understood the ideas behind it. Nothing personal, but I do not remember MS ever had UI testing tool.

       

  • Suniltech's avatar
    Suniltech
    Occasional Contributor

    Thank you for the reply!
    Actually, this is the issue! Project requirement is to use c# language only and can't go with any other language.

    Note: I am aware of c#+selenium and have experience however this is a particular requirement so doing POC on different tools/frameworks/libraries to identify the better automation solution for the given requirement.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      A couple of specific things here:

       

      1) Chat GPT, while AI, is really not a reliable source of complete information.  It is "Trained" based upon web content and will only regurgitate a synthesized version of what can typically be found on the web.  The key item missing in that Chat GPT result is the word "syntax".  You can write C# syntaxed scripts but it is NOT C# .NET programming language complete with all the built in objects, etc. 

      2) As rraghvani  pointed out, the only reason to use the C# Syntax C#Script is if you're going to be doing connected applications and such.  The language used for the automation does NOT have to be the same language that the application under test is written in. I can write a DelphiScript automation to test a Java application or a JavaScript automation to test a Python application.  Where the "right fit" for the tool is has to do with what language of automation code you're comfortable in.  Because C# and JavaScript are close in syntax, it makes sense to use JavaScript in your application.

      If your management is firm on "it must be C#", we've provided the work around as indicated.  However, you might want to communicate to your management that the automated test and the application under test do not need to share a language.

  • Suniltech's avatar
    Suniltech
    Occasional Contributor

    Chat GPT gave this response (Please have a look at the attached screenshots). So I am confused how to get to this and do custom coding

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      Hi,

       

      Chat GPT gave this response [...]

      It lied.

      Actually, provided code snippet is not for TestComplete, but for TestLeft.

      TestLeft is another product by SmartBear that is based on TestExecute runtime (TestExecute is TestComplete's test code executor) and makes it possible to create tests using either full-fledged C# or Java.

      I will not wonder as for such a strict requirement to use C# only, but would recommend to take a look at TestLeft. Maybe it will fit your needs. https://smartbear.com/product/?product=TestLeft

       

  • Suniltech's avatar
    Suniltech
    Occasional Contributor

    Well that settles it. TestComplete doesn't support c# like DotNet framework.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Coded UI wasn't a bad tool to use, and it worked great with our web application that's developed in C#, accessing existing functions within the web application was very easy. The only thing I hated was the documentations was very poor, and to identify an object (similar to mapped objects) you had to write several lines of code. Also, it only supported Internet Explorer, and we couldn't add third party components due to security risks.

     

     

     

     

  • Suniltech's avatar
    Suniltech
    Occasional Contributor

    I've used Coded UI for Web as well as for windows apps and it worked fine for me. The important point is it from MS and it was aligned with the business. I've worked on other similar tools as well but agar it's all about getting aligned with the business requirement and work within the given choices.

     

    It's not the end of the world and we still have many choices, hopefully the right one. 
    Thank you all for taking time to respond to my queries.